Removed indirections in file device

This commit is contained in:
Devine Lu Linvega 2024-06-29 11:27:19 -08:00
parent f4f05d0419
commit 6e094ca520
6 changed files with 13 additions and 13 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;
}
}