From a80f19de7f3fb962a58c8f356aaa43504857365f Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Fri, 17 May 2024 16:24:25 +0200 Subject: [PATCH] working on configuration menu --- debugger.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/debugger.cpp b/debugger.cpp index f9245f0..d52a141 100644 --- a/debugger.cpp +++ b/debugger.cpp @@ -248,6 +248,23 @@ int wait_for_key(const std::string & title, console *const cnsl, const std::vect return ch; } +void configure_comm(console *const cnsl, std::vector & device_list) +{ + for(;;) { + std::vector keys_allowed { '9' }; + int slot_key { 'A' }; + for(auto & c: device_list) { + cnsl->put_string_lf(format(" %c. %s", slot_key, c ? c->get_identifier().c_str() : "-")); + keys_allowed.push_back(slot_key); + slot_key++; + } + + int ch = wait_for_key("Select communication device to setup or 9. to exit", cnsl, keys_allowed); + if (ch == '9') + break; + } +} + std::optional select_disk_backend(console *const cnsl) { #if defined(BUILD_FOR_RP2040) @@ -290,7 +307,7 @@ void configure_disk(bus *const b, console *const cnsl) std::vector keys_allowed { '1', '2', '9' }; auto cartridge_slots = dd->access_disk_backends(); - int slot_key = 'A'; + int slot_key = 'A'; for(auto & slot: *cartridge_slots) { cnsl->put_string_lf(format(" %c. %s", slot_key, slot ? slot->get_identifier().c_str() : "-")); keys_allowed.push_back(slot_key); @@ -991,6 +1008,11 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto continue; } + else if (cmd == "cdc11") { + configure_comm(cnsl, *b->getDC11()->get_comm_interfaces()); + + continue; + } else if (cmd == "bt") { if (c->get_debug() == false) cnsl->put_string_lf("Debug mode is disabled!"); @@ -1046,6 +1068,7 @@ void debugger(console *const cnsl, bus *const b, std::atomic_uint32_t *const sto "stats - show run statistics", "ramsize x - set ram size (page count (8 kB), decimal)", "bl - set bootloader (rl02 or rk05)", + "cdc11 - configure DC11 device", #if IS_POSIX "ser x - serialize state to a file", // "dser - deserialize state from a file",