From 9bcbeb3ca7a7a2c23c939320381ae4ef67c895ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= Date: Mon, 7 Jan 2019 11:43:23 +0100 Subject: [PATCH] Add tests for STY. --- test/test_emulation.c | 26 ++++++++++++++++++++++++++ test/test_emulation_sty_abs.s | 3 +++ test/test_emulation_sty_zp.s | 3 +++ test/test_emulation_sty_zpx.s | 3 +++ 4 files changed, 35 insertions(+) create mode 100644 test/test_emulation_sty_abs.s create mode 100644 test/test_emulation_sty_zp.s create mode 100644 test/test_emulation_sty_zpx.s diff --git a/test/test_emulation.c b/test/test_emulation.c index 8ccc71d..d661ad1 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_sty); +ATF_TC_BODY(emul_sty, tc) +{ + rk65c02emu_t e; + bus_t b; + + b = bus_init_with_default_devs(); + e = rk65c02_init(&b); + + /* STY zero page */ + e.regs.Y = 0xAA; + ATF_REQUIRE(rom_start(&e, "test_emulation_sty_zp.rom", tc)); + ATF_CHECK(bus_read_1(&b, 0x20) == 0xAA); + /* STY zero page X */ + e.regs.Y = 0x55; + e.regs.X = 0x1; + ATF_REQUIRE(rom_start(&e, "test_emulation_sty_zpx.rom", tc)); + ATF_CHECK(bus_read_1(&b, 0x20) == 0x55); + /* STY absolute */ + e.regs.Y = 0xAA; + ATF_REQUIRE(rom_start(&e, "test_emulation_sty_abs.rom", tc)); + ATF_CHECK(bus_read_1(&b, 0x2010) == 0xAA); + +} + ATF_TC_WITHOUT_HEAD(emul_ora); ATF_TC_BODY(emul_ora, tc) { @@ -1747,6 +1772,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_sty); ATF_TP_ADD_TC(tp, emul_sbc); ATF_TP_ADD_TC(tp, emul_sbc_16bit); ATF_TP_ADD_TC(tp, emul_sbc_bcd); diff --git a/test/test_emulation_sty_abs.s b/test/test_emulation_sty_abs.s new file mode 100644 index 0000000..cf7cebd --- /dev/null +++ b/test/test_emulation_sty_abs.s @@ -0,0 +1,3 @@ +start: sty 0x2010 + stp + diff --git a/test/test_emulation_sty_zp.s b/test/test_emulation_sty_zp.s new file mode 100644 index 0000000..842a753 --- /dev/null +++ b/test/test_emulation_sty_zp.s @@ -0,0 +1,3 @@ +start: sty 0x20 + stp + diff --git a/test/test_emulation_sty_zpx.s b/test/test_emulation_sty_zpx.s new file mode 100644 index 0000000..c9b5a8c --- /dev/null +++ b/test/test_emulation_sty_zpx.s @@ -0,0 +1,3 @@ +start: sty 0x1F,X + stp +