test_cpu_simple - Add DAA example as a test
This commit is contained in:
parent
3d244d1ec0
commit
66c98f53fb
1 changed files with 32 additions and 0 deletions
|
@ -217,3 +217,35 @@ TEST_CASE("RST op leads to correct call")
|
|||
|
||||
CHECK(cpu.state.PC == expected_pc);
|
||||
}
|
||||
|
||||
TEST_CASE("DAA")
|
||||
{
|
||||
u8 test_ram[] = {
|
||||
0x80, // ADD A,B
|
||||
0x27, // DAA
|
||||
0x90, // SUB A,B
|
||||
0x27, // DAA
|
||||
};
|
||||
|
||||
RAM r(test_ram, 0x4, true);
|
||||
Cpu cpu(&r);
|
||||
|
||||
cpu.state.A = 0x45;
|
||||
cpu.state.B = 0x38;
|
||||
|
||||
cpu.step();
|
||||
|
||||
CHECK(cpu.state.A == 0x7D);
|
||||
|
||||
cpu.step();
|
||||
|
||||
CHECK(cpu.state.A == 0x83);
|
||||
|
||||
cpu.step();
|
||||
|
||||
CHECK(cpu.state.A == 0x4B);
|
||||
|
||||
cpu.step();
|
||||
|
||||
CHECK(cpu.state.A == 0x45);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue