calculate_physical_address: d_i_space_t instead of a bool

This commit is contained in:
folkert van heusden 2023-03-25 10:05:56 +01:00
parent b2f3fdb0e9
commit c708acead1
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
3 changed files with 6 additions and 6 deletions

View file

@ -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);

2
bus.h
View file

@ -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);

View file

@ -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);