diff --git a/bus.cpp b/bus.cpp index b0f64e9..43a81ee 100644 --- a/bus.cpp +++ b/bus.cpp @@ -396,7 +396,7 @@ uint16_t bus::read(const uint16_t a, const word_mode_t word_mode, const bool use int run_mode = (c->getPSW() >> (use_prev ? 12 : 14)) & 3; - uint32_t m_offset = calculate_physical_address(run_mode, a, !peek_only, false, peek_only, space == d_space); + uint32_t m_offset = calculate_physical_address(run_mode, a, !peek_only, false, peek_only, space); if (peek_only == false && m_offset >= n_pages * 8192) { if (!peek_only) DOLOG(debug, true, "Read non existing mapped memory (%o >= %o)", m_offset, n_pages * 8192); @@ -494,14 +494,14 @@ bool bus::get_use_data_space(const int run_mode) return !!(MMR3 & di_ena_mask[run_mode]); } -uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, const bool trap_on_failure, const bool is_write, const bool peek_only, const bool is_data) +uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, const bool trap_on_failure, const bool is_write, const bool peek_only, const d_i_space_t space) { uint32_t m_offset = a; if ((MMR0 & 1) || (is_write && (MMR0 & (1 << 8)))) { const uint8_t apf = a >> 13; // active page field - bool d = is_data & (!!(MMR3 & di_ena_mask[run_mode])) ? is_data : false; + bool d = space == d_space & (!!(MMR3 & di_ena_mask[run_mode])) ? space == d_space : false; uint16_t p_offset = a & 8191; // page offset @@ -946,7 +946,7 @@ void bus::write(const uint16_t a, const word_mode_t word_mode, uint16_t value, c throw 10; } - uint32_t m_offset = calculate_physical_address(run_mode, a, true, true, false, space == d_space); + uint32_t m_offset = calculate_physical_address(run_mode, a, true, true, false, space); if (m_offset >= n_pages * 8192) { DOLOG(debug, false, "Write non existing mapped memory (%06o, value: %06o)", m_offset, value); diff --git a/bus.h b/bus.h index ef41033..b9e0f61 100644 --- a/bus.h +++ b/bus.h @@ -159,7 +159,7 @@ public: void check_odd_addressing(const uint16_t a, const int run_mode, const d_i_space_t space, const bool is_write); void trap_odd(const uint16_t a); - uint32_t calculate_physical_address(const int run_mode, const uint16_t a, const bool trap_on_failure, const bool is_write, const bool peek_only, const bool is_data); + uint32_t calculate_physical_address(const int run_mode, const uint16_t a, const bool trap_on_failure, const bool is_write, const bool peek_only, const d_i_space_t space); bool get_use_data_space(const int run_mode); memory_addresses_t calculate_physical_address(const int run_mode, const uint16_t a); diff --git a/console_ncurses.cpp b/console_ncurses.cpp index 0d37a64..6713284 100644 --- a/console_ncurses.cpp +++ b/console_ncurses.cpp @@ -139,7 +139,7 @@ void console_ncurses::panel_update_thread() int run_mode = current_PSW >> 14; uint16_t current_PC = c->getPC(); - uint32_t full_addr = b->calculate_physical_address(run_mode, current_PC, false, false, true, false); + uint32_t full_addr = b->calculate_physical_address(run_mode, current_PC, false, false, true, i_space); uint16_t current_instr = b->readWord(current_PC);