mirror of
https://github.com/pevans/erc-c.git
synced 2025-08-08 05:25:01 +00:00
The stack now only works with 8bit values; disable carry
This commit is contained in:
@@ -19,21 +19,20 @@ Test(mos6502, create)
|
|||||||
cr_assert_eq(cpu->A, 0);
|
cr_assert_eq(cpu->A, 0);
|
||||||
cr_assert_eq(cpu->X, 0);
|
cr_assert_eq(cpu->X, 0);
|
||||||
cr_assert_eq(cpu->Y, 0);
|
cr_assert_eq(cpu->Y, 0);
|
||||||
cr_assert_eq(cpu->P, 0);
|
cr_assert_eq(cpu->P, MOS_STATUS_DEFAULT);
|
||||||
cr_assert_eq(cpu->S, 0);
|
cr_assert_eq(cpu->S, 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
Test(mos6502, push_stack)
|
Test(mos6502, push_stack)
|
||||||
{
|
{
|
||||||
mos6502_push_stack(cpu, 0x1234);
|
mos6502_push_stack(cpu, 0x34);
|
||||||
cr_assert_eq(mos6502_get(cpu, 0x0100), 0x34);
|
cr_assert_eq(mos6502_get(cpu, 0x0100), 0x34);
|
||||||
cr_assert_eq(mos6502_get(cpu, 0x0101), 0x12);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Test(mos6502, pop_stack)
|
Test(mos6502, pop_stack)
|
||||||
{
|
{
|
||||||
mos6502_push_stack(cpu, 0x1234);
|
mos6502_push_stack(cpu, 0x34);
|
||||||
cr_assert_eq(mos6502_pop_stack(cpu), 0x1234);
|
cr_assert_eq(mos6502_pop_stack(cpu), 0x34);
|
||||||
}
|
}
|
||||||
|
|
||||||
Test(mos6502, modify_status)
|
Test(mos6502, modify_status)
|
||||||
@@ -101,6 +100,10 @@ Test(mos6502, execute)
|
|||||||
mos6502_set(cpu, 11, 34);
|
mos6502_set(cpu, 11, 34);
|
||||||
mos6502_set(cpu, 10, 0x69);
|
mos6502_set(cpu, 10, 0x69);
|
||||||
cpu->PC = 10;
|
cpu->PC = 10;
|
||||||
|
|
||||||
|
// Make sure we don't have carry turned on, or else we'll get 35!
|
||||||
|
cpu->P &= ~MOS_CARRY;
|
||||||
|
|
||||||
mos6502_execute(cpu);
|
mos6502_execute(cpu);
|
||||||
cr_assert_eq(cpu->A, 34);
|
cr_assert_eq(cpu->A, 34);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user