From 5db4e70b6cf3cf8bfe44a9390a6545bb25ee9c21 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Mon, 21 Mar 2022 19:35:55 +0100 Subject: [PATCH] keep track of MMR0-3 --- bus.cpp | 30 +++++++++++++++++++++++++++++- bus.h | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/bus.cpp b/bus.cpp index 57793bd..94e7e6e 100644 --- a/bus.cpp +++ b/bus.cpp @@ -27,7 +27,7 @@ bus::bus() pages[i].pdr = (3 << 1) | (0 << 4) | (0 << 6) | ((8192 / (32 * 2)) << 8); } - CPUERR = MMR2 = MMR3 = PIR = CSR = 0; + CPUERR = MMR0 = MMR1 = MMR2 = MMR3 = PIR = CSR = 0; } bus::~bus() @@ -174,6 +174,16 @@ uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev) } } else { + if (a == 0177572) { // MMR0 + D(fprintf(stderr, "read MMR0\n");) + return MMR0; + } + + if (a == 0177574) { // MMR1 + D(fprintf(stderr, "read MMR1\n");) + return MMR1; + } + if (a == 0177576) { // MMR2 D(fprintf(stderr, "read MMR2\n");) return MMR2; @@ -377,6 +387,24 @@ uint16_t bus::write(const uint16_t a, const bool word_mode, uint16_t value, cons return MMR3; } + if (a == 0177576) { // MMR2 + D(fprintf(stderr, "write set MMR2 to %o\n", value);) + MMR2 = value; + return MMR2; + } + + if (a == 0177574) { // MMR1 + D(fprintf(stderr, "write set MMR1 to %o\n", value);) + MMR1 = value; + return MMR1; + } + + if (a == 0177572) { // MMR0 + D(fprintf(stderr, "write set MMR0 to %o\n", value);) + MMR0 = value; + return MMR0; + } + if (a == 0177772) { // PIR D(fprintf(stderr, "write set PIR to %o\n", value);) PIR = value; // FIXME diff --git a/bus.h b/bus.h index 6e65cb3..8bcf3e6 100644 --- a/bus.h +++ b/bus.h @@ -31,7 +31,7 @@ private: page_t pages[16] { { 0, 0 } }; - uint16_t MMR2 { 0 }, MMR3 { 0 }, CPUERR { 0 }, PIR { 0 }, CSR { 0 }; + uint16_t MMR0 { 0 }, MMR1 { 0 }, MMR2 { 0 }, MMR3 { 0 }, CPUERR { 0 }, PIR { 0 }, CSR { 0 }; uint16_t switch_register { 0 };