diff --git a/bus.cpp b/bus.cpp index a565a9c..cbc4e74 100644 --- a/bus.cpp +++ b/bus.cpp @@ -423,6 +423,11 @@ uint16_t bus::write(const uint16_t a, const bool word_mode, uint16_t value, cons return value; } + if (a == 0177570) { // switch register + switch_register = value; + return value; + } + /////////// if (a == 0177374) { // FIXME diff --git a/bus.h b/bus.h index 93ffe0e..4051e78 100644 --- a/bus.h +++ b/bus.h @@ -33,6 +33,8 @@ private: uint16_t MMR2 { 0 }, MMR3 { 0 }, CPUERR { 0 }, PIR { 0 }, CSR { 0 }; + uint16_t switch_register { 0 }; + public: bus(); ~bus(); @@ -59,5 +61,7 @@ public: void setMMR2(const uint16_t value) { MMR2 = value; } + uint16_t get_switch_register() const { return switch_register; } + uint32_t calculate_full_address(const uint16_t a); }; diff --git a/main.cpp b/main.cpp index 0acc542..4f3e568 100644 --- a/main.cpp +++ b/main.cpp @@ -16,10 +16,14 @@ #include "error.h" struct termios org_tty_opts { 0 }; +bool withUI = false; void reset_terminal() { - tcsetattr(STDIN_FILENO, TCSANOW, &org_tty_opts); + if (withUI) + endwin(); + else + tcsetattr(STDIN_FILENO, TCSANOW, &org_tty_opts); } void loadbin(bus *const b, uint16_t base, const char *const file) @@ -225,7 +229,7 @@ int main(int argc, char *argv[]) c -> setEmulateMFPT(true); - bool testMode = false, testCases = false, withUI = false; + bool testMode = false, testCases = false; int opt = -1; while((opt = getopt(argc, argv, "hm:T:R:p:nL:")) != -1) { @@ -333,9 +337,10 @@ int main(int argc, char *argv[]) tty_->sendChar(ch); } - if (icount % 1000000 == 0 && withUI) { + if (icount % 100000 == 0 && withUI) { unsigned long now = get_ms(); mvwprintw(w_main_b -> win, 0, 24, "%.1f/s ", icount * 1000.0 / (now - start)); + mvwprintw(w_main_b -> win, 0, 42, "%06o", b->get_switch_register()); mydoupdate(); } }