diff options
Diffstat (limited to 'emu/6502.c')
-rw-r--r-- | emu/6502.c | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -178,6 +178,8 @@ void cpu_6502_step( cpu_6502_t *cpu ) { uint8_t opcode; uint8_t operand8; + uint16_t operand16; + uint16_t tmp; opcode = cpu_6502_read_byte( cpu, cpu->PC ); cpu->PC++; @@ -230,6 +232,44 @@ void cpu_6502_step( cpu_6502_t *cpu ) cpu->A = cpu_6502_read_byte( cpu, operand8 ); update_negative_and_sign( cpu, cpu->A ); break; + + case STX_ABS: + operand16 = cpu_6502_read_word( cpu, cpu->PC ); + cpu->PC += 2; + cpu_6502_write_word( cpu, operand16, cpu->X ); + break; + + case DEY_IMPL: + cpu->Y--; + update_negative_and_sign( cpu, cpu->Y ); + break; + + case ROL_ACC: + tmp = ( cpu->A << 1 ) | is_carry( cpu ); + if( tmp & 0xFF00 ) { + cpu->PS |= PS_C; + } else { + cpu->PS &= ~PS_C; + } + cpu->A = tmp & 0xFF; + update_negative_and_sign( cpu, cpu->A ); + break; + + case BNE_REL: + operand8 = cpu_6502_read_byte( cpu, cpu->PC ); + cpu->PC++; + if( !is_zero( cpu ) ) { + cpu->PC += (int8_t)operand8; + } + break; + + case BCC_REL: + operand8 = cpu_6502_read_byte( cpu, cpu->PC ); + cpu->PC++; + if( !is_carry( cpu ) ) { + cpu->PC += (int8_t)operand8; + } + break; case JMP_ABS: cpu->PC = cpu_6502_read_word( cpu, cpu->PC ); |