From f9708ca049caec4a3286b924f486a2f7924d1b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= Date: Mon, 23 Jan 2017 15:02:21 +0100 Subject: [PATCH] Add STA, STY, STX emulation. --- src/65c02isa.csv | 28 ++++++++++++++-------------- src/emulation.c | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/65c02isa.csv b/src/65c02isa.csv index 87cef11..7a68ac3 100644 --- a/src/65c02isa.csv +++ b/src/65c02isa.csv @@ -128,35 +128,35 @@ OP_ADC_ABSX,"adc",ABSOLUTEX,3,NULL OP_ROR_ABSX,"ror",ABSOLUTEX,3,NULL OP_BBR7_REL,"bbr7",ZPR,2,NULL OP_BRA_REL,"bra",RELATIVE,2,NULL -OP_STA_IZPX,"sta",IZPX,2,NULL +OP_STA_IZPX,"sta",IZPX,2,emul_sta OP_NOPI_83,"nop",IMMEDIATE,2,NULL OP_NOPI_84,"nop",IMPLIED,1,NULL -OP_STY_ZP,"sty",ZP,2,NULL -OP_STA_ZP,"sta",ZP,2,NULL -OP_STX_ZP,"stx",ZP,2,NULL +OP_STY_ZP,"sty",ZP,2,emul_sty +OP_STA_ZP,"sta",ZP,2,emul_sta +OP_STX_ZP,"stx",ZP,2,emul_stx OP_SMB0_ZP,"smb0",ZP,2,NULL OP_DEY,"dey",IMPLIED,1,emul_dey OP_BIT_IMM,"bit",IMMEDIATE,2,NULL OP_TXA,"txa",IMPLIED,1,emul_txa OP_NOPI_8C,"nop",IMPLIED,1,NULL -OP_STY_ABS,"sty",ABSOLUTE,3,NULL -OP_STA_ABS,"sta",ABSOLUTE,3,NULL -OP_STX_ABS,"stx",ABSOLUTE,3,NULL +OP_STY_ABS,"sty",ABSOLUTE,3,emul_sty +OP_STA_ABS,"sta",ABSOLUTE,3,emul_sta +OP_STX_ABS,"stx",ABSOLUTE,3,emul_stx OP_BBS0_REL,"bbs0",ZPR,2,NULL OP_BCC_REL,"bcc",RELATIVE,2,NULL -OP_STA_IZPY,"sta",IZPY,2,NULL -OP_STA_IZP,"sta",IZP,2,NULL +OP_STA_IZPY,"sta",IZPY,2,emul_sta +OP_STA_IZP,"sta",IZP,2,emul_sta OP_NOPI_94,"nop",IMPLIED,1,NULL -OP_STY_ZPX,"sty",ZPX,2,NULL -OP_STA_ZPX,"sta",ZPX,2,NULL -OP_STX_ZPY,"stx",ZPY,2,NULL +OP_STY_ZPX,"sty",ZPX,2,emul_sty +OP_STA_ZPX,"sta",ZPX,2,emul_sta +OP_STX_ZPY,"stx",ZPY,2,emul_stx OP_SMB1_ZP,"smb1",ZP,2,NULL OP_TYA,"tya",IMPLIED,1,emul_tya -OP_STA_ABSY,"sta",ABSOLUTEY,3,NULL +OP_STA_ABSY,"sta",ABSOLUTEY,3,emul_sta OP_TXS,"txs",IMPLIED,1,emul_txs OP_NOPI_9C,"nop",IMPLIED,1,NULL OP_STZ_ABS,"stz",ABSOLUTE,3,emul_stz -OP_STA_ABSX,"sta",ABSOLUTEX,3,NULL +OP_STA_ABSX,"sta",ABSOLUTEX,3,emul_sta OP_STZ_ABSX,"stz",ABSOLUTEX,3,emul_stz OP_BBS1_REL,"bbs1",ZPR,2,NULL OP_LDY_IMM,"ldy",IMMEDIATE,2,emul_ldy diff --git a/src/emulation.c b/src/emulation.c index 4083b15..ea622fb 100644 --- a/src/emulation.c +++ b/src/emulation.c @@ -160,6 +160,27 @@ emul_stp(rk65c02emu_t *e, void *id, instruction_t *i) e->state = STOPPED; } +/* STA - store accumulator */ +void +emul_sta(rk65c02emu_t *e, void *id, instruction_t *i) +{ + instruction_data_write_1(e, id, i, e->regs.A); +} + +/* STX - store X */ +void +emul_stx(rk65c02emu_t *e, void *id, instruction_t *i) +{ + instruction_data_write_1(e, id, i, e->regs.X); +} + +/* STY - store Y */ +void +emul_sty(rk65c02emu_t *e, void *id, instruction_t *i) +{ + instruction_data_write_1(e, id, i, e->regs.Y); +} + /* STZ - store zero */ void emul_stz(rk65c02emu_t *e, void *id, instruction_t *i)