From 7dd511b7dd2b3f5474208d15ecb438ddd16f6156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= Date: Sat, 11 Feb 2017 22:36:57 +0100 Subject: [PATCH] Implement much better test case for decimal mode. --- test/test_emulation.c | 4 +++- test/test_emulation_adc_bcd.s | 11 +++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/test/test_emulation.c b/test/test_emulation.c index af7cb50..3710ecb 100644 --- a/test/test_emulation.c +++ b/test/test_emulation.c @@ -1190,7 +1190,9 @@ ATF_TC_BODY(emul_adc_bcd, tc) ATF_REQUIRE(rom_start(&e, "test_emulation_adc_bcd.rom", tc)); - ATF_CHECK(e.regs.A == 0x21); + ATF_CHECK(bus_read_1(&b, 0x10) == 0x05); + ATF_CHECK(bus_read_1(&b, 0x11) & P_CARRY); + rk65c02_dump_regs(&e); } diff --git a/test/test_emulation_adc_bcd.s b/test/test_emulation_adc_bcd.s index a456fb7..769dc3b 100644 --- a/test/test_emulation_adc_bcd.s +++ b/test/test_emulation_adc_bcd.s @@ -1,5 +1,12 @@ +; somewhat inspired by http://www.6502.org/tutorials/decimal_mode.html start: sed - lda #0x11 - adc #0x22 + sec + lda #0x58 + adc #0x46 + sta 0x10 + php + plx + stx 0x11 + stp