bus is now enhanced for d/i space

This commit is contained in:
folkert van heusden 2022-06-12 20:02:05 +02:00
parent ad7aca8876
commit c9fa383bfa
2 changed files with 8 additions and 6 deletions

View file

@ -51,7 +51,7 @@ void bus::init()
MMR3 = 0; 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; 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; 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) if (word_mode)
temp = m -> readByte(m_offset); temp = m -> readByte(m_offset);
@ -393,7 +393,7 @@ void bus::addToMMR1(const int8_t delta, const uint8_t reg)
MMR1 |= 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 (a >= 0160000) {
if (word_mode) { 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; 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); DOLOG(debug, true, "WRITE to %06o/%07o: %o", a, m_offset, value);

6
bus.h
View file

@ -13,6 +13,8 @@ class cpu;
class memory; class memory;
class tty; class tty;
typedef enum { d_space, i_space } d_i_space_t;
typedef struct typedef struct
{ {
uint16_t par, pdr; uint16_t par, pdr;
@ -63,14 +65,14 @@ public:
void set_lf_crs_b7(); void set_lf_crs_b7();
uint8_t get_lf_crs(); 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 readByte(const uint16_t a) { return read(a, true, false); }
uint16_t readWord(const uint16_t a); uint16_t readWord(const uint16_t a);
uint16_t peekWord(const uint16_t a); uint16_t peekWord(const uint16_t a);
uint16_t readUnibusByte(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); } 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); uint16_t writeWord(const uint16_t a, const uint16_t value);