when mmu is disabled; flat mapping
This commit is contained in:
parent
cfaf1e4385
commit
788f86a283
1 changed files with 41 additions and 28 deletions
29
bus.cpp
29
bus.cpp
|
@ -301,18 +301,20 @@ uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev)
|
|||
return -1;
|
||||
}
|
||||
|
||||
uint32_t m_offset = 0;
|
||||
|
||||
if (MMR0 & 1) {
|
||||
const uint8_t apf = a >> 13; // active page field
|
||||
|
||||
if (use_prev)
|
||||
run_mode = (c->getPSW() >> 12) & 3;
|
||||
|
||||
uint32_t m_offset = pages[run_mode][apf].par * 64; // memory offset
|
||||
m_offset = pages[run_mode][apf].par * 64; // memory offset
|
||||
|
||||
uint16_t p_offset = a & 8191; // page offset
|
||||
|
||||
m_offset += p_offset;
|
||||
|
||||
if (MMR0 & 1) {
|
||||
uint16_t pdr_len = (((pages[run_mode][apf].pdr >> 8) & 127) + 1) * 64;
|
||||
|
||||
bool direction = pages[run_mode][apf].pdr & 8;
|
||||
|
@ -334,6 +336,12 @@ uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev)
|
|||
|
||||
throw 1;
|
||||
}
|
||||
|
||||
D(fprintf(stderr, "READ from physical address %07o (run_mode: %d, par: %o)\n", m_offset, run_mode, pages[run_mode][apf].par);)
|
||||
}
|
||||
else {
|
||||
m_offset = a;
|
||||
D(fprintf(stderr, "READ from physical address %07o\n", m_offset);)
|
||||
}
|
||||
|
||||
if (word_mode)
|
||||
|
@ -341,8 +349,6 @@ uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev)
|
|||
else
|
||||
temp = m -> readWord(m_offset);
|
||||
|
||||
// D(fprintf(stderr, "BUS read from %o (pages: %o/%o/%o, run mode %d, apf %d, PDR: %06o, b22: %d): %06o\n", m_offset, pages[run_mode][apf].par, pages[run_mode][apf].par * 64, n_pages * 8192, run_mode, apf, pages[run_mode][apf].pdr, MMR3 & 16, temp);)
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
@ -594,12 +600,15 @@ uint16_t bus::write(const uint16_t a, const bool word_mode, uint16_t value, cons
|
|||
return value;
|
||||
}
|
||||
|
||||
uint32_t m_offset = 0;
|
||||
|
||||
if (MMR0 & 1) {
|
||||
const uint8_t apf = a >> 13; // active page field
|
||||
|
||||
if (use_prev)
|
||||
run_mode = (c->getPSW() >> 12) & 3;
|
||||
|
||||
uint32_t m_offset = pages[run_mode][apf].par * 64;
|
||||
m_offset = pages[run_mode][apf].par * 64;
|
||||
|
||||
pages[run_mode][apf].pdr |= 1 << 6; // page has been written to
|
||||
|
||||
|
@ -607,7 +616,6 @@ uint16_t bus::write(const uint16_t a, const bool word_mode, uint16_t value, cons
|
|||
|
||||
m_offset += p_offset;
|
||||
|
||||
if (MMR0 & 1) {
|
||||
uint16_t pdr_len = (((pages[run_mode][apf].pdr >> 8) & 127) + 1)* 64;
|
||||
|
||||
bool direction = pages[run_mode][apf].pdr & 8;
|
||||
|
@ -629,9 +637,14 @@ uint16_t bus::write(const uint16_t a, const bool word_mode, uint16_t value, cons
|
|||
|
||||
throw 1;
|
||||
}
|
||||
}
|
||||
|
||||
// D(fprintf(stderr, "BUS write to %o (pages: %o/%o/%o, run mode %d, apf %d, PDR: %06o, b22: %d): %06o\n", m_offset, pages[run_mode][apf].par, pages[run_mode][apf].par * 64, n_pages * 8192, run_mode, apf, pages[run_mode][apf].pdr, MMR3 & 16, value);)
|
||||
D(fprintf(stderr, "WRITE to physical address %07o: %o (run mode %d, PAR: %o)\n", m_offset, value, run_mode, pages[run_mode][apf].par);)
|
||||
}
|
||||
else {
|
||||
m_offset = a;
|
||||
|
||||
D(fprintf(stderr, "WRITE to physical address %07o: %o\n", m_offset, value);)
|
||||
}
|
||||
|
||||
if (word_mode)
|
||||
m->writeByte(m_offset, value);
|
||||
|
|
Loading…
Add table
Reference in a new issue