Set Console/type after memory is initialized

This commit is contained in:
Devine Lu Linvega 2023-04-22 14:56:12 -07:00
parent 3038d5c40b
commit 40d6c889bc
2 changed files with 8 additions and 7 deletions

View File

@ -52,7 +52,7 @@ main(int argc, char **argv)
return system_error("Boot", "Failed");
if(!system_load(&u, argv[i++]))
return system_error("Load", "Failed");
u.dev[0x17] = i != argc;
u.dev[0x17] = argc - i;
if(!uxn_eval(&u, PAGE_PROGRAM))
return u.dev[0x0f] & 0x7f;
for(; i < argc; i++) {

View File

@ -244,13 +244,14 @@ init(void)
/* Boot */
static int
start(Uxn *u, char *rom)
start(Uxn *u, char *rom, int queue)
{
free(u->ram);
if(!uxn_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.");
u->dev[0x17] = queue;
exec_deadline = SDL_GetPerformanceCounter() + deadline_interval;
if(!uxn_eval(u, PAGE_PROGRAM))
return system_error("Boot", "Failed to eval rom.");
@ -287,8 +288,8 @@ static void
restart(Uxn *u)
{
screen_resize(&uxn_screen, WIDTH, HEIGHT);
if(!start(u, "launcher.rom"))
start(u, rom_path);
if(!start(u, "launcher.rom", 0))
start(u, rom_path, 0);
}
static Uint8
@ -364,7 +365,7 @@ handle_events(Uxn *u)
redraw();
else if(event.type == SDL_DROPFILE) {
screen_resize(&uxn_screen, WIDTH, HEIGHT);
start(u, event.drop.file);
start(u, event.drop.file, 0);
SDL_free(event.drop.file);
}
/* Audio */
@ -495,8 +496,8 @@ main(int argc, char **argv)
/* load rom */
if(i == argc)
return system_error("usage", "uxnemu [-2x][-3x] file.rom");
u.dev[0x17] = i != argc - 1;
if(!start(&u, argv[i]))
printf("%d/%d -> %d\n", i, argc, argc - i);
if(!start(&u, argv[i], argc - i))
return system_error("Start", "Failed");
rom_path = argv[i++];
/* read arguments */