mirror of
https://github.com/rkujawa/rk65c02.git
synced 2024-12-11 18:49:16 +00:00
Add emulation of INC and DEC.
This commit is contained in:
parent
699d791023
commit
b7f1b8095b
@ -25,7 +25,7 @@ OP_ASL_ZPX,"asl",ZPX,2,NULL
|
||||
OP_RMB1_ZP,"rmb1",ZP,1,NULL
|
||||
OP_CLC,"clc",IMPLIED,1,emul_clc
|
||||
OP_ORA_ABSY,"ora",ABSOLUTEY,3,emul_ora
|
||||
OP_INC,"inc",ACCUMULATOR,1,NULL
|
||||
OP_INC,"inc",ACCUMULATOR,1,emul_inc
|
||||
OP_NOPI_1C,"nop",IMPLIED,1,NULL
|
||||
OP_TRB_ABS,"trb",ABSOLUTE,3,NULL
|
||||
OP_ORA_ABSX,"ora",ABSOLUTEX,3,emul_ora
|
||||
@ -57,7 +57,7 @@ OP_ROL_ZPX,"rol",ZPX,2,emul_rol
|
||||
OP_RMB3_ZP,"rmb3",ZP,2,NULL
|
||||
OP_SEC,"sec",IMPLIED,1,emul_sec
|
||||
OP_AND_ABSY,"and",ABSOLUTEY,3,emul_and
|
||||
OP_DEC,"dec",ACCUMULATOR,1,NULL
|
||||
OP_DEC,"dec",ACCUMULATOR,1,emul_dec
|
||||
OP_NOPI_3C,"nop",IMPLIED,1,NULL
|
||||
OP_BIT_ABSX,"bit",ABSOLUTEX,3,emul_bit
|
||||
OP_AND_ABSX,"and",ABSOLUTEX,3,emul_and
|
||||
@ -197,7 +197,7 @@ OP_NOPI_C3,"nop",IMMEDIATE,2,NULL
|
||||
OP_NOPI_C4,"nop",IMPLIED,1,NULL
|
||||
OP_CPY_ZP,"cpy",ZP,2,NULL
|
||||
OP_CMP_ZP,"cmp",ZP,2,NULL
|
||||
OP_DEC_ZP,"dec",ZP,2,NULL
|
||||
OP_DEC_ZP,"dec",ZP,2,emul_dec
|
||||
OP_SMB4_ZP,"smb4",ZP,2,NULL
|
||||
OP_INY,"iny",IMPLIED,1,emul_iny
|
||||
OP_CMP_IMM,"cmp",IMMEDIATE,2,NULL
|
||||
@ -205,7 +205,7 @@ OP_DEX,"dex",IMPLIED,1,emul_dex
|
||||
OP_WAI,"wai",IMPLIED,1,NULL
|
||||
OP_CPY_ABS,"cpy",ABSOLUTE,3,NULL
|
||||
OP_CMP_ABS,"cmp",ABSOLUTE,3,NULL
|
||||
OP_DEC_ABS,"dec",ABSOLUTE,3,NULL
|
||||
OP_DEC_ABS,"dec",ABSOLUTE,3,emul_dec
|
||||
OP_BBS4_REL,"bbs4",ZPR,2,NULL
|
||||
OP_BNE_REL,"bne",RELATIVE,2,NULL
|
||||
OP_CMP_IZPY,"cmp",IZPY,2,NULL
|
||||
@ -213,7 +213,7 @@ OP_CMP_IZP,"cmp",IZP,2,NULL
|
||||
OP_NOPI_D4,"nop",IMPLIED,1,NULL
|
||||
OP_NOPI_D5,"nop",ZPX,2,NULL
|
||||
OP_CMP_ZPX,"cmp",ZPX,2,NULL
|
||||
OP_DEC_ZPX,"dec",ZPX,2,NULL
|
||||
OP_DEC_ZPX,"dec",ZPX,2,emul_dec
|
||||
OP_SMB5_ZP,"smb5",ZP,2,NULL
|
||||
OP_CLD,"cld",IMPLIED,1,NULL
|
||||
OP_CMP_ABSY,"cmp",ABSOLUTEY,3,NULL
|
||||
@ -221,7 +221,7 @@ OP_PHX,"phx",IMPLIED,1,emul_phx
|
||||
OP_STP,"stp",IMPLIED,1,emul_stp
|
||||
OP_NOPI_DD,"nop",ABSOLUTE,3,NULL
|
||||
OP_CMP_ABSX,"cmp",ABSOLUTEX,3,NULL
|
||||
OP_DEC_ABSX,"dec",ABSOLUTEX,3,NULL
|
||||
OP_DEC_ABSX,"dec",ABSOLUTEX,3,emul_dec
|
||||
OP_BBS5_REL,"bbs5",ZPR,2,NULL
|
||||
OP_CPX_IMM,"cpx",IMMEDIATE,2,NULL
|
||||
OP_SBC_IZPX,"sbc",IZPX,2,NULL
|
||||
@ -229,7 +229,7 @@ OP_NOPI_E3,"nop",IMMEDIATE,2,NULL
|
||||
OP_NOPI_E4,"nop",IMPLIED,1,NULL
|
||||
OP_CPX_ZP,"cpx",ZP,2,NULL
|
||||
OP_SBC_ZP,"sbc",ZP,2,NULL
|
||||
OP_INC_ZP,"inc",ZP,2,NULL
|
||||
OP_INC_ZP,"inc",ZP,2,emul_inc
|
||||
OP_SMB6_ZP,"smb6",ZP,2,NULL
|
||||
OP_INX,"inx",IMPLIED,1,emul_inx
|
||||
OP_SBC_IMM,"sbc",IMMEDIATE,2,NULL
|
||||
@ -237,7 +237,7 @@ OP_NOP,"nop",IMPLIED,1,emul_nop
|
||||
OP_NOPI_EC,"nop",IMPLIED,1,NULL
|
||||
OP_CPX_ABS,"cpx",ABSOLUTE,3,NULL
|
||||
OP_SBC_ABS,"sbc",ABSOLUTE,3,NULL
|
||||
OP_INC_ABS,"inc",ABSOLUTE,3,NULL
|
||||
OP_INC_ABS,"inc",ABSOLUTE,3,emul_inc
|
||||
OP_BBS6_REL,"bbs6",ZPR,2,NULL
|
||||
OP_BEQ_REL,"beq",RELATIVE,2,NULL
|
||||
OP_SBC_IZPY,"sbc",IZPY,2,NULL
|
||||
@ -245,7 +245,7 @@ OP_SBC_IZP,"sbc",IZP,2,NULL
|
||||
OP_NOPI_F4,"nop",IMPLIED,1,NULL
|
||||
OP_NOPI_F5,"nop",ZPX,2,NULL
|
||||
OP_SBC_ZPX,"sbc",ZPX,2,NULL
|
||||
OP_INC_ZPX,"inc",ZPX,2,NULL
|
||||
OP_INC_ZPX,"inc",ZPX,2,emul_inc
|
||||
OP_SMB7_ZP,"smb7",ZP,2,NULL
|
||||
OP_SED,"sed",IMPLIED,1,NULL
|
||||
OP_SBC_ABSY,"sbc",ABSOLUTEY,3,NULL
|
||||
@ -253,5 +253,5 @@ OP_PLX,"plx",IMPLIED,1,emul_plx
|
||||
OP_NOPI_FC,"nop",IMPLIED,1,NULL
|
||||
OP_NOPI_FD,"nop",ABSOLUTE,3,NULL
|
||||
OP_SBC_ABSX,"sbc",ABSOLUTEX,3,NULL
|
||||
OP_INC_ABSX,"inc",ABSOLUTEX,3,NULL
|
||||
OP_INC_ABSX,"inc",ABSOLUTEX,3,emul_inc
|
||||
OP_BBS7_REL,"bbs7",ZPR,2,NULL
|
||||
|
|
@ -43,6 +43,21 @@ emul_clc(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
e->regs.P &= ~P_CARRY;
|
||||
}
|
||||
|
||||
/* DEC - decrement memory location/acumulator */
|
||||
void
|
||||
emul_dec(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
{
|
||||
uint8_t val;
|
||||
|
||||
/* this is absurdly inefficient */
|
||||
val = instruction_data_read_1(e, (instrdef_t *) id, i);
|
||||
val--;
|
||||
instruction_data_write_1(e, id, i, val);
|
||||
|
||||
instruction_status_adjust_zero(e, val);
|
||||
instruction_status_adjust_negative(e, val);
|
||||
}
|
||||
|
||||
/* DNX - decrement X */
|
||||
void
|
||||
emul_dex(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
@ -73,6 +88,21 @@ emul_eor(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
instruction_status_adjust_negative(e, e->regs.A);
|
||||
}
|
||||
|
||||
/* INC - increment memory location/acumulator */
|
||||
void
|
||||
emul_inc(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
{
|
||||
uint8_t val;
|
||||
|
||||
/* this is absurdly inefficient */
|
||||
val = instruction_data_read_1(e, (instrdef_t *) id, i);
|
||||
val++;
|
||||
instruction_data_write_1(e, id, i, val);
|
||||
|
||||
instruction_status_adjust_zero(e, val);
|
||||
instruction_status_adjust_negative(e, val);
|
||||
}
|
||||
|
||||
/* INX - increment X */
|
||||
void
|
||||
emul_inx(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
|
Loading…
Reference in New Issue
Block a user