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

Add test cases for TAX, TAY, TXA, TYA.

This commit is contained in:
Radosław Kujawa 2017-01-24 12:55:46 +01:00
parent cddba4c56b
commit b047c4ff81
5 changed files with 42 additions and 0 deletions

View File

@ -197,6 +197,35 @@ ATF_TC_BODY(emul_nop, tc)
bus_finish(&b); bus_finish(&b);
} }
ATF_TC_WITHOUT_HEAD(emul_txa_tya_tax_tay);
ATF_TC_BODY(emul_txa_tya_tax_tay, tc)
{
rk65c02emu_t e;
bus_t b;
b = bus_init();
e = rk65c02_init(&b);
e.regs.A = 0x0;
e.regs.X = 0xAA;
e.regs.Y = 0x55;
ATF_REQUIRE(rom_start(&e, "test_emulation_txa.rom"));
ATF_CHECK(e.regs.A = 0xAA);
ATF_REQUIRE(rom_start(&e, "test_emulation_tya.rom"));
ATF_CHECK(e.regs.A = 0x55);
ATF_REQUIRE(rom_start(&e, "test_emulation_tax.rom"));
ATF_CHECK(e.regs.X = 0x55);
e.regs.A = 0xFF;
ATF_REQUIRE(rom_start(&e, "test_emulation_tay.rom"));
ATF_CHECK(e.regs.A = 0xFF);
bus_finish(&b);
}
/* test stack operation and stack related opcodes - PLA, PHA... */ /* test stack operation and stack related opcodes - PLA, PHA... */
ATF_TC_WITHOUT_HEAD(emul_stack); ATF_TC_WITHOUT_HEAD(emul_stack);
ATF_TC_BODY(emul_stack, tc) ATF_TC_BODY(emul_stack, tc)
@ -281,6 +310,7 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, emul_stz); ATF_TP_ADD_TC(tp, emul_stz);
ATF_TP_ADD_TC(tp, emul_php_plp); ATF_TP_ADD_TC(tp, emul_php_plp);
ATF_TP_ADD_TC(tp, emul_stack); ATF_TP_ADD_TC(tp, emul_stack);
ATF_TP_ADD_TC(tp, emul_txa_tya_tax_tay);
return (atf_no_error()); return (atf_no_error());
} }

View File

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

View File

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

View File

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

View File

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