diff --git a/makefile b/makefile index f47cad7..82d3bbe 100644 --- a/makefile +++ b/makefile @@ -36,9 +36,10 @@ bin/uxncli: ${CLI_src} src/uxncli.c @ cc ${RELEASE_flags} ${CFLAGS} ${CLI_src} src/uxncli.c -lutil -o bin/uxncli bin/uxn11: ${EMU_src} src/uxn11.c @ cc ${RELEASE_flags} ${CFLAGS} ${EMU_src} src/uxn11.c -lX11 -lutil -o bin/uxn11 + bin/uxnasm-debug: src/uxnasm.c - @ cc ${DEBUG_flags} ${CFLAGS} src/uxnasm.c -o bin/uxnasm + @ cc ${DEBUG_flags} ${CFLAGS} src/uxnasm.c -o bin/uxnasm-debug bin/uxncli-debug: ${CLI_src} src/uxncli.c - @ cc ${DEBUG_flags} ${CFLAGS} ${CLI_src} src/uxncli.c -lutil -o bin/uxncli + @ cc ${DEBUG_flags} ${CFLAGS} ${CLI_src} src/uxncli.c -lutil -o bin/uxncli-debug bin/uxn11-debug: ${EMU_src} src/uxn11.c - @ cc ${DEBUG_flags} ${CFLAGS} ${EMU_src} src/uxn11.c -lX11 -lutil -o bin/uxn11 + @ cc ${DEBUG_flags} ${CFLAGS} ${EMU_src} src/uxn11.c -lX11 -lutil -o bin/uxn11-debug diff --git a/src/devices/system.c b/src/devices/system.c index a16dec1..d8e421d 100644 --- a/src/devices/system.c +++ b/src/devices/system.c @@ -102,7 +102,7 @@ void system_deo(Uint8 port) { switch(port) { - case 0x3: + case 0x3: { Uint16 addr = PEEK2(uxn.dev + 2); if(uxn.ram[addr] == 0x0) { Uint8 value = uxn.ram[addr + 7]; @@ -128,6 +128,7 @@ system_deo(Uint8 port) } else fprintf(stderr, "Unknown Expansion Command 0x%02x\n", uxn.ram[addr]); break; + } case 0x4: uxn.wst.ptr = uxn.dev[4]; break; diff --git a/src/uxn11.c b/src/uxn11.c index c39b424..f089083 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -154,6 +154,7 @@ emu_event(void) switch(sym) { case XK_F1: toggle_scale(); break; case XK_F2: uxn.dev[0x0e] = !uxn.dev[0x0e]; break; + case XK_F3: uxn.dev[0x0f] = 0xff; break; case XK_F4: emu_restart(boot_rom, 0); break; case XK_F5: emu_restart(boot_rom, 1); break; } @@ -168,16 +169,13 @@ emu_event(void) } break; case ButtonPress: { XButtonPressedEvent *e = (XButtonPressedEvent *)&ev; - if(e->button == 4) - mouse_scroll(0, 1); - else if(e->button == 5) - mouse_scroll(0, -1); - else if(e->button == 6) - mouse_scroll(1, 0); - else if(e->button == 7) - mouse_scroll(-1, 0); - else - mouse_down(0x1 << (e->button - 1)); + switch(e->button) { + case 4: mouse_scroll(0, 1); break; + case 5: mouse_scroll(0, -1); break; + case 6: mouse_scroll(1, 0); break; + case 7: mouse_scroll(-1, 0); break; + default: mouse_down(0x1 << (e->button - 1)); + } } break; case ButtonRelease: { XButtonPressedEvent *e = (XButtonPressedEvent *)&ev; @@ -196,9 +194,9 @@ static int display_init(void) { Atom wmDelete; - static Visual *visual; + Visual *visual; XColor black = {0}; - static char empty[] = {0}; + char empty[] = {0}; Pixmap bitmap; Cursor blank; display = XOpenDisplay(NULL); @@ -229,8 +227,7 @@ static int emu_run(void) { int i = 1, n; - char expirations[8]; - char coninp[CONINBUFSIZE]; + char expirations[8], coninp[CONINBUFSIZE]; struct pollfd fds[3]; static const struct itimerspec screen_tspec = {{0, 16666666}, {0, 16666666}}; /* timer */ @@ -275,15 +272,11 @@ main(int argc, char **argv) i++; } rom = i == argc ? "boot.rom" : argv[i++]; - if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), rom)) { - fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]); - return 0; - } - if(!display_init()) { - fprintf(stdout, "Could not open display.\n"); - return 0; - } - /* Game Loop */ + if(!system_boot((Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), rom)) + return !fprintf(stdout, "usage: %s [-v] file.rom [args..]\n", argv[0]); + if(!display_init()) + 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);