uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 5004ee1339386838c17f8d311f2462f91adebc1f
parent 78f38e80e59fd2ad4cbc2002aab42cbcb344e533
Author: neauoire <aliceffekt@gmail.com>
Date:   Sat,  8 Jan 2022 10:03:21 -0800

The file device cannot write on the supervisor

Diffstat:
Mprojects/software/supervisor.tal | 8++++++--
Msrc/devices/file.c | 8++++----
Msrc/devices/file.h | 3+++
Msrc/uxncli.c | 9+++++----
Msrc/uxnemu.c | 16+++++++++-------
5 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/projects/software/supervisor.tal b/projects/software/supervisor.tal @@ -67,7 +67,7 @@ BRK @on-button ( -> ) - .Controller/func DEI + .Controller/func DEI DUP DEBUG DUP #02 ! ,&no-f2 JCN ;toggle-debugger JSR2 &no-f2 @@ -124,7 +124,8 @@ BRK @toggle-debugger ( -- ) - ( toggle debug ) #fd0e STH2k LDA #00 = STH2r STA + ( toggle debug ) + ( #fd0e STH2k LDA #00 = STH2r STA ) RTN @@ -133,6 +134,9 @@ RTN ( clear devices/stacks ) #fd00 #0300 ;mclr JSR2 + ( load rom ) + + RTN &boot-path "boot.rom $1 diff --git a/src/devices/file.c b/src/devices/file.c @@ -149,7 +149,7 @@ file_deo(Device *d, Uint8 port) case 0x5: DEVPEEK16(a, 0x4); DEVPEEK16(b, 0xa); - res = file_stat(&d->mem[a], b); + res = file_stat(&memory[a], b); DEVPOKE16(0x2, res); break; case 0x6: @@ -158,19 +158,19 @@ file_deo(Device *d, Uint8 port) break; case 0x9: DEVPEEK16(a, 0x8); - res = file_init(&d->mem[a]); + res = file_init(&memory[a]); DEVPOKE16(0x2, res); break; case 0xd: DEVPEEK16(a, 0xc); DEVPEEK16(b, 0xa); - res = file_read(&d->mem[a], b); + res = file_read(&memory[a], b); DEVPOKE16(0x2, res); break; case 0xf: DEVPEEK16(a, 0xe); DEVPEEK16(b, 0xa); - res = file_write(&d->mem[a], b, d->dat[0x7]); + res = file_write(&memory[a], b, d->dat[0x7]); DEVPOKE16(0x2, res); break; } diff --git a/src/devices/file.h b/src/devices/file.h @@ -11,3 +11,5 @@ WITH REGARD TO THIS SOFTWARE. */ void file_deo(Device *d, Uint8 port); + +extern Uint8 *memory; +\ No newline at end of file diff --git a/src/uxncli.c b/src/uxncli.c @@ -4,6 +4,9 @@ #include <time.h> #include "uxn.h" + +Uint8 *supervisor_memory, *memory; + #include "devices/system.h" #include "devices/file.h" #include "devices/datetime.h" @@ -110,17 +113,15 @@ load(Uxn *u, char *filepath) return 1; } -static Uint8 *shadow, *memory; - int main(int argc, char **argv) { Uxn u; int i, loaded = 0; - shadow = (Uint8 *)calloc(0x10000, sizeof(Uint8)); + supervisor_memory = (Uint8 *)calloc(0x10000, sizeof(Uint8)); memory = (Uint8 *)calloc(0x10000, sizeof(Uint8)); - if(!uxn_boot(&u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST))) + if(!uxn_boot(&u, memory, supervisor_memory + PAGE_DEV, (Stack *)(supervisor_memory + PAGE_WST), (Stack *)(supervisor_memory + PAGE_RST))) return error("Boot", "Failed"); /* system */ devsystem = uxn_port(&u, 0x0, system_dei, system_deo); diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -1,8 +1,11 @@ #include <stdio.h> #include <unistd.h> #include <time.h> + #include "uxn.h" +Uint8 *supervisor_memory, *memory; + #pragma GCC diagnostic push #pragma clang diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" @@ -246,17 +249,15 @@ load(Uxn *u, char *rom) return 1; } -static Uint8 *shadow, *memory; - static int start(Uxn *u, char *rom) { memory = (Uint8 *)calloc(0x10000, sizeof(Uint8)); - shadow = (Uint8 *)calloc(0x10000, sizeof(Uint8)); + supervisor_memory = (Uint8 *)calloc(0x10000, sizeof(Uint8)); - if(!uxn_boot(&supervisor, shadow, shadow + VISOR_DEV, (Stack *)(shadow + VISOR_WST), (Stack *)(shadow + VISOR_RST))) + if(!uxn_boot(&supervisor, supervisor_memory, supervisor_memory + VISOR_DEV, (Stack *)(supervisor_memory + VISOR_WST), (Stack *)(supervisor_memory + VISOR_RST))) return error("Boot", "Failed to start uxn."); - if(!uxn_boot(u, memory, shadow + PAGE_DEV, (Stack *)(shadow + PAGE_WST), (Stack *)(shadow + PAGE_RST))) + if(!uxn_boot(u, memory, supervisor_memory + PAGE_DEV, (Stack *)(supervisor_memory + PAGE_WST), (Stack *)(supervisor_memory + PAGE_RST))) return error("Boot", "Failed to start uxn."); if(!load(&supervisor, "supervisor.rom")) error("Supervisor", "No debugger found."); @@ -458,10 +459,11 @@ run(Uxn *u) controller_key(devctrl, get_key(&event)); else if(get_button(&event)) controller_down(devctrl, get_button(&event)); - /* else if(get_fkey(&event)) - controller_special(&supervisor.dev[0x8], get_fkey(&event)); */ else do_shortcut(u, &event); + /* function keys are sent to supervisor */ + if(get_fkey(&event)) + controller_special(&supervisor.dev[0x8], get_fkey(&event)); ksym = event.key.keysym.sym; if(SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_KEYUP, SDL_KEYUP) == 1 && ksym == event.key.keysym.sym) break;