diff options
author | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-12-01 07:09:28 +1100 |
---|---|---|
committer | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-12-01 07:09:28 +1100 |
commit | 88e6422ec31938fbff7b4fb9c5ddf63fc9f14a09 (patch) | |
tree | ad4838998c6a8990e0ce81d22fbf4d325229fc43 | |
parent | 8ec080d0cd9fd62c0de20780581a4750d078ea94 (diff) |
small changes
-rw-r--r-- | src/cpu/instructions.c | 8 | ||||
-rw-r--r-- | src/video/ncurses.c | 43 |
2 files changed, 27 insertions, 24 deletions
diff --git a/src/cpu/instructions.c b/src/cpu/instructions.c index cf69fc2..cb80855 100644 --- a/src/cpu/instructions.c +++ b/src/cpu/instructions.c @@ -223,7 +223,7 @@ void fBIT(Addressing addr, address val){ // Shift and Rotate Instructions void fASL(Addressing addr, address val){ - SetFlag(flag_C, (idata.value & 0x80)); + SetFlag(flag_C, (idata.value & 0x80)?1:0); acc = (idata.value << 1); SetFlagN(acc); SetFlagZ(acc); @@ -237,9 +237,9 @@ void fLSR(Addressing addr, address val){ } void fROL(Addressing addr, address val){ - SetFlag(flag_C, (val & 0x80)); + SetFlag(flag_C, (val & 0x80)?1:0); acc = (val << 1); - acc |= (getFlag(flag_C) * 0x01); + acc |= (getFlag(flag_C)?1:0); SetFlagN(acc); SetFlagZ(acc); } @@ -247,7 +247,7 @@ void fROL(Addressing addr, address val){ void fROR(Addressing addr, address val){ SetFlag(flag_C, (val & 0x01)); acc = (val >> 1); - acc |= (getFlag(flag_C) * 0x80); + acc |= (getFlag(flag_C)?0x80:0); SetFlagN(acc); SetFlagZ(acc); } 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)); |