diff --git a/bus.cpp b/bus.cpp index d9c0290..7534d15 100644 --- a/bus.cpp +++ b/bus.cpp @@ -402,8 +402,7 @@ void bus::clearMMR0Bit(const int bit) void bus::setMMR2(const uint16_t value) { - if ((MMR0 & 0xe000) == 0) - MMR2 = value; + MMR2 = value; } void bus::check_odd_addressing(const uint16_t a, const int run_mode, const d_i_space_t space, const bool is_write) @@ -487,15 +486,14 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c DOLOG(debug, true, "A.C.F. triggger for %d on address %06o, run mode %d", access_control, a, run_mode); } - if (access_control == 1 || access_control == 4 || access_control == 5) - MMR0 |= 1 << 12; // set trap-flag - if (is_write) pages[run_mode][d][apf].pdr |= 1 << 7; if ((MMR0 & 0160000) == 0) { - MMR0 &= ~((1 << 15) | (1 << 14) | (1 << 13) | (3 << 5) | (7 << 1)); - MMR0 |= 1 << 13; // read-only + MMR0 &= ~((1 << 15) | (1 << 14) | (1 << 13) | (1 << 12) | (3 << 5) | (7 << 1)); + + if (is_write && access_control != 6) + MMR0 |= 1 << 13; // read-only // if (access_control == 0 || access_control == 4) MMR0 |= 1 << 15; // not resident diff --git a/cpu.cpp b/cpu.cpp index dcc1595..0304901 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -1615,17 +1615,11 @@ void cpu::trap(uint16_t vector, const int new_ipl, const bool is_interrupt) if ((b->getMMR0() & 0160000) == 0) { b->addToMMR1(-2, 6); b->addToMMR1(-2, 6); - b->setMMR2(vector); } - - if (is_interrupt) - b->clearMMR0Bit(12); - else - b->setMMR0Bit(12); // it's a trap } // make sure the trap vector is retrieved from kernel space - psw &= 037777; // mask off 14/15 + psw &= 037777; // mask off 14/15 TODO: still required? readWord gets a d_space parameter setPC(b->readWord(vector + 0, d_space)); @@ -2153,12 +2147,12 @@ void cpu::step_b() { instruction_count++; - uint16_t temp_pc = getPC(); - - if ((b->getMMR0() & 0160000) == 0) - b->setMMR2(temp_pc); - try { + uint16_t temp_pc = getPC(); + + if ((b->getMMR0() & 0160000) == 0) + b->setMMR2(temp_pc); + uint16_t instr = b->readWord(temp_pc); if (temp_pc == 025250)