diff --git a/rl02.cpp b/rl02.cpp index e623755..e878a29 100644 --- a/rl02.cpp +++ b/rl02.cpp @@ -94,6 +94,14 @@ uint32_t rl02::get_bus_address() const return registers[(RL02_BAR - RL02_BASE) / 2] | (uint32_t((registers[(RL02_CSR - RL02_BASE) / 2] >> 4) & 3) << 16); } +void rl02::update_bus_address(const uint32_t a) +{ + registers[(RL02_BAR - RL02_BASE) / 2] = a; + + registers[(RL02_CSR - RL02_BASE) / 2] &= ~(3 << 4); + registers[(RL02_CSR - RL02_BASE) / 2] |= ((a >> 16) & 3) << 4; +} + uint32_t rl02::calcOffset(const uint16_t da) const { int sector = da & 63; @@ -135,7 +143,6 @@ void rl02::writeWord(const uint16_t addr, uint16_t v) DOLOG(debug, false, "RL02 read %d bytes (dec) from %d (dec) to %06o (oct)", count, disk_offset, memory_address); - uint32_t p = memory_address; while(count > 0) { uint32_t cur = std::min(uint32_t(sizeof xfer_buffer), count); @@ -144,8 +151,11 @@ void rl02::writeWord(const uint16_t addr, uint16_t v) break; } - for(uint32_t i=0; iwriteUnibusByte(p, xfer_buffer[i]); + for(uint32_t i=0; iwriteUnibusByte(memory_address, xfer_buffer[i]); + + update_bus_address(memory_address); + } temp_disk_offset += cur; diff --git a/rl02.h b/rl02.h index 1ca7d4b..06dc553 100644 --- a/rl02.h +++ b/rl02.h @@ -33,6 +33,7 @@ private: std::atomic_bool *const disk_write_acitivity { nullptr }; uint32_t get_bus_address() const; + void update_bus_address(const uint32_t a); uint32_t calcOffset(uint16_t) const; public: