From f66e986cefda07050ac8191857f65f4e560e462c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= Date: Sat, 28 Jan 2017 00:11:16 +0100 Subject: [PATCH] Test indirect modes of JMP. --- test/test_emulation.c | 29 +++++++++++++++++++++++------ test/test_emulation_jmp_iabs.s | 4 ++++ test/test_emulation_jmp_iabsx.s | 4 ++++ 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 test/test_emulation_jmp_iabs.s create mode 100644 test/test_emulation_jmp_iabsx.s diff --git a/test/test_emulation.c b/test/test_emulation.c index 71717a9..c1d4f48 100644 --- a/test/test_emulation.c +++ b/test/test_emulation.c @@ -626,19 +626,36 @@ ATF_TC_BODY(emul_jmp, tc) b = bus_init(); e = rk65c02_init(&b); + /* JMP absolute */ e.regs.PC = ROM_LOAD_ADDR; ATF_REQUIRE(bus_load_file(&b, ROM_LOAD_ADDR, rom_path("test_emulation_jmp_abs.rom", tc))); rk65c02_step(&e, 3); - rk65c02_dump_regs(&e); + ATF_CHECK(e.regs.PC = 0xC000); -/* - ATF_CHECK(e.regs.SP == 0xFE); - ATF_CHECK(bus_read_1(e.bus, STACK_END) == 0xAA); + /* JMP indirect absolute */ + e.regs.PC = ROM_LOAD_ADDR; + ATF_REQUIRE(bus_load_file(&b, ROM_LOAD_ADDR, + rom_path("test_emulation_jmp_iabs.rom", tc))); - e.regs.X = 0; - */ + bus_write_1(&b, 0x20, 0x0); + bus_write_1(&b, 0x21, 0xC0); + + rk65c02_step(&e, 3); + ATF_CHECK(e.regs.PC = 0xC000); + + /* JMP indirect absolute X */ + e.regs.PC = ROM_LOAD_ADDR; + ATF_REQUIRE(bus_load_file(&b, ROM_LOAD_ADDR, + rom_path("test_emulation_jmp_iabsx.rom", tc))); + + e.regs.X = 0x10; + bus_write_1(&b, 0x40, 0x0); + bus_write_1(&b, 0x41, 0xC0); + + rk65c02_step(&e, 3); + ATF_CHECK(e.regs.PC = 0xC000); } ATF_TP_ADD_TCS(tp) diff --git a/test/test_emulation_jmp_iabs.s b/test/test_emulation_jmp_iabs.s new file mode 100644 index 0000000..63b2e09 --- /dev/null +++ b/test/test_emulation_jmp_iabs.s @@ -0,0 +1,4 @@ +start: nop + nop + jmp (0x20) + diff --git a/test/test_emulation_jmp_iabsx.s b/test/test_emulation_jmp_iabsx.s new file mode 100644 index 0000000..8909827 --- /dev/null +++ b/test/test_emulation_jmp_iabsx.s @@ -0,0 +1,4 @@ +start: nop + nop + jmp (0x30,X) +