|
|
@ -13,25 +13,23 @@ |
|
|
|
|
|
|
|
|
|
|
|
CPU::CPU(uint32_t frequency) |
|
|
|
CPU::CPU(uint32_t frequency) |
|
|
|
: ProcessingUnit(frequency) |
|
|
|
: ProcessingUnit(frequency) |
|
|
|
{ |
|
|
|
|
|
|
|
// CGB registers
|
|
|
|
|
|
|
|
// https://gbdev.io/pandocs/Power_Up_Sequence.html#cpu-registers
|
|
|
|
// https://gbdev.io/pandocs/Power_Up_Sequence.html#cpu-registers
|
|
|
|
m_a = 0x11; |
|
|
|
// CGB registers
|
|
|
|
m_b = 0x0; |
|
|
|
, m_a(0x11) |
|
|
|
m_c = 0x0; |
|
|
|
, m_b(0x0) |
|
|
|
m_d = 0xff; |
|
|
|
, m_c(0x0) |
|
|
|
m_e = 0x56; |
|
|
|
, m_d(0xff) |
|
|
|
m_h = 0x0; |
|
|
|
, m_e(0x56) |
|
|
|
m_l = 0x0d; |
|
|
|
, m_h(0x0) |
|
|
|
m_pc = 0x100; |
|
|
|
, m_l(0x0d) |
|
|
|
m_sp = 0xffe; |
|
|
|
, m_pc(0x100) |
|
|
|
|
|
|
|
, m_sp(0xffe) |
|
|
|
// Flags
|
|
|
|
// Flags
|
|
|
|
m_zf = 0x1; |
|
|
|
, m_zf(0x1) |
|
|
|
m_nf = 0x0; |
|
|
|
, m_nf(0x0) |
|
|
|
m_hf = 0x0; |
|
|
|
, m_hf(0x0) |
|
|
|
m_cf = 0x0; |
|
|
|
, m_cf(0x0) |
|
|
|
|
|
|
|
{ |
|
|
|
m_shared_registers.emplace("a", &m_a); |
|
|
|
m_shared_registers.emplace("a", &m_a); |
|
|
|
m_shared_registers.emplace("b", &m_b); |
|
|
|
m_shared_registers.emplace("b", &m_b); |
|
|
|
m_shared_registers.emplace("c", &m_c); |
|
|
|
m_shared_registers.emplace("c", &m_c); |
|
|
|