update MMR0 for page length traps

This commit is contained in:
folkert van heusden 2022-06-15 12:55:37 +02:00
parent 0b18a5e4cc
commit 6b379c0a99

17
bus.cpp
View file

@ -283,8 +283,8 @@ uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev,
int run_mode = (c->getPSW() >> (use_prev ? 12 : 14)) & 3; int run_mode = (c->getPSW() >> (use_prev ? 12 : 14)) & 3;
if (run_mode == 1 && c->get_34()) // if (run_mode == 1 && c->get_34())
run_mode = 3; // run_mode = 3;
uint32_t m_offset = calculate_physical_address(run_mode, a, !peek_only, false, peek_only); uint32_t m_offset = calculate_physical_address(run_mode, a, !peek_only, false, peek_only);
@ -354,11 +354,15 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
if (m_offset >= n_pages * 8192) { if (m_offset >= n_pages * 8192) {
DOLOG(debug, !peek_only, "bus::calculate_physical_address %o >= %o", m_offset, n_pages * 8192); DOLOG(debug, !peek_only, "bus::calculate_physical_address %o >= %o", m_offset, n_pages * 8192);
c->schedule_trap(04); // invalid address
MMR0 |= 1 << 15; // non-resident MMR0 |= 1 << 15; // non-resident
MMR0 &= ~14; // add current page
MMR0 |= apf << 1;
pages[run_mode][0][apf].pdr |= 1 << 7; // TODO: D/I pages[run_mode][0][apf].pdr |= 1 << 7; // TODO: D/I
//
c->schedule_trap(04); // invalid address
throw 1; throw 1;
} }
@ -369,6 +373,9 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
MMR0 |= 1 << 14; // length MMR0 |= 1 << 14; // length
MMR0 &= ~14; // add current page
MMR0 |= apf << 1;
pages[run_mode][0][apf].pdr |= 1 << 7; // TODO: D/I pages[run_mode][0][apf].pdr |= 1 << 7; // TODO: D/I
throw 1; throw 1;
@ -401,8 +408,8 @@ uint16_t bus::write(const uint16_t a, const bool word_mode, uint16_t value, cons
{ {
int run_mode = (c->getPSW() >> (use_prev ? 12 : 14)) & 3; int run_mode = (c->getPSW() >> (use_prev ? 12 : 14)) & 3;
if (run_mode == 1 && c->get_34()) // if (run_mode == 1 && c->get_34())
run_mode = 3; // run_mode = 3;
if ((MMR0 & 1) == 1 && (a & 1) == 0) { if ((MMR0 & 1) == 1 && (a & 1) == 0) {
const uint8_t apf = a >> 13; // active page field const uint8_t apf = a >> 13; // active page field