keep track of MMR0-3

This commit is contained in:
folkert van heusden 2022-03-21 19:35:55 +01:00
parent 8b361fad4a
commit 5db4e70b6c
2 changed files with 30 additions and 2 deletions

30
bus.cpp
View file

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

2
bus.h
View file

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