Removed duplicate function in ppu

This commit is contained in:
neauoire 2021-04-10 22:00:49 -07:00
parent 86a52e1091
commit 3cd7be7eb5
2 changed files with 22 additions and 33 deletions

View File

@ -18,10 +18,10 @@
( program ) ( program )
|0200 @RESET |0200
( theme ) #03fd =System.r #0ef3 =System.g #0bf2 =System.b ( theme ) #03fd =System.r #0ef3 =System.g #0bf2 =System.b
( vectors ) ,FRAME =Screen.vector ( vectors ) ,on-screen =Screen.vector
#01 =fps.current #01 =fps.current
#000c #000c
@ -38,7 +38,7 @@
OVR2 OVR2 ~lines.x1 ,v JSR2 OVR2 OVR2 ~lines.x1 ,v JSR2
~lines.x2 ,v JSR2 ~lines.x2 ,v JSR2
@FRAME @on-screen
,update-fps JSR2 ,update-fps JSR2
#00 =neralie.color #00 =neralie.color
,neralie-lines JSR2 ,neralie-lines JSR2

View File

@ -63,36 +63,6 @@ drawchr(Ppu *p, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 alpha)
} }
} }
void
drawicn(Ppu *p, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 fg, Uint8 bg)
{
Uint8 v, h;
for(v = 0; v < 8; v++)
for(h = 0; h < 8; h++) {
Uint8 ch1 = (sprite[v] >> (7 - h)) & 0x1;
drawpixel(p, x + h, y + v, ch1 ? fg : bg);
}
}
void
drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr)
{
Uint8 i, x, y, b;
for(i = 0; i < 0x10; ++i) { /* memory */
x = ((i % 8) * 3 + 3) * 8, y = p->pad + 8 + i / 8 * 8, b = stack[i];
drawicn(p, x, y, font[(b >> 4) & 0xf], 1 + (ptr == i), 0);
drawicn(p, x + 8, y, font[b & 0xf], 1 + (ptr == i), 0);
}
for(x = 0; x < 32; ++x) {
drawpixel(p, x, p->height / 2, 2);
drawpixel(p, p->width - x, p->height / 2, 2);
drawpixel(p, p->width / 2, p->height - x, 2);
drawpixel(p, p->width / 2, x, 2);
drawpixel(p, p->width / 2 - 16 + x, p->height / 2, 2);
drawpixel(p, p->width / 2, p->height / 2 - 16 + x, 2);
}
}
void void
putpixel(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 color) putpixel(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 color)
{ {
@ -134,6 +104,25 @@ putchr(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color)
} }
} }
void
drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr)
{
Uint8 i, x, y, b;
for(i = 0; i < 0x20; ++i) { /* memory */
x = ((i % 8) * 3 + 1) * 8, y = (i / 8 + 1) * 8, b = stack[i];
puticn(p, p->bg, x, y, font[(b >> 4) & 0xf], 2);
puticn(p, p->bg, x + 8, y, font[b & 0xf], 2);
}
for(x = 0; x < 0x20; ++x) {
drawpixel(p, x, p->height / 2, 2);
drawpixel(p, p->width - x, p->height / 2, 2);
drawpixel(p, p->width / 2, p->height - x, 2);
drawpixel(p, p->width / 2, x, 2);
drawpixel(p, p->width / 2 - 16 + x, p->height / 2, 2);
drawpixel(p, p->width / 2, p->height / 2 - 16 + x, 2);
}
}
void void
getcolors(Ppu *p, Uint8 *addr) getcolors(Ppu *p, Uint8 *addr)
{ {