Browse Source

Emulator: Add function to retrieve AF/PC/SP register

master
Riyyi 2 years ago
parent
commit
1acb5af23e
  1. 13
      src/cpu.h

13
src/cpu.h

@ -57,6 +57,15 @@ public:
// ------------------------------------- // -------------------------------------
// Miscellaneous Instructions // Miscellaneous Instructions
// -------------------------------------
uint32_t af() const { return (m_cf << 4 | m_hf << 5 | m_nf << 6 | m_zf << 7) | m_a << 8; }
uint32_t bc() const { return m_c | m_b << 8; }
uint32_t de() const { return m_e | m_d << 8; }
uint32_t hl() const { return m_l | m_h << 8; }
uint32_t pc() const { return m_pc; }
uint32_t sp() const { return m_sp; }
private: private:
uint32_t pcRead(); uint32_t pcRead();
uint32_t pcRead16() { return pcRead() | (pcRead() << 8); } uint32_t pcRead16() { return pcRead() | (pcRead() << 8); }
@ -67,10 +76,6 @@ private:
void ffWrite(uint32_t address, uint32_t value); void ffWrite(uint32_t address, uint32_t value);
uint32_t ffRead(uint32_t address); uint32_t ffRead(uint32_t address);
uint32_t bc() const { return m_b << 8 | m_c; }
uint32_t de() const { return m_b << 8 | m_c; }
uint32_t hl() const { return m_b << 8 | m_c; }
// Registers // Registers
uint32_t m_a { 0 }; // Accumulator uint32_t m_a { 0 }; // Accumulator
uint32_t m_b { 0 }; // B uint32_t m_b { 0 }; // B

Loading…
Cancel
Save