1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-11 18:49:16 +00:00

Add ORA tests, for all addressing modes.

This commit is contained in:
Radosław Kujawa 2017-01-24 16:37:55 +01:00
parent 39aaca5034
commit 3a4a0a06d3
10 changed files with 99 additions and 4 deletions

View File

@ -197,6 +197,73 @@ ATF_TC_BODY(emul_nop, tc)
bus_finish(&b);
}
ATF_TC_WITHOUT_HEAD(emul_ora);
ATF_TC_BODY(emul_ora, tc)
{
rk65c02emu_t e;
bus_t b;
b = bus_init();
e = rk65c02_init(&b);
/* ORA immediate */
e.regs.A = 0x55;
ATF_REQUIRE(rom_start(&e, "test_emulation_ora_imm.rom"));
ATF_CHECK(e.regs.A == 0xFF);
/* ORA zero page */
e.regs.A = 0xAA;
bus_write_1(&b, 0x10, 0x55);
ATF_REQUIRE(rom_start(&e, "test_emulation_ora_zp.rom"));
ATF_CHECK(e.regs.A == 0xFF);
/* ORA zero page X */
e.regs.A = 0xAA;
e.regs.X = 0x11;
bus_write_1(&b, 0x21, 0x55);
ATF_REQUIRE(rom_start(&e, "test_emulation_ora_zpx.rom"));
ATF_CHECK(e.regs.A == 0xFF);
/* ORA absolute */
e.regs.A = 0x55;
bus_write_1(&b, 0x2A01, 0xAA);
ATF_REQUIRE(rom_start(&e, "test_emulation_ora_abs.rom"));
ATF_CHECK(e.regs.A == 0xFF);
/* ORA absolute X */
e.regs.A = 0xAA;
e.regs.X = 0x1;
bus_write_1(&b, 0x2A01, 0x55);
ATF_REQUIRE(rom_start(&e, "test_emulation_ora_absx.rom"));
ATF_CHECK(e.regs.A == 0xFF);
/* ORA absolute Y */
e.regs.A = 0x55;
e.regs.X = 0;
e.regs.Y = 0x2;
bus_write_1(&b, 0x2A02, 0xAA);
ATF_REQUIRE(rom_start(&e, "test_emulation_ora_absy.rom"));
ATF_CHECK(e.regs.A == 0xFF);
/* ORA indirect zero */
e.regs.A = 0xAA;
bus_write_1(&b, 0x2A04, 0x55);
bus_write_1(&b, 0x12, 0x04);
bus_write_1(&b, 0x13, 0x2A);
ATF_REQUIRE(rom_start(&e, "test_emulation_ora_izp.rom"));
ATF_CHECK(e.regs.A == 0xFF);
/* ORA indirect zero page X */
e.regs.A = 0xAA;
e.regs.X = 0x2;
e.regs.Y = 0;
ATF_REQUIRE(rom_start(&e, "test_emulation_ora_izpx.rom"));
ATF_CHECK(e.regs.A == 0xFF);
/* ORA indirect zero page Y */
e.regs.A = 0xAA;
e.regs.X = 0;
e.regs.Y = 0x1;
bus_write_1(&b, 0x2A04, 0x54);
bus_write_1(&b, 0x14, 0x04);
bus_write_1(&b, 0x15, 0x2A);
ATF_REQUIRE(rom_start(&e, "test_emulation_ora_izpy.rom"));
ATF_CHECK(e.regs.A == 0xFF);
bus_finish(&b);
}
ATF_TC_WITHOUT_HEAD(emul_txa_tya_tax_tay);
ATF_TC_BODY(emul_txa_tya_tax_tay, tc)
{
@ -211,17 +278,17 @@ ATF_TC_BODY(emul_txa_tya_tax_tay, tc)
e.regs.Y = 0x55;
ATF_REQUIRE(rom_start(&e, "test_emulation_txa.rom"));
ATF_CHECK(e.regs.A = 0xAA);
ATF_CHECK(e.regs.A == 0xAA);
ATF_REQUIRE(rom_start(&e, "test_emulation_tya.rom"));
ATF_CHECK(e.regs.A = 0x55);
ATF_CHECK(e.regs.A == 0x55);
ATF_REQUIRE(rom_start(&e, "test_emulation_tax.rom"));
ATF_CHECK(e.regs.X = 0x55);
ATF_CHECK(e.regs.X == 0x55);
e.regs.A = 0xFF;
ATF_REQUIRE(rom_start(&e, "test_emulation_tay.rom"));
ATF_CHECK(e.regs.A = 0xFF);
ATF_CHECK(e.regs.A == 0xFF);
bus_finish(&b);
}
@ -307,6 +374,7 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, emul_inx_iny);
ATF_TP_ADD_TC(tp, emul_lda);
ATF_TP_ADD_TC(tp, emul_nop);
ATF_TP_ADD_TC(tp, emul_ora);
ATF_TP_ADD_TC(tp, emul_stz);
ATF_TP_ADD_TC(tp, emul_php_plp);
ATF_TP_ADD_TC(tp, emul_stack);

View File

@ -0,0 +1,3 @@
start: ora 0x2A01
stp

View File

@ -0,0 +1,3 @@
start: ora 0x2A00,X
stp

View File

@ -0,0 +1,3 @@
start: ora 0x2A00,Y
stp

View File

@ -0,0 +1,3 @@
start: ora #0xAA
stp

View File

@ -0,0 +1,3 @@
start: ora (0x12)
stp

View File

@ -0,0 +1,3 @@
start: ora (0x10,X)
stp

View File

@ -0,0 +1,3 @@
start: ora (0x14),Y
stp

View File

@ -0,0 +1,3 @@
start: ora 0x10
stp

View File

@ -0,0 +1,3 @@
start: ora 0x10,X
stp