From 6e094ca52070d9da5420811db514315d34297b20 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sat, 29 Jun 2024 11:27:19 -0800 Subject: [PATCH] Removed indirections in file device --- makefile | 4 ++-- src/devices/file.c | 10 +++++----- src/devices/file.h | 2 +- src/devices/system.h | 2 +- src/uxn11.c | 4 ++-- src/uxncli.c | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/makefile b/makefile index 5f0991f..f0e86fb 100644 --- a/makefile +++ b/makefile @@ -31,6 +31,6 @@ clean: bin/uxnasm: src/uxnasm.c @ cc ${RELEASE_flags} ${CFLAGS} src/uxnasm.c -o bin/uxnasm bin/uxncli: ${CLI_src} src/uxncli.c - @ cc ${RELEASE_flags} ${CFLAGS} ${CLI_src} src/uxncli.c -lutil -o bin/uxncli + @ cc ${DEBUG_flags} ${CFLAGS} ${CLI_src} src/uxncli.c -lutil -o bin/uxncli bin/uxn11: ${EMU_src} src/uxn11.c - @ cc ${RELEASE_flags} ${CFLAGS} ${EMU_src} src/uxn11.c -lX11 -lutil -o bin/uxn11 + @ cc ${DEBUG_flags} ${CFLAGS} ${EMU_src} src/uxn11.c -lX11 -lutil -o bin/uxn11 diff --git a/src/devices/file.c b/src/devices/file.c index 1fe3747..933ae73 100644 --- a/src/devices/file.c +++ b/src/devices/file.c @@ -245,7 +245,7 @@ file_delete(UxnFile *c) /* IO */ void -file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port) +file_deo(Uint8 id, Uint8 *d, Uint8 port) { UxnFile *c = &uxn_file[id]; Uint16 addr, len, res; @@ -255,7 +255,7 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port) len = PEEK2(d + 0xa); if(len > 0x10000 - addr) len = 0x10000 - addr; - res = file_stat(c, &ram[addr], len); + res = file_stat(c, &uxn.ram[addr], len); POKE2(d + 0x2, res); break; case 0x6: @@ -264,7 +264,7 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port) break; case 0x9: addr = PEEK2(d + 0x8); - res = file_init(c, (char *)&ram[addr], 0x10000 - addr, 0); + res = file_init(c, (char *)&uxn.ram[addr], 0x10000 - addr, 0); POKE2(d + 0x2, res); break; case 0xd: @@ -272,7 +272,7 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port) len = PEEK2(d + 0xa); if(len > 0x10000 - addr) len = 0x10000 - addr; - res = file_read(c, &ram[addr], len); + res = file_read(c, &uxn.ram[addr], len); POKE2(d + 0x2, res); break; case 0xf: @@ -280,7 +280,7 @@ file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port) len = PEEK2(d + 0xa); if(len > 0x10000 - addr) len = 0x10000 - addr; - res = file_write(c, &ram[addr], len, d[0x7]); + res = file_write(c, &uxn.ram[addr], len, d[0x7]); POKE2(d + 0x2, res); break; } diff --git a/src/devices/file.h b/src/devices/file.h index 5b06409..22ec544 100644 --- a/src/devices/file.h +++ b/src/devices/file.h @@ -14,4 +14,4 @@ WITH REGARD TO THIS SOFTWARE. #define POLYFILEY 2 #define DEV_FILE0 0xa -void file_deo(Uint8 id, Uint8 *ram, Uint8 *d, Uint8 port); +void file_deo(Uint8 id, Uint8 *d, Uint8 port); diff --git a/src/devices/system.h b/src/devices/system.h index 25449bb..da129c3 100644 --- a/src/devices/system.h +++ b/src/devices/system.h @@ -13,7 +13,7 @@ WITH REGARD TO THIS SOFTWARE. #define RAM_PAGES 0x10 void system_reboot(char *rom, int soft); -void system_inspect(); +void system_inspect(void); int system_error(char *msg, const char *err); int system_boot(Uint8 *ram, char *rom); diff --git a/src/uxn11.c b/src/uxn11.c index 476116a..4ca0c35 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -69,8 +69,8 @@ emu_deo(Uint8 addr, Uint8 value) break; case 0x10: console_deo(&uxn.dev[d], p); break; case 0x20: screen_deo(&uxn.dev[d], p); break; - case 0xa0: file_deo(0, uxn.ram, &uxn.dev[d], p); break; - case 0xb0: file_deo(1, uxn.ram, &uxn.dev[d], p); break; + case 0xa0: file_deo(0, &uxn.dev[d], p); break; + case 0xb0: file_deo(1, &uxn.dev[d], p); break; } } diff --git a/src/uxncli.c b/src/uxncli.c index bbeccf3..0465225 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -39,8 +39,8 @@ emu_deo(Uint8 addr, Uint8 value) switch(d) { case 0x00: system_deo(&uxn.dev[d], p); break; case 0x10: console_deo(&uxn.dev[d], p); break; - case 0xa0: file_deo(0, uxn.ram, &uxn.dev[d], p); break; - case 0xb0: file_deo(1, uxn.ram, &uxn.dev[d], p); break; + case 0xa0: file_deo(0, &uxn.dev[d], p); break; + case 0xb0: file_deo(1, &uxn.dev[d], p); break; } }