uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit ede186b22684fa6908bfd8c3a33027753ea89d81
parent 38d2c7cbd742f4b5e99bd3c942919c09f7437c6b
Author: neauoire <aliceffekt@gmail.com>
Date:   Tue, 11 Jan 2022 11:07:25 -0800

Minor cleanup

Diffstat:
Msrc/uxncli.c | 16++++++++--------
Msrc/uxnemu.c | 4+---
2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/uxncli.c b/src/uxncli.c @@ -1,7 +1,6 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <time.h> #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 @@ -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)