diff --git a/src/devices/system.c b/src/devices/system.c index 5a44c5e..4a61f0a 100644 --- a/src/devices/system.c +++ b/src/devices/system.c @@ -94,6 +94,13 @@ system_version(char *name, char *date) return 0; } +int +system_boot(Uxn *u, Uint8 *ram) +{ + u->ram = ram; + return 1; +} + /* IO */ void @@ -103,13 +110,6 @@ 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/devices/system.h b/src/devices/system.h index 0ec1e33..1772906 100644 --- a/src/devices/system.h +++ b/src/devices/system.h @@ -20,4 +20,5 @@ int system_version(char *emulator, char *date); int system_load(Uxn *u, char *filename); void system_inspect(Uxn *u); int system_error(char *msg, const char *err); +int system_boot(Uxn *u, Uint8 *ram); void system_deo(Uxn *u, Uint8 *d, Uint8 port); diff --git a/src/uxn.c b/src/uxn.c index 068cc78..d367181 100644 --- a/src/uxn.c +++ b/src/uxn.c @@ -117,14 +117,3 @@ uxn_eval(Uxn *u, Uint16 pc) } } } - -int -uxn_boot(Uxn *u, Uint8 *ram) -{ - Uint32 i; - char *cptr = (char *)u; - for(i = 0; i < sizeof(*u); i++) - cptr[i] = 0; - u->ram = ram; - return 1; -} diff --git a/src/uxn.h b/src/uxn.h index 8cab5f1..896bb53 100644 --- a/src/uxn.h +++ b/src/uxn.h @@ -46,5 +46,4 @@ extern Uint16 dev_vers[0x10], dei_mask[0x10], deo_mask[0x10]; /* built-ins */ -int uxn_boot(Uxn *u, Uint8 *ram); int uxn_eval(Uxn *u, Uint16 pc); diff --git a/src/uxncli.c b/src/uxncli.c index d792062..ada7f60 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -58,7 +58,7 @@ main(int argc, char **argv) if(argv[i][0] == '-' && argv[i][1] == 'v') return system_version("Uxncli - Console Varvara Emulator", "9 Aug 2023"); /* Continue.. */ - if(!uxn_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)))) + if(!system_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)))) return system_error("Boot", "Failed"); /* Load rom */ if(!system_load(&u, argv[i++])) diff --git a/src/uxnemu.c b/src/uxnemu.c index 65fbc6e..9b02d8c 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -258,7 +258,7 @@ static int emu_start(Uxn *u, char *rom, int queue) { free(u->ram); - if(!uxn_boot(u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)))) + if(!system_boot(u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)))) return system_error("Boot", "Failed to start uxn."); if(!system_load(u, rom)) return system_error("Boot", "Failed to load rom.");