commit f7506a41c7dd31f4e48000dd798f04e069ebf68e
parent d343865471d5bf0b55e592f2a7fb8a4e12f5b624
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Tue, 27 Apr 2021 21:10:58 +0100
Added stack pointer position readouts to system device
Diffstat:
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/emulator.c b/src/emulator.c
@@ -193,9 +193,13 @@ doctrl(Uxn *u, SDL_Event *event, int z)
void
system_talk(Device *d, Uint8 b0, Uint8 w)
{
- if(!w) return;
- putcolors(&ppu, &d->dat[0x8]);
- reqdraw = 1;
+ if(!w) {
+ d->dat[0x2] = d->u->wst.ptr;
+ d->dat[0x3] = d->u->rst.ptr;
+ } else {
+ putcolors(&ppu, &d->dat[0x8]);
+ reqdraw = 1;
+ }
(void)b0;
}
diff --git a/src/uxn.c b/src/uxn.c
@@ -183,6 +183,7 @@ portuxn(Uxn *u, Uint8 id, char *name, void (*talkfn)(Device *d, Uint8 b0, Uint8
{
Device *d = &u->dev[id];
d->addr = id * 0x10;
+ d->u = u;
d->mem = u->ram.dat;
d->talk = talkfn;
printf("Device added #%02x: %s, at 0x%04x \n", id, name, d->addr);
diff --git a/src/uxn.h b/src/uxn.h
@@ -31,6 +31,7 @@ typedef struct {
struct Uxn;
typedef struct Device {
+ struct Uxn *u;
Uint8 addr, dat[16], *mem;
void (*talk)(struct Device *d, Uint8, Uint8);
} Device;