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

Add test case for invalid opcode handling.

This commit is contained in:
Radosław Kujawa 2018-04-12 11:40:33 +02:00
parent d0728c8ade
commit 578955e4a1
2 changed files with 44 additions and 0 deletions

View File

@ -1474,6 +1474,37 @@ ATF_TC_BODY(emul_wrap_zpx, tc)
}
}
ATF_TC_WITHOUT_HEAD(emul_invalid_opcode);
ATF_TC_BODY(emul_invalid_opcode, tc)
{
rk65c02emu_t e;
bus_t b;
struct reg_state rorig;
rk65c02_loglevel_set(LOG_DEBUG);
b = bus_init_with_default_devs();
e = rk65c02_init(&b);
e.runtime_disassembly = true;
rorig = e.regs;
ATF_REQUIRE(rom_start(&e, "test_emulation_invalid_opcode.rom", tc));
ATF_CHECK(e.regs.A == rorig.A);
ATF_CHECK(e.regs.X == rorig.X);
ATF_CHECK(e.regs.Y == rorig.Y);
ATF_CHECK(e.regs.SP == rorig.SP);
ATF_CHECK(e.regs.P == rorig.P);
ATF_CHECK(e.regs.PC == 0xC007);
rk65c02_log(LOG_INFO, "PC: %x", e.regs.PC);
}
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, emul_and);
@ -1518,6 +1549,8 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, emul_wrap_zpx);
ATF_TP_ADD_TC(tp, emul_wrap_izpx);
ATF_TP_ADD_TC(tp, emul_invalid_opcode);
return (atf_no_error());
}

View File

@ -0,0 +1,11 @@
.byte 0x42
.byte 0xFF
.byte 0x43
.byte 0x44
.byte 0xFF
.byte 0x4B
.byte 0xFC
.byte 0xFF
.byte 0xFF
stp