console switches: debug-mode in -d

This commit is contained in:
folkert van heusden 2022-04-13 11:18:56 +02:00
parent b8c7d78ed6
commit 4bf488212b
3 changed files with 15 additions and 8 deletions

View file

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

18
bus.h
View file

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

View file

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