1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-11-27 05:49:24 +00:00

Better testing for ROL/ROR

This commit is contained in:
Peter Evans 2018-03-01 18:31:03 -06:00
parent 0949661b18
commit 0315eb33bf

View File

@ -115,9 +115,16 @@ Test(mos6502_bits, ora)
Test(mos6502_bits, rol)
{
mos6502_handle_rol(cpu, 8);
cr_assert_eq(cpu->A, 17);
cpu->P = 0;
cpu->A = 0xff;
mos6502_handle_rol(cpu, cpu->A);
cr_assert_eq(cpu->P & MOS_CARRY, MOS_CARRY);
cr_assert_eq(cpu->A, 0xfe);
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);
@ -125,9 +132,16 @@ Test(mos6502_bits, rol)
Test(mos6502_bits, ror)
{
mos6502_handle_ror(cpu, 64);
cr_assert_eq(cpu->A, 160);
cpu->P = 0;
cpu->A = 0xff;
mos6502_handle_ror(cpu, cpu->A);
cr_assert_eq(cpu->P & MOS_CARRY, MOS_CARRY);
cr_assert_eq(cpu->A, 0x7f);
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);