diff --git a/bus.cpp b/bus.cpp index 5a15bc3..599a2b6 100644 --- a/bus.cpp +++ b/bus.cpp @@ -51,7 +51,7 @@ void bus::init() MMR3 = 0; } -uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev, const bool peek_only) +uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev, const bool peek_only, const d_i_space_t space) { uint16_t temp = 0; @@ -279,7 +279,7 @@ 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; - uint32_t m_offset = calculate_physical_address(run_mode, a, !peek_only, false, peek_only, false); + uint32_t m_offset = calculate_physical_address(run_mode, a, !peek_only, false, peek_only, space == d_space); if (word_mode) temp = m -> readByte(m_offset); @@ -393,7 +393,7 @@ void bus::addToMMR1(const int8_t delta, const uint8_t reg) MMR1 |= reg; } -uint16_t bus::write(const uint16_t a, const bool word_mode, uint16_t value, const bool use_prev) +uint16_t bus::write(const uint16_t a, const bool word_mode, uint16_t value, const bool use_prev, const d_i_space_t space) { if (a >= 0160000) { if (word_mode) { @@ -666,7 +666,7 @@ 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; - uint32_t m_offset = calculate_physical_address(run_mode, a, true, true, false, false); + uint32_t m_offset = calculate_physical_address(run_mode, a, true, true, false, space == d_space); DOLOG(debug, true, "WRITE to %06o/%07o: %o", a, m_offset, value); diff --git a/bus.h b/bus.h index 8dee308..0321134 100644 --- a/bus.h +++ b/bus.h @@ -13,6 +13,8 @@ class cpu; class memory; class tty; +typedef enum { d_space, i_space } d_i_space_t; + typedef struct { uint16_t par, pdr; @@ -63,14 +65,14 @@ public: void set_lf_crs_b7(); uint8_t get_lf_crs(); - uint16_t read(const uint16_t a, const bool word_mode, const bool use_prev, const bool peek_only=false); + uint16_t read(const uint16_t a, const bool word_mode, const bool use_prev, const bool peek_only=false, const d_i_space_t s = i_space); uint16_t readByte(const uint16_t a) { return read(a, true, false); } uint16_t readWord(const uint16_t a); uint16_t peekWord(const uint16_t a); uint16_t readUnibusByte(const uint16_t a); - uint16_t write(const uint16_t a, const bool word_mode, uint16_t value, const bool use_prev); + uint16_t write(const uint16_t a, const bool word_mode, uint16_t value, const bool use_prev, const d_i_space_t s = i_space); uint8_t writeByte(const uint16_t a, const uint8_t value) { return write(a, true, value, false); } uint16_t writeWord(const uint16_t a, const uint16_t value);