summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2021-01-27 13:42:57 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2021-01-27 13:42:57 -0500
commitcd6982e5da1f5facdc1e0154b3a27c01e8b076c9 (patch)
treec8db5ade59d054c6f88ff2ab2cb99df45b250fad /io.c
parent1700d8d10453ffe046438de0e6fbd496def915a1 (diff)
- Fixed some bugs in the emulator.
- Started work on implementing the Super VIA emulation. - Added support for disabling disassembly per instruction, when in debug mode. - Did some more work on rewriting the SuB Suite to work with the new calling convention. - Rewrote the symbol handling code in the emulator's assembler, to make it both simpler, and to add support for arbitrarily deep symbol scopes. - Added support for arbitrarily deep local symbol scopes. For example, to declare a symbol of depth 2, you add two '@' characters to the start of the symbol name. In other words, the number of '@' characters before the symbol name is what determines the scope of that symbol. And to use a symbol thats outside the current scope, you would use the same syntax as using a struct member, so you would do `global.local`.
Diffstat (limited to 'io.c')
-rw-r--r--io.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/io.c b/io.c
index e19f194..9848e8d 100644
--- a/io.c
+++ b/io.c
@@ -48,6 +48,7 @@ int get_key(WINDOW *scr) {
int x, y;
int c;
int keycode = 0;
+ int tmp_flag = dbg_print_per_inst;
curs_set(1);
if ((key == NULL) || (key && key[key_idx] == '\0') || !kbd_rdy) {
c = wgetch(scr);
@@ -89,12 +90,17 @@ int get_key(WINDOW *scr) {
wrefresh(regs);
#endif
break;
+ case KEY_F(3):
+ dbg_print_per_inst = !dbg_print_per_inst;
}
#if debug && !bench
getyx(scr, y, x);
wmove(scr, getmaxy(scr)-1, 0);
wclrtoeol(scr);
wprintw(scr, "keycode: %i", keycode);
+ if (tmp_flag != dbg_print_per_inst) {
+ wprintw(scr, ", Disassemble per instruction %s", (dbg_print_per_inst) ? "enabled" : "disabled");
+ }
wmove(scr, y, x);
#endif
}
@@ -235,10 +241,16 @@ void reset_esc() {
void handle_ctrlcode(int c) {
int x, y;
uint16_t scr_col = 0;
+ int tmp_flag = 0;
#if debug
- if (!subdbg) {
- scr_col = (addr[TX_ADDR] != 0x0C && addr[TX_ADDR] != '\n' && scr_col < 160) ? (addr[1] << 1)-2 : 0;
- wmove(scr, 28, scr_col);
+ if (subdbg) {
+ tmp_flag = (addr[TX_ADDR] != 0x0C && addr[TX_ADDR] != '\n' && scr_col < 160);
+ if (!tmp_flag) {
+ wmove(scr, 30, 0);
+ wclrtoeol(scr);
+ }
+ scr_col = (tmp_flag) ? (addr[1] << 1)-2 : 0;
+ wmove(scr, 30, scr_col);
}
#endif
getyx(scr, y, x);
@@ -261,11 +273,11 @@ void handle_ctrlcode(int c) {
#if !debug
wdelch(scr);
#else
- if (!subdbg) {
+ if (subdbg) {
scr_col++;
- wmove(scr, 28, scr_col--);
+ wmove(scr, 30, scr_col--);
wdelch(scr);
- wmove(scr, 28, scr_col);
+ wmove(scr, 30, scr_col);
wdelch(scr);
}
#endif
@@ -283,7 +295,7 @@ void handle_ctrlcode(int c) {
/*wmove(scr, y, x);*/
waddch(scr, c);
#else
- if (!subdbg && scr_col < 160) {
+ if (subdbg && scr_col < 160) {
if (c != ' ') {
wprintw(scr, "%02X", c);
} else {