1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-12 10:30:23 +00:00

Test indirect modes of JMP.

This commit is contained in:
Radosław Kujawa 2017-01-28 00:11:16 +01:00
parent 735c3677ce
commit f66e986cef
3 changed files with 31 additions and 6 deletions

View File

@ -626,19 +626,36 @@ ATF_TC_BODY(emul_jmp, tc)
b = bus_init(); b = bus_init();
e = rk65c02_init(&b); e = rk65c02_init(&b);
/* JMP absolute */
e.regs.PC = ROM_LOAD_ADDR; e.regs.PC = ROM_LOAD_ADDR;
ATF_REQUIRE(bus_load_file(&b, ROM_LOAD_ADDR, ATF_REQUIRE(bus_load_file(&b, ROM_LOAD_ADDR,
rom_path("test_emulation_jmp_abs.rom", tc))); rom_path("test_emulation_jmp_abs.rom", tc)));
rk65c02_step(&e, 3); rk65c02_step(&e, 3);
rk65c02_dump_regs(&e); ATF_CHECK(e.regs.PC = 0xC000);
/* /* JMP indirect absolute */
ATF_CHECK(e.regs.SP == 0xFE); e.regs.PC = ROM_LOAD_ADDR;
ATF_CHECK(bus_read_1(e.bus, STACK_END) == 0xAA); 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) ATF_TP_ADD_TCS(tp)

View File

@ -0,0 +1,4 @@
start: nop
nop
jmp (0x20)

View File

@ -0,0 +1,4 @@
start: nop
nop
jmp (0x30,X)