From 88e6422ec31938fbff7b4fb9c5ddf63fc9f14a09 Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Fri, 1 Dec 2023 07:09:28 +1100 Subject: small changes --- src/video/ncurses.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'src/video') diff --git a/src/video/ncurses.c b/src/video/ncurses.c index 0e261bb..a3ae8a4 100644 --- a/src/video/ncurses.c +++ b/src/video/ncurses.c @@ -20,20 +20,28 @@ byte UserInput() int c = getch(); byte r; - switch(c) - { + if (c == 0x08) // If c is backspace + return 0xDF; + + if (c < 0x20) { + if (c != 0x0D // CR + && c != 0x1B) // Exit + return -1; + } + //switch(c) + //{ // Convert special characters - case KEY_F(1): //backspace + /*case KEY_F(1): //backspace r = 0xDF; break; case KEY_F(2): //enter r = 0x8D; break; - case KEY_F(3): //exit. TODO: Figure out if this is Esc or not. + case KEY_F(3): //exit, for escape. TODO: Figure out if this is Esc or not. r = 0x9B; - break; + break;*/ // Convert regular characters - default: + /*default: if (c < 0x20 || c >= 0x60) return -1; @@ -43,15 +51,9 @@ byte UserInput() r = c; break; - } - - //SetMemory(KBD, r); - - - //TerminalInput(r); - + }*/ - return r; + return c; } @@ -59,11 +61,12 @@ byte UserInput() void PrintInfo() { - mvprintw(2, 43, " acc : %x", acc); - mvprintw(3, 43, " X : %x", X ); - mvprintw(4, 43, " Y : %x", Y ); - mvprintw(5, 43, " PC : %x", PC); - mvprintw(6, 43, "Flags : %c%c_%c%c%c%c%c", + mvprintw(2, 43, " acc : %02x", acc); + mvprintw(3, 43, " X : %02x", X ); + mvprintw(4, 43, " Y : %02x", Y ); + mvprintw(5, 43, " PC : %04x", PC); + mvprintw(6, 43, " S : %02x", S ); + mvprintw(7, 43, "Flags : %c%c_%c%c%c%c%c", getFlag(flag_N) ? 'N':'.' , getFlag(flag_V) ? 'V':'.' , getFlag(flag_B) ? 'B':'.' , @@ -74,7 +77,7 @@ void PrintInfo() ); mvprintw(2, 65, "Stack"); int count = 3; - for (int i = 0x1ff; i > 0x1cf; i--) { + for (int i = 0x1ff; i > 0x1e8; i--) { if (i == (0x1ff-S)) // Indicate the stack pointer! attron(A_REVERSE); mvprintw(count, 65, "%x : %x", i, GetMemory(i)); -- cgit v1.2.3