1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-11 18:49:16 +00:00

Add emulation of SMB0-SMB7 instructions.

This commit is contained in:
Radosław Kujawa 2017-01-29 21:34:58 +01:00
parent bf01ceb4cf
commit 923a9db649
2 changed files with 61 additions and 9 deletions

View File

@ -134,7 +134,7 @@ OP_NOPI_84,"nop",IMPLIED,1,NULL,false
OP_STY_ZP,"sty",ZP,2,emul_sty,false
OP_STA_ZP,"sta",ZP,2,emul_sta,false
OP_STX_ZP,"stx",ZP,2,emul_stx,false
OP_SMB0_ZP,"smb0",ZP,2,NULL,false
OP_SMB0_ZP,"smb0",ZP,2,emul_smb0,false
OP_DEY,"dey",IMPLIED,1,emul_dey,false
OP_BIT_IMM,"bit",IMMEDIATE,2,emul_bit,false
OP_TXA,"txa",IMPLIED,1,emul_txa,false
@ -150,7 +150,7 @@ OP_NOPI_94,"nop",IMPLIED,1,NULL,false
OP_STY_ZPX,"sty",ZPX,2,emul_sty,false
OP_STA_ZPX,"sta",ZPX,2,emul_sta,false
OP_STX_ZPY,"stx",ZPY,2,emul_stx,false
OP_SMB1_ZP,"smb1",ZP,2,NULL,false
OP_SMB1_ZP,"smb1",ZP,2,emul_smb1,false
OP_TYA,"tya",IMPLIED,1,emul_tya,false
OP_STA_ABSY,"sta",ABSOLUTEY,3,emul_sta,false
OP_TXS,"txs",IMPLIED,1,emul_txs,false
@ -166,7 +166,7 @@ OP_NOPI_A4,"nop",IMPLIED,1,NULL,false
OP_LDY_ZP,"ldy",ZP,2,emul_ldy,false
OP_LDA_ZP,"lda",ZP,2,emul_lda,false
OP_LDX_ZP,"ldx",ZP,2,emul_ldx,false
OP_SMB2_ZP,"smb2",ZP,2,NULL,false
OP_SMB2_ZP,"smb2",ZP,2,emul_smb2,false
OP_TAY,"tay",IMPLIED,1,emul_tay,false
OP_LDA_IMM,"lda",IMMEDIATE,2,emul_lda,false
OP_TAX,"tax",IMPLIED,1,emul_tax,false
@ -182,7 +182,7 @@ OP_NOPI_B4,"nop",IMPLIED,1,NULL,false
OP_LDY_ZPX,"ldy",ZPX,2,emul_ldy,false
OP_LDA_ZPX,"lda",ZPX,2,emul_lda,false
OP_LDX_ZPY,"ldx",ZPY,1,emul_ldx,false
OP_SMB3_ZP,"smb3",ZP,2,NULL,false
OP_SMB3_ZP,"smb3",ZP,2,emul_smb3,false
OP_CLV,"clv",IMPLIED,1,emul_clv,false
OP_LDA_ABSY,"lda",ABSOLUTEY,3,emul_lda,false
OP_TSX,"tsx",IMPLIED,1,emul_tsx,false
@ -198,7 +198,7 @@ OP_NOPI_C4,"nop",IMPLIED,1,NULL,false
OP_CPY_ZP,"cpy",ZP,2,emul_cpy,false
OP_CMP_ZP,"cmp",ZP,2,emul_cmp,false
OP_DEC_ZP,"dec",ZP,2,emul_dec,false
OP_SMB4_ZP,"smb4",ZP,2,NULL,false
OP_SMB4_ZP,"smb4",ZP,2,emul_smb4,false
OP_INY,"iny",IMPLIED,1,emul_iny,false
OP_CMP_IMM,"cmp",IMMEDIATE,2,emul_cmp,false
OP_DEX,"dex",IMPLIED,1,emul_dex,false
@ -214,7 +214,7 @@ OP_NOPI_D4,"nop",IMPLIED,1,NULL,false
OP_NOPI_D5,"nop",ZPX,2,NULL,false
OP_CMP_ZPX,"cmp",ZPX,2,emul_cmp,false
OP_DEC_ZPX,"dec",ZPX,2,emul_dec,false
OP_SMB5_ZP,"smb5",ZP,2,NULL,false
OP_SMB5_ZP,"smb5",ZP,2,emul_smb5,false
OP_CLD,"cld",IMPLIED,1,NULL,false
OP_CMP_ABSY,"cmp",ABSOLUTEY,3,emul_cmp,false
OP_PHX,"phx",IMPLIED,1,emul_phx,false
@ -230,7 +230,7 @@ OP_NOPI_E4,"nop",IMPLIED,1,NULL,false
OP_CPX_ZP,"cpx",ZP,2,emul_cpx,false
OP_SBC_ZP,"sbc",ZP,2,NULL,false
OP_INC_ZP,"inc",ZP,2,emul_inc,false
OP_SMB6_ZP,"smb6",ZP,2,NULL,false
OP_SMB6_ZP,"smb6",ZP,2,emul_smb6,false
OP_INX,"inx",IMPLIED,1,emul_inx,false
OP_SBC_IMM,"sbc",IMMEDIATE,2,NULL,false
OP_NOP,"nop",IMPLIED,1,emul_nop,false
@ -246,7 +246,7 @@ OP_NOPI_F4,"nop",IMPLIED,1,NULL,false
OP_NOPI_F5,"nop",ZPX,2,NULL,false
OP_SBC_ZPX,"sbc",ZPX,2,NULL,false
OP_INC_ZPX,"inc",ZPX,2,emul_inc,false
OP_SMB7_ZP,"smb7",ZP,2,NULL,false
OP_SMB7_ZP,"smb7",ZP,2,emul_smb7,false
OP_SED,"sed",IMPLIED,1,NULL,false
OP_SBC_ABSY,"sbc",ABSOLUTEY,3,NULL,false
OP_PLX,"plx",IMPLIED,1,emul_plx,false

