diff --git a/bus.cpp b/bus.cpp index e196b5f..5b90ac8 100644 --- a/bus.cpp +++ b/bus.cpp @@ -64,7 +64,8 @@ uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev, if (a == 0177570) { // console switch & display register D(fprintf(stderr, "read console switch\n");) - return 128; // educated guess + + return debug_mode ? 128 : 0; } if (a == 0172540) { // KW11P programmable clock diff --git a/bus.h b/bus.h index 077ded7..6d9a52a 100644 --- a/bus.h +++ b/bus.h @@ -21,27 +21,31 @@ typedef struct class bus { private: - cpu *c { nullptr }; - tm_11 *tm11 { nullptr }; - rk05 *rk05_ { nullptr }; - rx02 *rx02_ { nullptr }; - tty *tty_ { nullptr }; + cpu *c { nullptr }; + tm_11 *tm11 { nullptr }; + rk05 *rk05_ { nullptr }; + rx02 *rx02_ { nullptr }; + tty *tty_ { nullptr }; - memory *m { nullptr }; + memory *m { nullptr }; // 8 pages, D/I, 3 modes and 1 invalid mode - page_t pages[4][2][8]; + page_t pages[4][2][8]; uint16_t MMR0 { 0 }, MMR1 { 0 }, MMR2 { 0 }, MMR3 { 0 }, CPUERR { 0 }, PIR { 0 }, CSR { 0 }; uint16_t switch_register { 0 }; + bool debug_mode { false }; + public: bus(); ~bus(); void clearmem(); + void set_debug_mode(const bool state) { debug_mode = state; } + void add_cpu(cpu *const c) { this -> c = c; } void add_tm11(tm_11 *tm11) { this -> tm11 = tm11; } void add_rk05(rk05 *rk05_) { this -> rk05_ = rk05_; } diff --git a/debugger.cpp b/debugger.cpp index 0d68643..ddefb13 100644 --- a/debugger.cpp +++ b/debugger.cpp @@ -76,6 +76,8 @@ void debugger(console *const cnsl, bus *const b, std::atomic_bool *const interru { cpu *const c = b->getCpu(); + b->set_debug_mode(true); + bool single_step = false; while(!terminate) {