calculate_full_address for leds
This commit is contained in:
parent
cb26305485
commit
5ac576a0ac
4 changed files with 15 additions and 1 deletions
9
bus.cpp
9
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);
|
||||
|
|
2
bus.h
2
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);
|
||||
};
|
||||
|
|
2
cpu.cpp
2
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
|
||||
|
|
3
cpu.h
3
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue