From 69fb59ee413c424ccae20ed4191619fc3c066b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kujawa?= Date: Sat, 5 Jan 2019 12:13:28 +0100 Subject: [PATCH] Add missing test cases for LDA addressing modes. --- test/test_emulation.c | 16 +++++++++++++++- test/test_emulation_lda_izpx.s | 3 +++ test/test_emulation_lda_izpy.s | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 test/test_emulation_lda_izpx.s create mode 100644 test/test_emulation_lda_izpy.s diff --git a/test/test_emulation.c b/test/test_emulation.c index fed334a..770bd58 100644 --- a/test/test_emulation.c +++ b/test/test_emulation.c @@ -429,6 +429,20 @@ ATF_TC_BODY(emul_lda, tc) ATF_REQUIRE(rom_start(&e, "test_emulation_lda_zp.rom", tc)); ATF_CHECK(e.regs.A == 0xAE); + /* LDA indirect zero page X */ + bus_write_1(&b, 0x20, 0); + bus_write_1(&b, 0x21, 0x2E); + bus_write_1(&b, 0x2E00, 0x55); + e.regs.X = 0x01; + ATF_REQUIRE(rom_start(&e, "test_emulation_lda_izpx.rom", tc)); + ATF_CHECK(e.regs.A == 0x55); + + /* LDA indirect zero page Y */ + bus_write_1(&b, 0x2E10, 0xAA); + e.regs.Y = 0x10; + ATF_REQUIRE(rom_start(&e, "test_emulation_lda_izpy.rom", tc)); + ATF_CHECK(e.regs.A == 0xAA); + /* LDA absolute */ bus_write_1(&b, 0x2F5A, 0xEA); ATF_REQUIRE(rom_start(&e, "test_emulation_lda_abs.rom", tc)); @@ -440,7 +454,7 @@ ATF_TC_BODY(emul_lda, tc) ATF_REQUIRE(rom_start(&e, "test_emulation_lda_absx.rom", tc)); ATF_CHECK(e.regs.A == 0xEB); - /* LDA absolute X */ + /* LDA absolute Y */ bus_write_1(&b, 0x2F5E, 0xEC); e.regs.Y = 0x5E; ATF_REQUIRE(rom_start(&e, "test_emulation_lda_absy.rom", tc)); diff --git a/test/test_emulation_lda_izpx.s b/test/test_emulation_lda_izpx.s new file mode 100644 index 0000000..f6d6b75 --- /dev/null +++ b/test/test_emulation_lda_izpx.s @@ -0,0 +1,3 @@ +start: lda (0x1F,X) + stp + diff --git a/test/test_emulation_lda_izpy.s b/test/test_emulation_lda_izpy.s new file mode 100644 index 0000000..dda011a --- /dev/null +++ b/test/test_emulation_lda_izpy.s @@ -0,0 +1,3 @@ +start: lda (0x20),Y + stp +