tests - Add test for JR e instruction

This commit is contained in:
madmaurice 2023-08-29 19:43:38 +02:00
parent 8160037ffc
commit cf54c7ec5f

View file

@ -172,3 +172,25 @@ TEST_CASE("CALL ; RET")
CHECK(cpu.state.PC == 0x0006); CHECK(cpu.state.PC == 0x0006);
CHECK(cpu.state.SP == 0x0010); CHECK(cpu.state.SP == 0x0010);
} }
TEST_CASE("JR e")
{
u8 test_ram[] = {
0x18, 0x02,
0x00, 0x00,
0x18, (u8)(-0x06),
};
RAM r(test_ram, 0x6, true);
Cpu cpu(&r);
CHECK(cpu.state.PC == 0x0);
cpu.step();
CHECK(cpu.state.PC == 0x4);
cpu.step();
CHECK(cpu.state.PC == 0x0);
}