diff --git a/src/uxncli.c b/src/uxncli.c index 319401f..e879e33 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -1,7 +1,6 @@ #include #include #include -#include #include "uxn.h" @@ -63,8 +62,12 @@ system_deo_special(Device *d, Uint8 port) static void console_deo(Device *d, Uint8 port) { - if(port > 0x7) - write(port - 0x7, (char *)&d->dat[port], 1); + FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr + : 0; + if(fd) { + fputc(d->dat[port], fd); + fflush(fd); + } } static Uint8 @@ -92,12 +95,9 @@ console_input(Uxn *u, char c) static void run(Uxn *u) { - Uint16 vec; Device *d = devconsole; - while((!u->dev[0].dat[0xf]) && (read(0, &devconsole->dat[0x2], 1) > 0)) { - DEVPEEK16(vec, 0); - uxn_eval(u, vec); - } + while((!u->dev[0].dat[0xf]) && (read(0, &d->dat[0x2], 1) > 0)) + uxn_eval(u, GETVECTOR(d)); } static int diff --git a/src/uxnemu.c b/src/uxnemu.c index 00178a4..51aa735 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -434,9 +434,7 @@ run(Uxn *u) /* Audio */ else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) { Device *d = devaudio0 + (event.type - audio0_event); - Uint16 res; - DEVPEEK16(res, 0x00); - uxn_eval(u, res); + uxn_eval(u, GETVECTOR(d)); } /* Mouse */ else if(event.type == SDL_MOUSEMOTION)