Removed ram helper in uxn
This commit is contained in:
parent
61c7f9f0c1
commit
06b694d406
|
@ -151,7 +151,7 @@ screen_deo(Device *d, Uint8 port)
|
||||||
DEVPEEK16(x, 0x8);
|
DEVPEEK16(x, 0x8);
|
||||||
DEVPEEK16(y, 0xa);
|
DEVPEEK16(y, 0xa);
|
||||||
DEVPEEK16(addr, 0xc);
|
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] & 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] & 0x01) DEVPOKE16(0x8, x + 8); /* auto x+8 */
|
||||||
if(d->dat[0x6] & 0x02) DEVPOKE16(0xa, y + 8); /* auto y+8 */
|
if(d->dat[0x6] & 0x02) DEVPOKE16(0xa, y + 8); /* auto y+8 */
|
||||||
|
|
|
@ -108,14 +108,14 @@ err:
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
||||||
int
|
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;
|
Uint32 i;
|
||||||
char *cptr = (char *)u;
|
char *cptr = (char *)u;
|
||||||
for(i = 0; i < sizeof(*u); i++)
|
for(i = 0; i < sizeof(*u); i++)
|
||||||
cptr[i] = 0x00;
|
cptr[i] = 0x00;
|
||||||
u->ram = ram;
|
u->ram = ram;
|
||||||
u->devpage = devpage;
|
u->devices = devices;
|
||||||
u->wst = wst;
|
u->wst = wst;
|
||||||
u->rst = rst;
|
u->rst = rst;
|
||||||
return 1;
|
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];
|
Device *d = &u->dev[id];
|
||||||
d->u = u;
|
d->u = u;
|
||||||
d->mem = u->ram;
|
d->dat = u->devices + id * 0x10;
|
||||||
d->dei = deifn;
|
d->dei = deifn;
|
||||||
d->deo = deofn;
|
d->deo = deofn;
|
||||||
d->dat = u->devpage + id * 0x10;
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,12 +43,12 @@ typedef struct Device {
|
||||||
} Device;
|
} Device;
|
||||||
|
|
||||||
typedef struct Uxn {
|
typedef struct Uxn {
|
||||||
Uint8 *ram, *devpage;
|
Uint8 *ram, *devices;
|
||||||
Stack *wst, *rst;
|
Stack *wst, *rst;
|
||||||
Device dev[16];
|
Device dev[16];
|
||||||
} Uxn;
|
} 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_eval(Uxn *u, Uint16 pc);
|
||||||
int uxn_halt(Uxn *u, Uint8 error, Uint16 addr);
|
int uxn_halt(Uxn *u, Uint8 error, Uint16 addr);
|
||||||
Device *uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *, Uint8), void (*deofn)(Device *, Uint8));
|
Device *uxn_port(Uxn *u, Uint8 id, Uint8 (*deifn)(Device *, Uint8), void (*deofn)(Device *, Uint8));
|
||||||
|
|
|
@ -210,7 +210,7 @@ audio_deo(Device *d, Uint8 port)
|
||||||
DEVPEEK16(adsr, 0x8);
|
DEVPEEK16(adsr, 0x8);
|
||||||
DEVPEEK16(c->len, 0xa);
|
DEVPEEK16(c->len, 0xa);
|
||||||
DEVPEEK16(addr, 0xc);
|
DEVPEEK16(addr, 0xc);
|
||||||
c->addr = &d->mem[addr];
|
c->addr = &d->u->ram[addr];
|
||||||
c->volume[0] = d->dat[0xe] >> 4;
|
c->volume[0] = d->dat[0xe] >> 4;
|
||||||
c->volume[1] = d->dat[0xe] & 0xf;
|
c->volume[1] = d->dat[0xe] & 0xf;
|
||||||
c->repeat = !(d->dat[0xf] & 0x80);
|
c->repeat = !(d->dat[0xf] & 0x80);
|
||||||
|
|
Loading…
Reference in New Issue