calculate_full_address for leds

This commit is contained in:
folkert van heusden 2022-03-18 14:28:27 +01:00
parent cb26305485
commit 5ac576a0ac
4 changed files with 15 additions and 1 deletions

View file

@ -263,6 +263,15 @@ uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev)
return temp; 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) 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); // fprintf(stderr, "write [%d] %06o to %06o\n", word_mode, value, a);

2
bus.h
View file

@ -56,4 +56,6 @@ public:
uint16_t writeWord(const uint16_t a, const uint16_t value); uint16_t writeWord(const uint16_t a, const uint16_t value);
void setMMR2(const uint16_t value) { MMR2 = value; } void setMMR2(const uint16_t value) { MMR2 = value; }
uint32_t calculate_full_address(const uint16_t a);
}; };

View file

@ -26,7 +26,7 @@ void cpu::reset()
memset(sp, 0x00, sizeof sp); memset(sp, 0x00, sizeof sp);
pc = 0; pc = 0;
psw = fpsr = 0; psw = fpsr = 0;
resetFlag = haltFlag = false; runMode = resetFlag = haltFlag = false;
} }
uint16_t cpu::getRegister(const int nr, const bool prev_mode) const uint16_t cpu::getRegister(const int nr, const bool prev_mode) const

3
cpu.h
View file

@ -16,6 +16,7 @@ private:
uint16_t psw { 0 }, fpsr { 0 }; uint16_t psw { 0 }, fpsr { 0 };
uint16_t stackLimitRegister { 0 }; uint16_t stackLimitRegister { 0 };
bool haltFlag { false }, resetFlag { false }; bool haltFlag { false }, resetFlag { false };
bool runMode { false };
bool emulateMFPT { false }; bool emulateMFPT { false };
@ -60,6 +61,8 @@ public:
void setEmulateMFPT(const bool v) { emulateMFPT = v; } void setEmulateMFPT(const bool v) { emulateMFPT = v; }
bool getRunMode() { return runMode; }
bool getPSW_c() const; bool getPSW_c() const;
bool getPSW_v() const; bool getPSW_v() const;
bool getPSW_z() const; bool getPSW_z() const;