1 opcode_id mnemonic addressing size emulation modify_pc
134 OP_STY_ZP sty ZP 2 emul_sty false
135 OP_STA_ZP sta ZP 2 emul_sta false
136 OP_STX_ZP stx ZP 2 emul_stx false
137 OP_SMB0_ZP smb0 ZP 2 NULL emul_smb0 false
138 OP_DEY dey IMPLIED 1 emul_dey false
139 OP_BIT_IMM bit IMMEDIATE 2 emul_bit false
140 OP_TXA txa IMPLIED 1 emul_txa false
150 OP_STY_ZPX sty ZPX 2 emul_sty false
151 OP_STA_ZPX sta ZPX 2 emul_sta false
152 OP_STX_ZPY stx ZPY 2 emul_stx false
153 OP_SMB1_ZP smb1 ZP 2 NULL emul_smb1 false
154 OP_TYA tya IMPLIED 1 emul_tya false
155 OP_STA_ABSY sta ABSOLUTEY 3 emul_sta false
156 OP_TXS txs IMPLIED 1 emul_txs false
166 OP_LDY_ZP ldy ZP 2 emul_ldy false
167 OP_LDA_ZP lda ZP 2 emul_lda false
168 OP_LDX_ZP ldx ZP 2 emul_ldx false
169 OP_SMB2_ZP smb2 ZP 2 NULL emul_smb2 false
170 OP_TAY tay IMPLIED 1 emul_tay false
171 OP_LDA_IMM lda IMMEDIATE 2 emul_lda false
172 OP_TAX tax IMPLIED 1 emul_tax false
182 OP_LDY_ZPX ldy ZPX 2 emul_ldy false
183 OP_LDA_ZPX lda ZPX 2 emul_lda false
184 OP_LDX_ZPY ldx ZPY 1 emul_ldx false
185 OP_SMB3_ZP smb3 ZP 2 NULL emul_smb3 false
186 OP_CLV clv IMPLIED 1 emul_clv false
187 OP_LDA_ABSY lda ABSOLUTEY 3 emul_lda false
188 OP_TSX tsx IMPLIED 1 emul_tsx false
198 OP_CPY_ZP cpy ZP 2 emul_cpy false
199 OP_CMP_ZP cmp ZP 2 emul_cmp false
200 OP_DEC_ZP dec ZP 2 emul_dec false
201 OP_SMB4_ZP smb4 ZP 2 NULL emul_smb4 false
202 OP_INY iny IMPLIED 1 emul_iny false
203 OP_CMP_IMM cmp IMMEDIATE 2 emul_cmp false
204 OP_DEX dex IMPLIED 1 emul_dex false
214 OP_NOPI_D5 nop ZPX 2 NULL false
215 OP_CMP_ZPX cmp ZPX 2 emul_cmp false
216 OP_DEC_ZPX dec ZPX 2 emul_dec false
217 OP_SMB5_ZP smb5 ZP 2 NULL emul_smb5 false
218 OP_CLD cld IMPLIED 1 NULL false
219 OP_CMP_ABSY cmp ABSOLUTEY 3 emul_cmp false
220 OP_PHX phx IMPLIED 1 emul_phx false
230 OP_CPX_ZP cpx ZP 2 emul_cpx false
231 OP_SBC_ZP sbc ZP 2 NULL false
232 OP_INC_ZP inc ZP 2 emul_inc false
233 OP_SMB6_ZP smb6 ZP 2 NULL emul_smb6 false
234 OP_INX inx IMPLIED 1 emul_inx false
235 OP_SBC_IMM sbc IMMEDIATE 2 NULL false
236 OP_NOP nop IMPLIED 1 emul_nop false
246 OP_NOPI_F5 nop ZPX 2 NULL false
247 OP_SBC_ZPX sbc ZPX 2 NULL false
248 OP_INC_ZPX inc ZPX 2 emul_inc false
249 OP_SMB7_ZP smb7 ZP 2 NULL emul_smb7 false
250 OP_SED sed IMPLIED 1 NULL false
251 OP_SBC_ABSY sbc ABSOLUTEY 3 NULL false
252 OP_PLX plx IMPLIED 1 emul_plx false

