diff --git a/ESP32/console_esp32.cpp b/ESP32/console_esp32.cpp index 2adb8c2..dfef91c 100644 --- a/ESP32/console_esp32.cpp +++ b/ESP32/console_esp32.cpp @@ -24,6 +24,11 @@ console_esp32::~console_esp32() stop_thread(); } +void console_esp32::set_panel_mode(const panel_mode_t pm) +{ + panel_mode = pm; +} + int console_esp32::wait_for_char_ll(const short timeout) { for(short i=0; igetPSW(); int run_mode = current_PSW >> 14; - - uint16_t current_PC = c->getPC(); - uint32_t full_addr = b->getMMU()->calculate_physical_address(c, run_mode, current_PC, false, false, i_space); - - uint16_t current_instr = b->read_word(current_PC); - uint32_t led_color = run_mode_led_color[run_mode]; - for(uint8_t b=0; b<22; b++) - pixels.setPixelColor(b, full_addr & (1 << b) ? led_color : 0); + uint16_t current_PC = c->getPC(); - for(uint8_t b=0; b<16; b++) - pixels.setPixelColor(b + 22, current_PSW & (1l << b) ? magenta : 0); + if (pm == PM_BITS) { + uint32_t full_addr = b->getMMU()->calculate_physical_address(c, run_mode, current_PC, false, false, i_space); - for(uint8_t b=0; b<16; b++) - pixels.setPixelColor(b + 38, current_instr & (1l << b) ? red : 0); + uint16_t current_instr = b->read_word(current_PC); - pixels.setPixelColor(54, running_flag ? white : 0); + for(uint8_t b=0; b<22; b++) + pixels.setPixelColor(b, full_addr & (1 << b) ? led_color : 0); - pixels.setPixelColor(55, disk_read_activity_flag ? blue : 0); - pixels.setPixelColor(56, disk_write_activity_flag ? blue : 0); + for(uint8_t b=0; b<16; b++) + pixels.setPixelColor(b + 22, current_PSW & (1l << b) ? magenta : 0); + + for(uint8_t b=0; b<16; b++) + pixels.setPixelColor(b + 38, current_instr & (1l << b) ? red : 0); + + pixels.setPixelColor(54, running_flag ? white : 0); + + pixels.setPixelColor(55, disk_read_activity_flag ? blue : 0); + pixels.setPixelColor(56, disk_write_activity_flag ? blue : 0); + } + else { + pixels.clear(); + + pixels.setPixelColor(current_PC * n_pixels / 65536, led_color); + } pixels.show(); } diff --git a/ESP32/console_esp32.h b/ESP32/console_esp32.h index b83aded..cfc730d 100644 --- a/ESP32/console_esp32.h +++ b/ESP32/console_esp32.h @@ -9,8 +9,12 @@ class console_esp32 : public console { +public: + enum panel_mode_t { PM_BITS, PM_POINTER }; + private: std::vector io_ports; + panel_mode_t panel_mode { PM_BITS }; // TODO: atomic_int protected: int wait_for_char_ll(const short timeout) override; @@ -21,6 +25,8 @@ public: console_esp32(std::atomic_uint32_t *const stop_event, std::vector & io_ports, const int t_width, const int t_height); virtual ~console_esp32(); + void set_panel_mode(const panel_mode_t pm); + void put_string_lf(const std::string & what) override; void resize_terminal() override; diff --git a/debugger.cpp b/debugger.cpp index 8381f69..a03ea9d 100644 --- a/debugger.cpp +++ b/debugger.cpp @@ -37,6 +37,7 @@ #if defined(ESP32) || defined(BUILD_FOR_RP2040) #if defined(ESP32) #include "esp32.h" +#include "console_esp32.h" #elif defined(BUILD_FOR_RP2040) #include "rp2040.h" #endif @@ -831,6 +832,11 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto else if (cmd == "startnet") { start_network(cnsl); + continue; + } + else if (parts[0] == "pm" && parts.size() == 2) { + reinterpret_cast(cnsl)->set_panel_mode(parts[1] == "bits" ? console_esp32::PM_BITS : console_esp32::PM_POINTER); + continue; } #endif @@ -1044,6 +1050,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto "cfgnet - configure network (e.g. WiFi)", "startnet - start network", "chknet - check network status", + "pm x - panel mode (bits or address)", #endif "testdc11 - test DC11", "cfgdisk - configure disk",