diff --git a/src/uxncli.c b/src/uxncli.c index a828809..549599f 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -99,15 +99,14 @@ nil_talk(Device *d, Uint8 b0, Uint8 w) #pragma mark - Generics -static int -start(Uxn *u) +static void +run(Uxn *u) { if(!evaluxn(u, PAGE_PROGRAM)) - return error("Reset", "Failed"); - if(mempeek16(devconsole->dat, 0)) + error("Reset", "Failed"); + else if(mempeek16(devconsole->dat, 0)) while(read(0, &devconsole->dat[0x2], 1) > 0) evaluxn(u, mempeek16(devconsole->dat, 0)); - return 1; } int @@ -139,7 +138,7 @@ main(int argc, char **argv) portuxn(&u, 0xe, "empty", nil_talk); portuxn(&u, 0xf, "empty", nil_talk); - start(&u); + run(&u); if(argc > 2) printstack(&u.wst); diff --git a/src/uxnemu.c b/src/uxnemu.c index 0727e46..2c43078 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -343,8 +343,8 @@ stdin_handler(void *p) (void)p; } -static int -start(Uxn *u) +static void +run(Uxn *u) { evaluxn(u, 0x0100); redraw(u); @@ -356,8 +356,7 @@ start(Uxn *u) while(SDL_PollEvent(&event) != 0) { switch(event.type) { case SDL_QUIT: - quit(); - break; + return; case SDL_TEXTINPUT: devctrl->dat[3] = event.text.text[0]; /* fall-thru */ case SDL_KEYDOWN: @@ -396,7 +395,6 @@ start(Uxn *u) SDL_Delay(clamp(16.666f - elapsed, 0, 1000)); } } - return 1; } int @@ -438,7 +436,7 @@ main(int argc, char **argv) mempoke16(devscreen->dat, 2, ppu.hor * 8); mempoke16(devscreen->dat, 4, ppu.ver * 8); - start(&u); + run(&u); quit(); return 0; }