From 83ba7e05eabc14a9aaf1084b2498e5ed622fa667 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 2 May 2023 10:31:33 -0700 Subject: [PATCH] Added mock behavior for the friend port --- src/devices/system.c | 7 +++++++ src/uxncli.c | 23 ++++++++++++----------- src/uxnemu.c | 4 ++-- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/devices/system.c b/src/devices/system.c index cda4e07..f85ea56 100644 --- a/src/devices/system.c +++ b/src/devices/system.c @@ -83,6 +83,13 @@ system_deo(Uxn *u, Uint8 *d, Uint8 port) case 0x3: system_cmd(u->ram, PEEK2(d + 2)); break; + case 0x5: + if(PEEK2(d + 4)){ + Uxn friend; + uxn_boot(&friend, u->ram); + uxn_eval(&friend, PEEK2(d + 4)); + } + break; case 0xe: system_inspect(u); break; diff --git a/src/uxncli.c b/src/uxncli.c index 9c40abd..695b399 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -17,7 +17,7 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. */ -Uint16 deo_mask[] = {0x6a08, 0x0300, 0xc028, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x0000, 0x0000, 0xa260, 0xa260, 0x0000, 0x0000, 0x0000, 0x0000}; +Uint16 deo_mask[] = {0xc028, 0x0300, 0xc028, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x0000, 0x0000, 0xa260, 0xa260, 0x0000, 0x0000, 0x0000, 0x0000}; Uint16 dei_mask[] = {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07ff, 0x0000, 0x0000, 0x0000}; Uint8 @@ -53,16 +53,17 @@ main(int argc, char **argv) if(!system_load(&u, argv[i++])) return system_error("Load", "Failed"); u.dev[0x17] = argc - i; - if(!uxn_eval(&u, PAGE_PROGRAM)) - return u.dev[0x0f] & 0x7f; - for(; i < argc; i++) { - char *p = argv[i]; - while(*p) console_input(&u, *p++, CONSOLE_ARG); - console_input(&u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA); - } - while(!u.dev[0x0f]) { - int c = fgetc(stdin); - if(c != EOF) console_input(&u, (Uint8)c, CONSOLE_STD); + if(uxn_eval(&u, PAGE_PROGRAM)) { + for(; i < argc; i++) { + char *p = argv[i]; + while(*p) console_input(&u, *p++, CONSOLE_ARG); + console_input(&u, '\n', i == argc - 1 ? CONSOLE_END : CONSOLE_EOA); + } + while(!u.dev[0x0f]) { + int c = fgetc(stdin); + if(c != EOF) console_input(&u, (Uint8)c, CONSOLE_STD); + } } + free(u.ram); return u.dev[0x0f] & 0x7f; } diff --git a/src/uxnemu.c b/src/uxnemu.c index 35ccf0a..c1f33b7 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -41,7 +41,7 @@ WITH REGARD TO THIS SOFTWARE. #define WIDTH 64 * 8 #define HEIGHT 40 * 8 -#define PAD 4 +#define PAD 2 #define TIMEOUT_MS 334 #define BENCH 0 @@ -52,7 +52,7 @@ static SDL_AudioDeviceID audio_id; static SDL_Rect gRect; static SDL_Thread *stdin_thread; -Uint16 deo_mask[] = {0xff08, 0x0300, 0xc028, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x0000, 0x0000, 0xa260, 0xa260, 0x0000, 0x0000, 0x0000, 0x0000}; +Uint16 deo_mask[] = {0xff28, 0x0300, 0xc028, 0x8000, 0x8000, 0x8000, 0x8000, 0x0000, 0x0000, 0x0000, 0xa260, 0xa260, 0x0000, 0x0000, 0x0000, 0x0000}; Uint16 dei_mask[] = {0x0000, 0x0000, 0x003c, 0x0014, 0x0014, 0x0014, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07ff, 0x0000, 0x0000, 0x0000}; /* devices */