From f1a9c246e1a6293e97dcaca5f107c1cfec31112c Mon Sep 17 00:00:00 2001 From: uvok Date: Sun, 11 Jan 2026 15:42:25 +0100 Subject: Add ROM window --- nandgame/cpp/simpc_ui.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'nandgame') diff --git a/nandgame/cpp/simpc_ui.cpp b/nandgame/cpp/simpc_ui.cpp index 2740db8..bdb18fe 100644 --- a/nandgame/cpp/simpc_ui.cpp +++ b/nandgame/cpp/simpc_ui.cpp @@ -12,11 +12,12 @@ { mvprintw(y, x, __VA_ARGS__); } #define PRINT_ME_W(w, y, x, ...) \ { mvwprintw(w, y, x, __VA_ARGS__); } +// refresh(); #define PRINT_NEXT(dly) \ { \ - refresh(); \ wrefresh(status_top); \ wrefresh(clock_regs); \ + wrefresh(ROM); \ if (dly) { \ napms(NCUR_DELAY_MS); \ } \ @@ -27,6 +28,9 @@ static WINDOW *status_top = NULL; static WINDOW *clock_regs = NULL; +static WINDOW *ROM = NULL; +static WINDOW *RAM1 = NULL; +static WINDOW *RAM2 = NULL; #include "Vcomputer.h" #include "Vcomputer___024root.h" @@ -69,7 +73,9 @@ void simpc_ui_write(const std::unique_ptr &topp, uint64_t &i, const int ram1_pos_offset = 35 + 1; const int ram2_pos_offset = ram1_pos_offset + 14 + 1; - PRINT_ME(10, NCUR_X, "%-35s", "--- ROM ---"); + + SIMPLE_BORDER(ROM, '!', '~', 'X'); + PRINT_ME_W(ROM, 0, NCUR_X, "%-35s", "--- ROM ---"); PRINT_ME(10, NCUR_X + ram1_pos_offset, "%-35s", "--- RAM1 ---"); PRINT_ME(10, NCUR_X + ram2_pos_offset, "%-35s", "-- RAM2 --"); for (int i = -MEMORY_CONTEXT; i <= MEMORY_CONTEXT; i++) { @@ -78,16 +84,16 @@ void simpc_ui_write(const std::unique_ptr &topp, uint64_t &i, int32_t current_ROM_address = topp->computer->PC_addr_int + i; int32_t current_RAM_address = topp->computer->reg_A_int + i; if (current_ROM_address < 0) { - PRINT_ME( - ypos_base + i, NCUR_X, "%.35s", + PRINT_ME_W( + ROM, 1 + MEMORY_CONTEXT + i, NCUR_X, "%.35s", "---------------------------------------------------------------"); } else { const uint16_t p = current_ROM_address; const uint16_t program_op_code = topp->computer->ROM->r_datastore[p]; auto disas_code = print_decoded(program_op_code, true); - PRINT_ME(ypos_base + i, NCUR_X, "%04X %s%04X %-30s", - current_ROM_address, prefix, program_op_code, - disas_code.c_str()); + PRINT_ME_W(ROM, 1 + MEMORY_CONTEXT + i, NCUR_X, "%04X %s%04X %-30s", + current_ROM_address, prefix, program_op_code, + disas_code.c_str()); // mvchgat in bold } if (current_RAM_address < 0) { @@ -152,7 +158,10 @@ void simpc_ui_init(void) { clock_regs = newwin(5, 80, 3, 0); SIMPLE_BORDER(clock_regs, '!', '~', 'X'); wrefresh(clock_regs); - wgetch(clock_regs); + ROM = newwin(7, 40, 10, 0); + SIMPLE_BORDER(ROM, '!', '~', 'X'); + wrefresh(ROM); + wgetch(ROM); int rc; @@ -180,6 +189,9 @@ void simpc_ui_cleanup(void) { if (clock_regs) { delwin(clock_regs); } + if (ROM) { + delwin(ROM); + } endwin(); #endif } -- cgit v1.2.3