Minor cleanup

This commit is contained in:
neauoire 2022-01-11 11:07:25 -08:00
parent 38d2c7cbd7
commit ede186b226
2 changed files with 9 additions and 11 deletions

View File

@ -1,7 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <time.h>
#include "uxn.h" #include "uxn.h"
@ -63,8 +62,12 @@ system_deo_special(Device *d, Uint8 port)
static void static void
console_deo(Device *d, Uint8 port) console_deo(Device *d, Uint8 port)
{ {
if(port > 0x7) FILE *fd = port == 0x8 ? stdout : port == 0x9 ? stderr
write(port - 0x7, (char *)&d->dat[port], 1); : 0;
if(fd) {
fputc(d->dat[port], fd);
fflush(fd);
}
} }
static Uint8 static Uint8
@ -92,12 +95,9 @@ console_input(Uxn *u, char c)
static void static void
run(Uxn *u) run(Uxn *u)
{ {
Uint16 vec;
Device *d = devconsole; Device *d = devconsole;
while((!u->dev[0].dat[0xf]) && (read(0, &devconsole->dat[0x2], 1) > 0)) { while((!u->dev[0].dat[0xf]) && (read(0, &d->dat[0x2], 1) > 0))
DEVPEEK16(vec, 0); uxn_eval(u, GETVECTOR(d));
uxn_eval(u, vec);
}
} }
static int static int

View File

@ -434,9 +434,7 @@ run(Uxn *u)
/* Audio */ /* Audio */
else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) { else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) {
Device *d = devaudio0 + (event.type - audio0_event); Device *d = devaudio0 + (event.type - audio0_event);
Uint16 res; uxn_eval(u, GETVECTOR(d));
DEVPEEK16(res, 0x00);
uxn_eval(u, res);
} }
/* Mouse */ /* Mouse */
else if(event.type == SDL_MOUSEMOTION) else if(event.type == SDL_MOUSEMOTION)