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
|
## Emulator Controls
|
||||||
|
|
||||||
- `F2` toggle on-screen debugger
|
- `F1` toggle zoom
|
||||||
- `F4` load boot.rom, or reload rom
|
- `F2` toggle debugger
|
||||||
|
- `F3` quit
|
||||||
|
- `F4` reboot
|
||||||
|
- `F5` reboot(soft)
|
||||||
|
|
||||||
### Buttons
|
### Buttons
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,7 @@ main(int argc, char **argv)
|
||||||
int i = 1;
|
int i = 1;
|
||||||
char *rom;
|
char *rom;
|
||||||
if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
|
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++;
|
i++;
|
||||||
}
|
}
|
||||||
rom = i == argc ? "boot.rom" : argv[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");
|
return !fprintf(stdout, "Could not open display.\n");
|
||||||
/* Event Loop */
|
/* Event Loop */
|
||||||
uxn.dev[0x17] = argc - i;
|
uxn.dev[0x17] = argc - i;
|
||||||
if(uxn_eval(PAGE_PROGRAM)) {
|
if(uxn_eval(PAGE_PROGRAM))
|
||||||
console_listen(i, argc, argv);
|
console_listen(i, argc, argv), emu_run();
|
||||||
emu_run();
|
|
||||||
}
|
|
||||||
return emu_end();
|
return emu_end();
|
||||||
}
|
}
|
||||||
|
|
53
src/uxncli.c
53
src/uxncli.c
|
@ -43,30 +43,41 @@ emu_deo(Uint8 addr, Uint8 value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
emu_run(void)
|
||||||
|
{
|
||||||
|
while(!uxn.dev[0x0f]) {
|
||||||
|
int c = fgetc(stdin);
|
||||||
|
if(c == EOF) {
|
||||||
|
console_input(0x00, CONSOLE_END);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
console_input(c, CONSOLE_STD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
emu_end(void)
|
||||||
|
{
|
||||||
|
free(uxn.ram);
|
||||||
|
return uxn.dev[0x0f] & 0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
if(i == argc)
|
char *rom;
|
||||||
return system_error("usage", "uxncli [-v] file.rom [args..]");
|
if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
|
||||||
/* Read flags */
|
fprintf(stdout, "Uxncli - Console Varvara Emulator, 15 Jul 2024.\n");
|
||||||
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
i++;
|
||||||
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) {
|
|
||||||
console_input(0x00, CONSOLE_END);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
console_input(c, CONSOLE_STD);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
free(uxn.ram);
|
rom = i == argc ? "boot.rom" : argv[i++];
|
||||||
return uxn.dev[0x0f] & 0x7f;
|
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