show console LEDs

This commit is contained in:
folkert van heusden 2023-03-19 15:05:00 +01:00
parent 28750c56d8
commit b7512ae3cd
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
3 changed files with 13 additions and 6 deletions

View file

@ -858,7 +858,7 @@ void bus::write(const uint16_t a, const bool word_mode, uint16_t value, const bo
}
if (a == ADDR_CONSW) { // switch register
switch_register = value;
console_leds = value;
return;
}

8
bus.h
View file

@ -84,11 +84,10 @@ private:
uint16_t MMR0 { 0 }, MMR1 { 0 }, MMR2 { 0 }, MMR3 { 0 }, CPUERR { 0 }, PIR { 0 }, CSR { 0 };
uint16_t switch_register { 0 };
uint16_t lf_csr { 0 };
uint16_t console_switches { 0 };
uint16_t console_leds { 0 };
uint16_t read_pdr (const uint32_t a, const int run_mode, const bool word_mode, const bool peek_only);
uint16_t read_par (const uint32_t a, const int run_mode, const bool word_mode, const bool peek_only);
@ -102,8 +101,11 @@ public:
void clearmem();
void set_console_switches(const uint16_t new_state) { console_switches = new_state; }
uint16_t get_console_switches() { return console_switches; }
void set_debug_mode() { console_switches |= 128; }
uint16_t get_console_leds() { return console_leds; }
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_; }
@ -146,8 +148,6 @@ public:
void clearMMR0Bit(const int bit);
void setMMR2(const uint16_t value);
uint16_t get_switch_register() const { return switch_register; }
uint32_t calculate_physical_address(const int run_mode, const uint16_t a, const bool trap_on_failure, const bool is_write, const bool peek_only, const bool is_data);
bool get_use_data_space(const int run_mode);

View file

@ -114,7 +114,7 @@ void console_ncurses::resize_terminal()
create_win_border(0, 0, 80, 25, "terminal", &w_main_b, &w_main, false);
create_win_border(0, 27, 100, 4, "panel", &w_panel_b, &w_panel, false);
create_win_border(0, 27, 100, 5, "panel", &w_panel_b, &w_panel, false);
scrollok(w_main -> win, TRUE);
@ -163,6 +163,13 @@ void console_ncurses::panel_update_thread()
for(uint8_t b=0; b<16; b++)
mvwprintw(w_panel->win, 1, 1 + 16 - b + 17, "%c", current_instr & (1 << b) ? '1' : '0');
mvwprintw(w_panel->win, 4, 1, "LEDs:");
uint16_t leds = b->get_console_leds();
for(uint8_t b=0; b<16; b++)
mvwprintw(w_panel->win, 4, 1 + 22 - b, "%c", leds & (1 << b) ? '1' : '0');
wattron(w_panel->win, COLOR_PAIR(5));
mvwprintw(w_panel->win, 1, 1 + 35, "%c%c%c",