|
|
|
|
@ -8,7 +8,7 @@
|
|
|
|
|
#include "devices/datetime.h" |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Copyright (c) 2021-2023 Devine Lu Linvega, Andrew Alderwick |
|
|
|
|
Copyright (c) 2021-2024 Devine Lu Linvega, Andrew Alderwick |
|
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and distribute this software for any |
|
|
|
|
purpose with or without fee is hereby granted, provided that the above |
|
|
|
|
@ -19,6 +19,7 @@ WITH REGARD TO THIS SOFTWARE.
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
Uxn uxn; |
|
|
|
|
Uint8 ram[0x10000 * RAM_PAGES]; |
|
|
|
|
|
|
|
|
|
Uint8 |
|
|
|
|
emu_dei(Uint8 addr) |
|
|
|
|
@ -55,28 +56,17 @@ emu_run(void)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int |
|
|
|
|
emu_end(void) |
|
|
|
|
{ |
|
|
|
|
free(uxn.ram); |
|
|
|
|
return uxn.dev[0x0f] & 0x7f; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int |
|
|
|
|
main(int argc, char **argv) |
|
|
|
|
{ |
|
|
|
|
int i = 1; |
|
|
|
|
char *rom; |
|
|
|
|
if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') { |
|
|
|
|
fprintf(stdout, "Uxncli - Console Varvara Emulator, 19 Oct 2024.\n"); |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
rom = i == argc ? "boot.rom" : argv[i++]; |
|
|
|
|
if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), rom)) |
|
|
|
|
if(argc > 1 && argv[1][0] == '-' && argv[1][1] == 'v') |
|
|
|
|
fprintf(stdout, "Uxncli - Varvara Emulator, 11 Nov 2024.\n"); |
|
|
|
|
else if(argc == 1 || !system_boot(ram, argv[1])) |
|
|
|
|
return !fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]); |
|
|
|
|
/* Event Loop */ |
|
|
|
|
uxn.dev[0x17] = argc - i; |
|
|
|
|
if(uxn_eval(PAGE_PROGRAM) && PEEK2(uxn.dev + 0x10)) |
|
|
|
|
console_listen(i, argc, argv), emu_run(); |
|
|
|
|
return emu_end(); |
|
|
|
|
else { |
|
|
|
|
uxn.dev[0x17] = argc - 2; |
|
|
|
|
if(uxn_eval(PAGE_PROGRAM) && PEEK2(uxn.dev + 0x10)) |
|
|
|
|
console_listen(2, argc, argv), emu_run(); |
|
|
|
|
} |
|
|
|
|
return uxn.dev[0x0f] & 0x7f; |
|
|
|
|
} |
|
|
|
|
|