1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-22 15:31:12 +00:00

Add emulation and test for CLV instruction.

This commit is contained in:
Radosław Kujawa 2017-01-28 11:12:25 +01:00
parent f66e986cef
commit ee66f9c78c
4 changed files with 29 additions and 1 deletions

View File

@ -183,7 +183,7 @@ 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_CLV,"clv",IMPLIED,1,NULL,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
OP_NOPI_BC,"nop",IMPLIED,1,NULL,false

1 opcode_id mnemonic addressing size emulation modify_pc
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 false
186 OP_CLV clv IMPLIED 1 NULL emul_clv false
187 OP_LDA_ABSY lda ABSOLUTEY 3 emul_lda false
188 OP_TSX tsx IMPLIED 1 emul_tsx false
189 OP_NOPI_BC nop IMPLIED 1 NULL false

View File

@ -72,6 +72,13 @@ emul_clc(rk65c02emu_t *e, void *id, instruction_t *i)
e->regs.P &= ~P_CARRY;
}
/* CLV - clear overflow flag */
void
emul_clv(rk65c02emu_t *e, void *id, instruction_t *i)
{
e->regs.P &= ~P_SIGN_OVERFLOW;
}
/* DEC - decrement memory location/acumulator */
void
emul_dec(rk65c02emu_t *e, void *id, instruction_t *i)

View File

@ -287,6 +287,23 @@ ATF_TC_BODY(emul_stz, tc)
bus_finish(&b);
}
ATF_TC_WITHOUT_HEAD(emul_clv);
ATF_TC_BODY(emul_clv, tc)
{
rk65c02emu_t e;
bus_t b;
b = bus_init();
e = rk65c02_init(&b);
e.regs.P |= P_SIGN_OVERFLOW;
/* CLV */
ATF_REQUIRE(rom_start(&e, "test_emulation_clv.rom", tc));
ATF_CHECK(e.regs.P ^ P_SIGN_OVERFLOW);
bus_finish(&b);
}
ATF_TC_WITHOUT_HEAD(emul_clc_sec);
ATF_TC_BODY(emul_clc_sec, tc)
{
@ -665,6 +682,7 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, emul_dec);
ATF_TP_ADD_TC(tp, emul_dex_dey);
ATF_TP_ADD_TC(tp, emul_clc_sec);
ATF_TP_ADD_TC(tp, emul_clv);
ATF_TP_ADD_TC(tp, emul_inc);
ATF_TP_ADD_TC(tp, emul_inx_iny);
ATF_TP_ADD_TC(tp, emul_jmp);

View File

@ -0,0 +1,3 @@
start: clv
stp