commit 06b694d4061f0e7e78ad2efadd0d5b9525936c5b
parent 61c7f9f0c19f8548b97cc98725f392e1d65776c5
Author: neauoire <aliceffekt@gmail.com>
Date: Tue, 11 Jan 2022 14:51:25 -0800
Removed ram helper in uxn
Diffstat:
4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/devices/screen.c b/src/devices/screen.c
@@ -151,7 +151,7 @@ screen_deo(Device *d, Uint8 port)
DEVPEEK16(x, 0x8);
DEVPEEK16(y, 0xa);
DEVPEEK16(addr, 0xc);
- screen_blit(&uxn_screen, layer, x, y, &d->mem[addr], d->dat[0xf] & 0xf, d->dat[0xf] & 0x10, d->dat[0xf] & 0x20, twobpp);
+ screen_blit(&uxn_screen, layer, x, y, &d->u->ram[addr], d->dat[0xf] & 0xf, d->dat[0xf] & 0x10, d->dat[0xf] & 0x20, twobpp);
if(d->dat[0x6] & 0x04) DEVPOKE16(0xc, addr + 8 + twobpp * 8); /* auto addr+length */
if(d->dat[0x6] & 0x01) DEVPOKE16(0x8, x + 8); /* auto x+8 */
if(d->dat[0x6] & 0x02) DEVPOKE16(0xa, y + 8); /* auto y+8 */
diff --git a/src/uxn.c b/src/uxn.c
@@ -108,14 +108,14 @@ err:
/* clang-format on */
int
-uxn_boot(Uxn *u, Uint8 *ram, Uint8 *devpage, Stack *wst, Stack *rst)
+uxn_boot(Uxn *u, Uint8 *ram, Uint8 *devices, Stack *wst, Stack *rst)
{
Uint32 i;
char *cptr = (char *)u;
for(i = 0; i < sizeof(*u); i++)
cptr[i] = 0x00;
u->ram = ram;
- u->devpage = devpage;
+ u->devices = devices;
u->wst = wst;
u->rst = rst;
return 1;
@@ -126,9 +126,8 @@ uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *d, Uint8 port), void (*deofn)(
{
Device *d = &u->dev[id];
d->u = u;
- d->mem = u->ram;
+ d->dat = u->devices + id * 0x10;
d->dei = deifn;
d->deo = deofn;
- d->dat = u->devpage + id * 0x10;
return d;
}
diff --git a/src/uxn.h b/src/uxn.h
@@ -43,12 +43,12 @@ typedef struct Device {
} Device;
typedef struct Uxn {
- Uint8 *ram, *devpage;
+ Uint8 *ram, *devices;
Stack *wst, *rst;
Device dev[16];
} Uxn;
-int uxn_boot(Uxn *u, Uint8 *ram, Uint8 *devpage, Stack *wst, Stack *rst);
+int uxn_boot(Uxn *u, Uint8 *ram, Uint8 *devices, Stack *wst, Stack *rst);
int uxn_eval(Uxn *u, Uint16 pc);
int uxn_halt(Uxn *u, Uint8 error, Uint16 addr);
Device *uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *, Uint8), void (*deofn)(Device *, Uint8));
diff --git a/src/uxnemu.c b/src/uxnemu.c
@@ -210,7 +210,7 @@ audio_deo(Device *d, Uint8 port)
DEVPEEK16(adsr, 0x8);
DEVPEEK16(c->len, 0xa);
DEVPEEK16(addr, 0xc);
- c->addr = &d->mem[addr];
+ c->addr = &d->u->ram[addr];
c->volume[0] = d->dat[0xe] >> 4;
c->volume[1] = d->dat[0xe] & 0xf;
c->repeat = !(d->dat[0xf] & 0x80);