From 9176845c6de3676af69507b96882e58c6dfcaa7c Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Fri, 31 Jan 2025 11:36:28 -0800 Subject: [PATCH] Fixed issue with console vector --- src/devices/console.c | 6 ++---- src/devices/console.h | 2 ++ src/uxncli.c | 2 +- src/uxnemu.c | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/devices/console.c b/src/devices/console.c index 10399b3..68a19cb 100644 --- a/src/devices/console.c +++ b/src/devices/console.c @@ -17,14 +17,12 @@ WITH REGARD TO THIS SOFTWARE. /* console registers */ -static int rVECTOR; - int console_input(int c, int type) { if(c == EOF) c = 0, type = 4; uxn.dev[0x12] = c, uxn.dev[0x17] = type; - uxn_eval(rVECTOR); + uxn_eval(console_vector); return type != 4; } @@ -44,7 +42,7 @@ console_deo(Uint8 addr) { FILE *fd; switch(addr) { - case 0x11: rVECTOR = PEEK2(&uxn.dev[0x10]); return; + case 0x11: console_vector = PEEK2(&uxn.dev[0x10]); return; case 0x18: fd = stdout, fputc(uxn.dev[0x18], fd), fflush(fd); break; case 0x19: fd = stderr, fputc(uxn.dev[0x19], fd), fflush(fd); break; } diff --git a/src/devices/console.h b/src/devices/console.h index e462f3d..ba7b64b 100644 --- a/src/devices/console.h +++ b/src/devices/console.h @@ -18,3 +18,5 @@ int console_input(int c, int type); void console_arguments(int i, int argc, char **argv); Uint8 console_dei(Uint8 addr); void console_deo(Uint8 addr); + +extern int console_vector; diff --git a/src/uxncli.c b/src/uxncli.c index 0109274..ecb1f04 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -48,7 +48,7 @@ main(int argc, char **argv) { int i = 1; if(argc == 2 && argv[1][0] == '-' && argv[1][1] == 'v') - return !fprintf(stdout, "Uxn(cli) - Varvara Emulator, 23 Jan 2025.\n"); + return !fprintf(stdout, "Uxn(cli) - Varvara Emulator, 32 Jan 2025.\n"); else if(argc == 1) return !fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]); else if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++], argc > 2)) diff --git a/src/uxnemu.c b/src/uxnemu.c index 4a4a05f..35a69f9 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -45,6 +45,7 @@ WITH REGARD TO THIS SOFTWARE. #define TIMEOUT_MS 334 Uxn uxn; +int console_vector; static SDL_Window *emu_window; static SDL_Texture *emu_texture; @@ -468,7 +469,7 @@ main(int argc, char **argv) /* flags */ if(argc > 1 && argv[i][0] == '-') { if(!strcmp(argv[i], "-v")) - return system_error("Uxn(gui) - Varvara Emulator", "21 Jan 2025."); + return system_error("Uxn(gui) - Varvara Emulator", "31 Jan 2025."); else if(!strcmp(argv[i], "-2x")) set_zoom(2, 0); else if(!strcmp(argv[i], "-3x"))