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