Drawing inspect on fg so it can be erased
This commit is contained in:
parent
eadfdbe898
commit
a1d00a2df7
|
@ -99,23 +99,29 @@ putchr(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uin
|
||||||
/* output */
|
/* output */
|
||||||
|
|
||||||
void
|
void
|
||||||
inspect(Ppu *p, Uint8 *stack, Uint8 wptr, Uint8 rptr)
|
inspect(Ppu *p, Uint8 *stack, Uint8 wptr, Uint8 rptr, Uint8 *memory)
|
||||||
{
|
{
|
||||||
Uint8 i, x, y, b;
|
Uint8 i, x, y, b;
|
||||||
for(i = 0; i < 0x20; ++i) { /* memory */
|
for(i = 0; i < 0x20; ++i) { /* stack */
|
||||||
x = ((i % 8) * 3 + 1) * 8, y = (i / 8 + 1) * 8, b = stack[i];
|
x = ((i % 8) * 3 + 1) * 8, y = (i / 8 + 1) * 8, b = stack[i];
|
||||||
puticn(p, &p->bg, x, y, font[(b >> 4) & 0xf], 1 + (wptr == i) * 0x7, 0, 0);
|
puticn(p, &p->fg, x, y, font[(b >> 4) & 0xf], 1 + (wptr == i) * 0x7, 0, 0);
|
||||||
puticn(p, &p->bg, x + 8, y, font[b & 0xf], 1 + (wptr == i) * 0x7, 0, 0);
|
puticn(p, &p->fg, x + 8, y, font[b & 0xf], 1 + (wptr == i) * 0x7, 0, 0);
|
||||||
}
|
}
|
||||||
puticn(p, &p->bg, 0x8, y + 0x10, font[(rptr >> 4) & 0xf], 0x2, 0, 0);
|
for(i = 0; i < 0x40; ++i) { /* memory */
|
||||||
puticn(p, &p->bg, 0x10, y + 0x10, font[rptr & 0xf], 0x2, 0, 0);
|
x = ((i % 8) * 3 + 1) * 8, y = (i / 8 + 1) * 8 + p->height - 0x50, b = memory[i];
|
||||||
for(x = 0; x < 0x20; ++x) { /* guides */
|
puticn(p, &p->fg, x, y, font[(b >> 4) & 0xf], 3, 0, 0);
|
||||||
putpixel(p, &p->bg, x, p->height / 2, 2);
|
puticn(p, &p->fg, x + 8, y, font[b & 0xf], 3, 0, 0);
|
||||||
putpixel(p, &p->bg, p->width - x, p->height / 2, 2);
|
}
|
||||||
putpixel(p, &p->bg, p->width / 2, p->height - x, 2);
|
/* return pointer */
|
||||||
putpixel(p, &p->bg, p->width / 2, x, 2);
|
puticn(p, &p->fg, 0x8, y + 0x10, font[(rptr >> 4) & 0xf], 0x2, 0, 0);
|
||||||
putpixel(p, &p->bg, p->width / 2 - 16 + x, p->height / 2, 2);
|
puticn(p, &p->fg, 0x10, y + 0x10, font[rptr & 0xf], 0x2, 0, 0);
|
||||||
putpixel(p, &p->bg, p->width / 2, p->height / 2 - 16 + x, 2);
|
for(x = 0; x < 0x10; ++x) { /* guides */
|
||||||
|
putpixel(p, &p->fg, x, p->height / 2, 2);
|
||||||
|
putpixel(p, &p->fg, p->width - x, p->height / 2, 2);
|
||||||
|
putpixel(p, &p->fg, p->width / 2, p->height - x, 2);
|
||||||
|
putpixel(p, &p->fg, p->width / 2, x, 2);
|
||||||
|
putpixel(p, &p->fg, p->width / 2 - 0x10 / 2 + x, p->height / 2, 2);
|
||||||
|
putpixel(p, &p->fg, p->width / 2, p->height / 2 - 0x10 / 2 + x, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,4 +31,4 @@ void putcolors(Ppu *p, Uint8 *addr);
|
||||||
void putpixel(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 color);
|
void putpixel(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 color);
|
||||||
void puticn(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy);
|
void puticn(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy);
|
||||||
void putchr(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy);
|
void putchr(Ppu *p, Layer *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy);
|
||||||
void inspect(Ppu *p, Uint8 *stack, Uint8 wptr, Uint8 rptr);
|
void inspect(Ppu *p, Uint8 *stack, Uint8 wptr, Uint8 rptr, Uint8 *memory);
|
||||||
|
|
|
@ -63,7 +63,7 @@ static void
|
||||||
redraw(Uxn *u)
|
redraw(Uxn *u)
|
||||||
{
|
{
|
||||||
if(debug)
|
if(debug)
|
||||||
inspect(&ppu, u->wst.dat, u->wst.ptr, u->rst.ptr);
|
inspect(&ppu, u->wst.dat, u->wst.ptr, u->rst.ptr, u->ram.dat);
|
||||||
SDL_UpdateTexture(bgTexture, &gRect, ppu.bg.pixels, ppu.width * sizeof(Uint32));
|
SDL_UpdateTexture(bgTexture, &gRect, ppu.bg.pixels, ppu.width * sizeof(Uint32));
|
||||||
SDL_UpdateTexture(fgTexture, &gRect, ppu.fg.pixels, ppu.width * sizeof(Uint32));
|
SDL_UpdateTexture(fgTexture, &gRect, ppu.fg.pixels, ppu.width * sizeof(Uint32));
|
||||||
SDL_RenderClear(gRenderer);
|
SDL_RenderClear(gRenderer);
|
||||||
|
|
Loading…
Reference in New Issue