Browse code

Added return pointer position to debugger

neauoire authored on 19/06/2021 03:19:32
Showing 3 changed files
... ...
@@ -107,15 +107,17 @@ putchr(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uin
107 107
 /* output */
108 108
 
109 109
 void
110
-inspect(Ppu *p, Uint8 *stack, Uint8 ptr)
110
+inspect(Ppu *p, Uint8 *stack, Uint8 wptr, Uint8 rptr)
111 111
 {
112 112
 	Uint8 i, x, y, b;
113 113
 	for(i = 0; i < 0x20; ++i) { /* memory */
114 114
 		x = ((i % 8) * 3 + 1) * 8, y = (i / 8 + 1) * 8, b = stack[i];
115
-		puticn(p, &p->bg, x, y, font[(b >> 4) & 0xf], 1 + (ptr == i) * 0x7, 0, 0);
116
-		puticn(p, &p->bg, x + 8, y, font[b & 0xf], 1 + (ptr == i) * 0x7, 0, 0);
115
+		puticn(p, &p->bg, x, y, font[(b >> 4) & 0xf], 1 + (wptr == i) * 0x7, 0, 0);
116
+		puticn(p, &p->bg, x + 8, y, font[b & 0xf], 1 + (wptr == i) * 0x7, 0, 0);
117 117
 	}
118
-	for(x = 0; x < 0x20; ++x) {
118
+	puticn(p, &p->bg, 0x8, y + 0x10, font[(rptr >> 4) & 0xf], 0x2, 0, 0);
119
+	puticn(p, &p->bg, 0x10, y + 0x10, font[rptr & 0xf], 0x2, 0, 0);
120
+	for(x = 0; x < 0x20; ++x) { /* guides */
119 121
 		putpixel(p, &p->bg, x, p->height / 2, 2);
120 122
 		putpixel(p, &p->bg, p->width - x, p->height / 2, 2);
121 123
 		putpixel(p, &p->bg, p->width / 2, p->height - x, 2);
... ...
@@ -31,4 +31,4 @@ void putcolors(Ppu *p, Uint8 *addr);
31 31
 void putpixel(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 color);
32 32
 void puticn(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy);
33 33
 void putchr(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy);
34
-void inspect(Ppu *p, Uint8 *stack, Uint8 ptr);
34
+void inspect(Ppu *p, Uint8 *stack, Uint8 wptr, Uint8 rptr);
... ...
@@ -59,7 +59,7 @@ void
59 59
 redraw(Uxn *u)
60 60
 {
61 61
 	if(debug)
62
-		inspect(&ppu, u->wst.dat, u->wst.ptr);
62
+		inspect(&ppu, u->wst.dat, u->wst.ptr, u->rst.ptr);
63 63
 	SDL_UpdateTexture(bgTexture, &gRect, ppu.bg.pixels, ppu.width * sizeof(Uint32));
64 64
 	SDL_UpdateTexture(fgTexture, &gRect, ppu.fg.pixels, ppu.width * sizeof(Uint32));
65 65
 	SDL_RenderClear(gRenderer);