From ed39eff773f41cc150f82e323355996df02bc8bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= Date: Mon, 7 Jan 2019 13:35:14 +0100 Subject: [PATCH] Add test cases for STX. --- test/test_emulation.c | 26 ++++++++++++++++++++++++++ test/test_emulation_stx_abs.s | 3 +++ test/test_emulation_stx_zp.s | 3 +++ test/test_emulation_stx_zpy.s | 3 +++ 4 files changed, 35 insertions(+) create mode 100644 test/test_emulation_stx_abs.s create mode 100644 test/test_emulation_stx_zp.s create mode 100644 test/test_emulation_stx_zpy.s diff --git a/test/test_emulation.c b/test/test_emulation.c index d661ad1..097a6f6 100644 --- a/test/test_emulation.c +++ b/test/test_emulation.c @@ -766,6 +766,31 @@ ATF_TC_BODY(emul_sta, tc) bus_finish(&b); } +ATF_TC_WITHOUT_HEAD(emul_stx); +ATF_TC_BODY(emul_stx, tc) +{ + rk65c02emu_t e; + bus_t b; + + b = bus_init_with_default_devs(); + e = rk65c02_init(&b); + + /* STX zero page */ + e.regs.X = 0xAA; + ATF_REQUIRE(rom_start(&e, "test_emulation_stx_zp.rom", tc)); + ATF_CHECK(bus_read_1(&b, 0x20) == 0xAA); + /* STX zero page Y */ + e.regs.X = 0x55; + e.regs.Y = 0x1; + ATF_REQUIRE(rom_start(&e, "test_emulation_stx_zpy.rom", tc)); + ATF_CHECK(bus_read_1(&b, 0x20) == 0x55); + /* STX absolute */ + e.regs.X = 0xAA; + ATF_REQUIRE(rom_start(&e, "test_emulation_stx_abs.rom", tc)); + ATF_CHECK(bus_read_1(&b, 0x2010) == 0xAA); + +} + ATF_TC_WITHOUT_HEAD(emul_sty); ATF_TC_BODY(emul_sty, tc) { @@ -1772,6 +1797,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_stx); ATF_TP_ADD_TC(tp, emul_sty); ATF_TP_ADD_TC(tp, emul_sbc); ATF_TP_ADD_TC(tp, emul_sbc_16bit); diff --git a/test/test_emulation_stx_abs.s b/test/test_emulation_stx_abs.s new file mode 100644 index 0000000..189b726 --- /dev/null +++ b/test/test_emulation_stx_abs.s @@ -0,0 +1,3 @@ +start: stx 0x2010 + stp + diff --git a/test/test_emulation_stx_zp.s b/test/test_emulation_stx_zp.s new file mode 100644 index 0000000..553b9cb --- /dev/null +++ b/test/test_emulation_stx_zp.s @@ -0,0 +1,3 @@ +start: stx 0x20 + stp + diff --git a/test/test_emulation_stx_zpy.s b/test/test_emulation_stx_zpy.s new file mode 100644 index 0000000..fd44089 --- /dev/null +++ b/test/test_emulation_stx_zpy.s @@ -0,0 +1,3 @@ +start: stx 0x1F,Y + stp +