31 lines
434 B
C++
31 lines
434 B
C++
#include "doctest.h"
|
|
|
|
#include "cpu/cpu.h"
|
|
|
|
TEST_CASE("16-bit registers map to two 8-bit registers")
|
|
{
|
|
Cpu_state c;
|
|
|
|
c.BC = 0xAA55;
|
|
CHECK(c.B == 0xAA);
|
|
CHECK(c.C == 0x55);
|
|
|
|
c.DE = 0x1122;
|
|
CHECK(c.D == 0x11);
|
|
CHECK(c.E == 0x22);
|
|
|
|
c.HL = 0x3344;
|
|
CHECK(c.H == 0x33);
|
|
CHECK(c.L == 0x44);
|
|
}
|
|
|
|
TEST_CASE("SI works correctly")
|
|
{
|
|
Cpu_state c;
|
|
|
|
|
|
c.IE = 0b10000111;
|
|
c.IF = 0b10011100;
|
|
|
|
CHECK(c.SI() == 0b00000100);
|
|
}
|