Standardized boot sequence
This commit is contained in:
parent
f6c66d53d1
commit
6b335197da
|
@ -46,8 +46,11 @@ The file device is _sandboxed_, meaning that it should not be able to read or wr
|
|||
|
||||
## Emulator Controls
|
||||
|
||||
- `F2` toggle on-screen debugger
|
||||
- `F4` load boot.rom, or reload rom
|
||||
- `F1` toggle zoom
|
||||
- `F2` toggle debugger
|
||||
- `F3` quit
|
||||
- `F4` reboot
|
||||
- `F5` reboot(soft)
|
||||
|
||||
### Buttons
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ main(int argc, char **argv)
|
|||
int i = 1;
|
||||
char *rom;
|
||||
if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
|
||||
fprintf(stdout, "Uxn11 - Varvara Emulator, 2 Jul 2024.\n");
|
||||
fprintf(stdout, "Uxn11 - Varvara Emulator, 15 Jul 2024.\n");
|
||||
i++;
|
||||
}
|
||||
rom = i == argc ? "boot.rom" : argv[i++];
|
||||
|
@ -278,9 +278,7 @@ main(int argc, char **argv)
|
|||
return !fprintf(stdout, "Could not open display.\n");
|
||||
/* Event Loop */
|
||||
uxn.dev[0x17] = argc - i;
|
||||
if(uxn_eval(PAGE_PROGRAM)) {
|
||||
console_listen(i, argc, argv);
|
||||
emu_run();
|
||||
}
|
||||
if(uxn_eval(PAGE_PROGRAM))
|
||||
console_listen(i, argc, argv), emu_run();
|
||||
return emu_end();
|
||||
}
|
||||
|
|
41
src/uxncli.c
41
src/uxncli.c
|
@ -43,21 +43,9 @@ emu_deo(Uint8 addr, Uint8 value)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
static void
|
||||
emu_run(void)
|
||||
{
|
||||
int i = 1;
|
||||
if(i == argc)
|
||||
return system_error("usage", "uxncli [-v] file.rom [args..]");
|
||||
/* Read flags */
|
||||
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
||||
return !printf("Uxncli - Console Varvara Emulator, 2 Jul 2024\n");
|
||||
if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
|
||||
return system_error("Init", "Failed to initialize uxn.");
|
||||
/* Game Loop */
|
||||
uxn.dev[0x17] = argc - i;
|
||||
if(uxn_eval(PAGE_PROGRAM) && PEEK2(uxn.dev + 0x10)) {
|
||||
console_listen(i, argc, argv);
|
||||
while(!uxn.dev[0x0f]) {
|
||||
int c = fgetc(stdin);
|
||||
if(c == EOF) {
|
||||
|
@ -66,7 +54,30 @@ main(int argc, char **argv)
|
|||
}
|
||||
console_input(c, CONSOLE_STD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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, 15 Jul 2024.\n");
|
||||
i++;
|
||||
}
|
||||
rom = i == argc ? "boot.rom" : argv[i++];
|
||||
if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), rom))
|
||||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue