diff --git a/test/test_emulation.c b/test/test_emulation.c index 197ded0..b5a7a3e 100644 --- a/test/test_emulation.c +++ b/test/test_emulation.c @@ -1020,6 +1020,22 @@ ATF_TC_BODY(emul_sign_overflow, tc) } +ATF_TC_WITHOUT_HEAD(emul_sbc); +ATF_TC_BODY(emul_sbc, tc) +{ + rk65c02emu_t e; + bus_t b; + + b = bus_init(); + e = rk65c02_init(&b); + + ATF_REQUIRE(rom_start(&e, "test_emulation_sbc_imm.rom", tc)); + ATF_CHECK(bus_read_1(&b, 0x10) == 0x0); + ATF_CHECK(bus_read_1(&b, 0x11) == 0xFF); + rk65c02_dump_regs(&e); + +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, emul_and); @@ -1046,6 +1062,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, emul_stack); ATF_TP_ADD_TC(tp, emul_txa_tya_tax_tay); ATF_TP_ADD_TC(tp, emul_sta); + ATF_TP_ADD_TC(tp, emul_sbc); ATF_TP_ADD_TC(tp, emul_sign_overflow); diff --git a/test/test_emulation_sbc_imm.s b/test/test_emulation_sbc_imm.s new file mode 100644 index 0000000..aca7754 --- /dev/null +++ b/test/test_emulation_sbc_imm.s @@ -0,0 +1,11 @@ +start: sec + lda #0x1 + sbc #0x1 + sta 0x10 + + sec + lda #0x0 + sbc #0x1 + sta 0x11 + stp +