diff --git a/bus.cpp b/bus.cpp index a38aa08..b84b0b0 100644 --- a/bus.cpp +++ b/bus.cpp @@ -263,6 +263,15 @@ uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev) return temp; } +uint32_t bus::calculate_full_address(const uint16_t a) +{ + const uint8_t apf = a >> 13; // active page field + bool is_user = c -> getBitPSW(14) && c -> getBitPSW(15); + uint32_t m_offset = pages[apf + is_user * 8].par * 64; + + return m_offset + (a & 8191); +} + uint16_t bus::write(const uint16_t a, const bool word_mode, uint16_t value, const bool use_prev) { // fprintf(stderr, "write [%d] %06o to %06o\n", word_mode, value, a); diff --git a/bus.h b/bus.h index c6954f0..0b352d6 100644 --- a/bus.h +++ b/bus.h @@ -56,4 +56,6 @@ public: uint16_t writeWord(const uint16_t a, const uint16_t value); void setMMR2(const uint16_t value) { MMR2 = value; } + + uint32_t calculate_full_address(const uint16_t a); }; diff --git a/cpu.cpp b/cpu.cpp index b3389d7..f097165 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -26,7 +26,7 @@ void cpu::reset() memset(sp, 0x00, sizeof sp); pc = 0; psw = fpsr = 0; - resetFlag = haltFlag = false; + runMode = resetFlag = haltFlag = false; } uint16_t cpu::getRegister(const int nr, const bool prev_mode) const diff --git a/cpu.h b/cpu.h index 7397add..4344a6f 100644 --- a/cpu.h +++ b/cpu.h @@ -16,6 +16,7 @@ private: uint16_t psw { 0 }, fpsr { 0 }; uint16_t stackLimitRegister { 0 }; bool haltFlag { false }, resetFlag { false }; + bool runMode { false }; bool emulateMFPT { false }; @@ -60,6 +61,8 @@ public: void setEmulateMFPT(const bool v) { emulateMFPT = v; } + bool getRunMode() { return runMode; } + bool getPSW_c() const; bool getPSW_v() const; bool getPSW_z() const;