panel mode

This commit is contained in:
folkert van heusden 2024-05-12 02:59:24 +02:00
parent 2c8fc58640
commit 9040d85e7f
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
3 changed files with 40 additions and 15 deletions

View file

@ -24,6 +24,11 @@ console_esp32::~console_esp32()
stop_thread(); 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) int console_esp32::wait_for_char_ll(const short timeout)
{ {
for(short i=0; i<timeout / 10; i++) { for(short i=0; i<timeout / 10; i++) {
@ -112,27 +117,34 @@ void console_esp32::panel_update_thread()
// note that these are approximately as there's no mutex on the emulation // note that these are approximately as there's no mutex on the emulation
uint16_t current_PSW = c->getPSW(); uint16_t current_PSW = c->getPSW();
int run_mode = current_PSW >> 14; 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]; uint32_t led_color = run_mode_led_color[run_mode];
for(uint8_t b=0; b<22; b++) uint16_t current_PC = c->getPC();
pixels.setPixelColor(b, full_addr & (1 << b) ? led_color : 0);
for(uint8_t b=0; b<16; b++) if (pm == PM_BITS) {
pixels.setPixelColor(b + 22, current_PSW & (1l << b) ? magenta : 0); 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++) uint16_t current_instr = b->read_word(current_PC);
pixels.setPixelColor(b + 38, current_instr & (1l << b) ? red : 0);
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); for(uint8_t b=0; b<16; b++)
pixels.setPixelColor(56, disk_write_activity_flag ? blue : 0); 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(); pixels.show();
} }

View file

@ -9,8 +9,12 @@
class console_esp32 : public console class console_esp32 : public console
{ {
public:
enum panel_mode_t { PM_BITS, PM_POINTER };
private: private:
std::vector<Stream *> io_ports; std::vector<Stream *> io_ports;
panel_mode_t panel_mode { PM_BITS }; // TODO: atomic_int
protected: protected:
int wait_for_char_ll(const short timeout) override; 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<Stream *> & io_ports, const int t_width, const int t_height); console_esp32(std::atomic_uint32_t *const stop_event, std::vector<Stream *> & io_ports, const int t_width, const int t_height);
virtual ~console_esp32(); virtual ~console_esp32();
void set_panel_mode(const panel_mode_t pm);
void put_string_lf(const std::string & what) override; void put_string_lf(const std::string & what) override;
void resize_terminal() override; void resize_terminal() override;

View file

@ -37,6 +37,7 @@
#if defined(ESP32) || defined(BUILD_FOR_RP2040) #if defined(ESP32) || defined(BUILD_FOR_RP2040)
#if defined(ESP32) #if defined(ESP32)
#include "esp32.h" #include "esp32.h"
#include "console_esp32.h"
#elif defined(BUILD_FOR_RP2040) #elif defined(BUILD_FOR_RP2040)
#include "rp2040.h" #include "rp2040.h"
#endif #endif
@ -831,6 +832,11 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto
else if (cmd == "startnet") { else if (cmd == "startnet") {
start_network(cnsl); start_network(cnsl);
continue;
}
else if (parts[0] == "pm" && parts.size() == 2) {
reinterpret_cast<console_esp32 *>(cnsl)->set_panel_mode(parts[1] == "bits" ? console_esp32::PM_BITS : console_esp32::PM_POINTER);
continue; continue;
} }
#endif #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)", "cfgnet - configure network (e.g. WiFi)",
"startnet - start network", "startnet - start network",
"chknet - check network status", "chknet - check network status",
"pm x - panel mode (bits or address)",
#endif #endif
"testdc11 - test DC11", "testdc11 - test DC11",
"cfgdisk - configure disk", "cfgdisk - configure disk",