commit 794ce1bdfd86fd12894e97b6b302459b36246955
parent bf4ee03d2794a5a56e59e354a72a9293ada0e3b1
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Sun, 1 Jan 2023 13:40:58 -0800
Housekeeping
Diffstat:
4 files changed, 4 insertions(+), 21 deletions(-)
diff --git a/src/uxn.c b/src/uxn.c
@@ -41,14 +41,10 @@ int
uxn_eval(Uxn *u, Uint16 pc)
{
unsigned int a, b, c, j, k, bs, instr, errcode;
- unsigned int limit = LIMIT;
Uint8 kptr, *sp;
Stack *src, *dst;
- if(!pc || u->devold[0].dat[0xf]) return 0;
+ if(!pc || u->dev[0x0f]) return 0;
while((instr = u->ram[pc++])) {
- if(!limit--) {
- limit = LIMIT;
- }
/* Return Mode */
if(instr & 0x40) {
src = u->rst; dst = u->wst;
@@ -125,13 +121,3 @@ uxn_boot(Uxn *u, Uint8 *ram, Dei *dei, Deo *deo)
u->deo = deo;
return 1;
}
-
-Device *
-uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *d, Uint8 port), void (*deofn)(Device *d, Uint8 port))
-{
- Device *d = &u->devold[id];
- d->u = u;
- d->dei = deifn;
- d->deo = deofn;
- return d;
-}
diff --git a/src/uxn.h b/src/uxn.h
@@ -53,7 +53,6 @@ typedef struct {
typedef struct Uxn {
Uint8 *ram, *dev;
Stack *wst, *rst;
- Device devold[16];
Uint8 (*dei)(struct Uxn *u, Uint8 addr);
void (*deo)(struct Uxn *u, Uint8 addr, Uint8 value);
} Uxn;
diff --git a/src/uxnasm.c b/src/uxnasm.c
@@ -451,12 +451,12 @@ review(char *filename)
static void
writesym(char *filename)
{
+ int i;
char symdst[0x60];
FILE *fp;
if(slen(filename) > 0x60 - 5)
return;
fp = fopen(scat(scpy(filename, symdst, slen(filename) + 1), ".sym"), "w");
- int i;
if(fp != NULL) {
for(i = 0; i < p.llen; i++) {
fwrite(&p.labels[i].addr + 1, 1, 1, fp);
diff --git a/src/uxnemu.c b/src/uxnemu.c
@@ -48,7 +48,7 @@ static SDL_Thread *stdin_thread;
/* devices */
-static Device *devscreen, *devaudio0;
+static Device *devaudio0;
static Uint8 zoom = 1;
static Uint32 stdin_event, audio0_event;
static Uint64 exec_deadline, deadline_interval, ms_interval;
@@ -213,7 +213,6 @@ static void
emu_deo(Uxn *u, Uint8 addr, Uint8 v)
{
Uint8 p = addr & 0x0f, d = addr & 0xf0;
- Uint16 mask = 0x1 << (d >> 4);
u->dev[addr] = v;
switch(d) {
case 0x00:
@@ -450,11 +449,10 @@ handle_events(Uxn *u)
static int
run(Uxn *u)
{
- Device *devsys = &u->devold[0];
Uint64 now = SDL_GetPerformanceCounter(), frame_end, frame_interval = SDL_GetPerformanceFrequency() / 60;
for(;;) {
/* .System/halt */
- if(devsys->dat[0xf])
+ if(u->dev[0x0f])
return error("Run", "Ended.");
frame_end = now + frame_interval;
exec_deadline = now + deadline_interval;