mirror of
https://github.com/rkujawa/rk65c02.git
synced 2024-12-22 15:31:12 +00:00
Add STA test cases for all addressing modes.
This commit is contained in:
parent
47028b0e26
commit
a570afb007
@ -197,6 +197,61 @@ ATF_TC_BODY(emul_nop, tc)
|
||||
bus_finish(&b);
|
||||
}
|
||||
|
||||
ATF_TC_WITHOUT_HEAD(emul_sta);
|
||||
ATF_TC_BODY(emul_sta, tc)
|
||||
{
|
||||
rk65c02emu_t e;
|
||||
bus_t b;
|
||||
|
||||
b = bus_init();
|
||||
e = rk65c02_init(&b);
|
||||
|
||||
/* STA zero page */
|
||||
e.regs.A = 0xAA;
|
||||
ATF_REQUIRE(rom_start(&e, "test_emulation_sta_zp.rom"));
|
||||
ATF_CHECK(bus_read_1(&b, 0x20) == 0xAA);
|
||||
/* STA zero page X */
|
||||
e.regs.A = 0x55;
|
||||
e.regs.X = 0x1;
|
||||
ATF_REQUIRE(rom_start(&e, "test_emulation_sta_zpx.rom"));
|
||||
ATF_CHECK(bus_read_1(&b, 0x20) == 0x55);
|
||||
/* STA absolute */
|
||||
e.regs.A = 0xAA;
|
||||
ATF_REQUIRE(rom_start(&e, "test_emulation_sta_abs.rom"));
|
||||
ATF_CHECK(bus_read_1(&b, 0x2010) == 0xAA);
|
||||
/* STA absolute X */
|
||||
e.regs.A = 0x55;
|
||||
e.regs.X = 0x10;
|
||||
ATF_REQUIRE(rom_start(&e, "test_emulation_sta_absx.rom"));
|
||||
ATF_CHECK(bus_read_1(&b, 0x2010) == 0x55);
|
||||
/* STA absolute Y */
|
||||
e.regs.A = 0xAA;
|
||||
e.regs.X = 0;
|
||||
e.regs.Y = 0x1;
|
||||
ATF_REQUIRE(rom_start(&e, "test_emulation_sta_absy.rom"));
|
||||
ATF_CHECK(bus_read_1(&b, 0x2010) == 0xAA);
|
||||
/* STA indirect zero */
|
||||
e.regs.A = 0x55;
|
||||
bus_write_1(&b, 0x25, 0x10);
|
||||
bus_write_1(&b, 0x26, 0x20);
|
||||
ATF_REQUIRE(rom_start(&e, "test_emulation_sta_izp.rom"));
|
||||
ATF_CHECK(bus_read_1(&b, 0x2010) == 0x55);
|
||||
/* STA indirect zero page X */
|
||||
e.regs.A = 0xAA;
|
||||
e.regs.X = 0x4;
|
||||
e.regs.Y = 0;
|
||||
ATF_REQUIRE(rom_start(&e, "test_emulation_sta_izpx.rom"));
|
||||
ATF_CHECK(bus_read_1(&b, 0x2010) == 0xAA);
|
||||
/* STA indirect zero page Y */
|
||||
e.regs.A = 0x54;
|
||||
e.regs.X = 0;
|
||||
e.regs.Y = 0x1;
|
||||
ATF_REQUIRE(rom_start(&e, "test_emulation_sta_izpy.rom"));
|
||||
ATF_CHECK(bus_read_1(&b, 0x2010) == 0x55);
|
||||
|
||||
bus_finish(&b);
|
||||
}
|
||||
|
||||
ATF_TC_WITHOUT_HEAD(emul_ora);
|
||||
ATF_TC_BODY(emul_ora, tc)
|
||||
{
|
||||
@ -379,6 +434,7 @@ ATF_TP_ADD_TCS(tp)
|
||||
ATF_TP_ADD_TC(tp, emul_php_plp);
|
||||
ATF_TP_ADD_TC(tp, emul_stack);
|
||||
ATF_TP_ADD_TC(tp, emul_txa_tya_tax_tay);
|
||||
ATF_TP_ADD_TC(tp, emul_sta);
|
||||
|
||||
return (atf_no_error());
|
||||
}
|
||||
|
3
test/test_emulation_sta_abs.s
Normal file
3
test/test_emulation_sta_abs.s
Normal file
@ -0,0 +1,3 @@
|
||||
start: sta 0x2010
|
||||
stp
|
||||
|
3
test/test_emulation_sta_absx.s
Normal file
3
test/test_emulation_sta_absx.s
Normal file
@ -0,0 +1,3 @@
|
||||
start: sta 0x2000,X
|
||||
stp
|
||||
|
3
test/test_emulation_sta_absy.s
Normal file
3
test/test_emulation_sta_absy.s
Normal file
@ -0,0 +1,3 @@
|
||||
start: sta 0x200F,Y
|
||||
stp
|
||||
|
3
test/test_emulation_sta_izp.s
Normal file
3
test/test_emulation_sta_izp.s
Normal file
@ -0,0 +1,3 @@
|
||||
start: sta (0x25)
|
||||
stp
|
||||
|
3
test/test_emulation_sta_izpx.s
Normal file
3
test/test_emulation_sta_izpx.s
Normal file
@ -0,0 +1,3 @@
|
||||
start: sta (0x21,X)
|
||||
stp
|
||||
|
3
test/test_emulation_sta_izpy.s
Normal file
3
test/test_emulation_sta_izpy.s
Normal file
@ -0,0 +1,3 @@
|
||||
start: sta (0x25),Y
|
||||
stp
|
||||
|
3
test/test_emulation_sta_zp.s
Normal file
3
test/test_emulation_sta_zp.s
Normal file
@ -0,0 +1,3 @@
|
||||
start: sta 0x20
|
||||
stp
|
||||
|
3
test/test_emulation_sta_zpx.s
Normal file
3
test/test_emulation_sta_zpx.s
Normal file
@ -0,0 +1,3 @@
|
||||
start: sta 0x1F,X
|
||||
stp
|
||||
|
Loading…
Reference in New Issue
Block a user