mirror of
https://github.com/rkujawa/rk65c02.git
synced 2024-12-04 04:51:27 +00:00
Add test case for invalid opcode handling.
This commit is contained in:
parent
d0728c8ade
commit
578955e4a1
@ -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());
|
||||
}
|
||||
|
||||
|
11
test/test_emulation_invalid_opcode.s
Normal file
11
test/test_emulation_invalid_opcode.s
Normal file
@ -0,0 +1,11 @@
|
||||
.byte 0x42
|
||||
.byte 0xFF
|
||||
.byte 0x43
|
||||
.byte 0x44
|
||||
.byte 0xFF
|
||||
.byte 0x4B
|
||||
.byte 0xFC
|
||||
.byte 0xFF
|
||||
.byte 0xFF
|
||||
stp
|
||||
|
Loading…
Reference in New Issue
Block a user