View File

@ -494,7 +494,7 @@ emul_rts(rk65c02emu_t *e, void *id, instruction_t *i)
e->regs.PC = retaddr;
}
/* RMBx - reset or set memory bit (handles RMB0-RMB7) */
/* RMBx - reset memory bit (handles RMB0-RMB7) */
void
emul_rmb(rk65c02emu_t *e, void *id, instruction_t *i, uint8_t bit)
{
@ -632,6 +632,58 @@ emul_sei(rk65c02emu_t *e, void *id, instruction_t *i)
e->regs.P |= P_IRQ_DISABLE;
}
/* SMBx - set memory bit (handles SMB0-SMB7) */
void
emul_smb(rk65c02emu_t *e, void *id, instruction_t *i, uint8_t bit)
{
uint8_t val;
val = instruction_data_read_1(e, (instrdef_t *) id, i);
val |= (1 << bit);
instruction_data_write_1(e, id, i, val);
}
void
emul_smb0(rk65c02emu_t *e, void *id, instruction_t *i)
{
emul_smb(e, id, i, 0);
void
emul_smb1(rk65c02emu_t *e, void *id, instruction_t *i)
{
emul_smb(e, id, i, 1);
}
void
emul_smb2(rk65c02emu_t *e, void *id, instruction_t *i)
{
emul_smb(e, id, i, 2);
}
void
emul_smb3(rk65c02emu_t *e, void *id, instruction_t *i)
{
emul_smb(e, id, i, 3);
}
void
emul_smb4(rk65c02emu_t *e, void *id, instruction_t *i)
{
emul_smb(e, id, i, 4);
}
void
emul_smb5(rk65c02emu_t *e, void *id, instruction_t *i)
{
emul_smb(e, id, i, 5);
}
void
emul_smb6(rk65c02emu_t *e, void *id, instruction_t *i)
{
emul_smb(e, id, i, 6);
}
void
emul_smb7(rk65c02emu_t *e, void *id, instruction_t *i)
{
emul_smb(e, id, i, 7);
}
/* STP - stop the processor */
void
emul_stp(rk65c02emu_t *e, void *id, instruction_t *i)