1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-21 08:30:55 +00:00

Accounting for the ACC mode opcode

This commit is contained in:
Peter Evans 2018-04-14 18:26:43 -05:00
parent 72883240c3
commit 56e9d97791

View File

@ -19,6 +19,11 @@ Test(mos6502_bits, and)
Test(mos6502_bits, asl)
{
cpu->eff_addr = 123;
mos6502_handle_asl(cpu, 22);
cr_assert_eq(mos6502_get(cpu, 123), 44);
mos6502_set(cpu, cpu->PC, 0x0A);
mos6502_handle_asl(cpu, 5);
cr_assert_eq(cpu->A, 10);
@ -27,10 +32,6 @@ Test(mos6502_bits, asl)
mos6502_handle_asl(cpu, 150);
cr_assert_eq(cpu->A, 44);
cr_assert_eq(cpu->P & MOS_CARRY, MOS_CARRY);
cpu->eff_addr = 123;
mos6502_handle_asl(cpu, 22);
cr_assert_eq(mos6502_get(cpu, 123), 44);
}
Test(mos6502_bits, bit)
@ -92,14 +93,15 @@ Test(mos6502_bits, eor)
Test(mos6502_bits, lsr)
{
mos6502_handle_lsr(cpu, 5);
cr_assert_eq(cpu->A, 2);
cr_assert_eq(cpu->P & MOS_CARRY, MOS_CARRY);
cpu->eff_addr = 123;
mos6502_handle_lsr(cpu, 11);
cr_assert_eq(mos6502_get(cpu, 123), 5);
cr_assert_eq(cpu->P & MOS_CARRY, MOS_CARRY);
mos6502_set(cpu, cpu->PC, 0x4A);
mos6502_handle_lsr(cpu, 5);
cr_assert_eq(cpu->A, 2);
cr_assert_eq(cpu->P & MOS_CARRY, MOS_CARRY);
}
Test(mos6502_bits, ora)
@ -115,6 +117,12 @@ Test(mos6502_bits, ora)
Test(mos6502_bits, rol)
{
cpu->P = 0;
cpu->eff_addr = 234;
mos6502_handle_rol(cpu, 128);
cr_assert_eq(mos6502_get(cpu, 234), 0);
mos6502_set(cpu, cpu->PC, 0x2A);
cpu->P = 0;
cpu->A = 0xff;
mos6502_handle_rol(cpu, cpu->A);
@ -123,15 +131,17 @@ Test(mos6502_bits, rol)
mos6502_handle_rol(cpu, cpu->A);
cr_assert_eq(cpu->P & MOS_CARRY, MOS_CARRY);
cr_assert_eq(cpu->A, 0xfd);
cpu->P = 0;
cpu->eff_addr = 234;
mos6502_handle_rol(cpu, 128);
cr_assert_eq(mos6502_get(cpu, 234), 0);
}
Test(mos6502_bits, ror)
{
cpu->P = 0;
cpu->eff_addr = 123;
mos6502_handle_ror(cpu, 1);
mos6502_handle_ror(cpu, 0);
cr_assert_eq(mos6502_get(cpu, 123), 128);
mos6502_set(cpu, cpu->PC, 0x6A);
cpu->P = 0;
cpu->A = 0xff;
mos6502_handle_ror(cpu, cpu->A);
@ -140,12 +150,6 @@ Test(mos6502_bits, ror)
mos6502_handle_ror(cpu, cpu->A);
cr_assert_eq(cpu->P & MOS_CARRY, MOS_CARRY);
cr_assert_eq(cpu->A, 0xbf);
cpu->P = 0;
cpu->eff_addr = 123;
mos6502_handle_ror(cpu, 1);
mos6502_handle_ror(cpu, 0);
cr_assert_eq(mos6502_get(cpu, 123), 128);
}
Test(mos6502_bits, trb)