diff --git a/src/devices/system.c b/src/devices/system.c index ec38e1a..81336f3 100644 --- a/src/devices/system.c +++ b/src/devices/system.c @@ -52,12 +52,12 @@ uxn_halt(Uxn *u, Uint8 error, Uint16 addr) /* IO */ void -system_deo(Device *d, Uint8 port) +system_deo(Uxn *u, Uint8 *d, Uint8 port) { switch(port) { - case 0x2: d->u->wst = (Stack *)(d->u->ram + (d->dat[port] ? (d->dat[port] * 0x100) : 0x10000)); break; - case 0x3: d->u->rst = (Stack *)(d->u->ram + (d->dat[port] ? (d->dat[port] * 0x100) : 0x10100)); break; - case 0xe: system_inspect(d->u); break; + case 0x2: u->wst = (Stack *)(u->ram + (d[port] ? (d[port] * 0x100) : 0x10000)); break; + case 0x3: u->rst = (Stack *)(u->ram + (d[port] ? (d[port] * 0x100) : 0x10100)); break; + case 0xe: system_inspect(u); break; default: system_deo_special(d, port); } } diff --git a/src/devices/system.h b/src/devices/system.h index e84945d..d9f7602 100644 --- a/src/devices/system.h +++ b/src/devices/system.h @@ -15,5 +15,5 @@ typedef struct SystemDevice { } SystemDevice; void system_inspect(Uxn *u); -void system_deo(Device *d, Uint8 port); -void system_deo_special(Device *d, Uint8 port); +void system_deo(Uxn *u, Uint8 *d, Uint8 port); +void system_deo_special(Uint8 *d, Uint8 port); diff --git a/src/uxn11.c b/src/uxn11.c index 8984b52..c80bbd1 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -33,10 +33,10 @@ error(char *msg, const char *err) } void -system_deo_special(Device *d, Uint8 port) +system_deo_special(Uint8 *d, Uint8 port) { if(port > 0x7 && port < 0xe) - screen_palette(&uxn_screen, &d->dat[0x8]); + screen_palette(&uxn_screen, &d[0x8]); } static int @@ -79,7 +79,7 @@ uxn11_deo(Uxn *u, Uint8 addr, Uint8 v) Device *d = &u->dev[addr >> 4]; d->dat[p] = v; switch(addr & 0xf0) { - case 0x00: system_deo(d, p); break; + case 0x00: system_deo(u, d->dat, p); break; case 0x10: console_deo(d->dat, p); break; case 0x20: screen_deo(u->ram, d->dat, p); break; case 0xa0: file_deo(d, p); break; @@ -192,7 +192,7 @@ start(Uxn *u, char *rom) u->dei = uxn11_dei; u->deo = uxn11_deo; - /* system */ uxn_port(u, 0x0, nil_dei, system_deo); + /* system */ uxn_port(u, 0x0, nil_dei, nil_deo); /* console */ uxn_port(u, 0x1, nil_dei, nil_deo); /* screen */ devscreen = uxn_port(u, 0x2, nil_dei, nil_deo); /* empty */ uxn_port(u, 0x3, nil_dei, nil_deo);