Revert "Tiny fix to PPU"

This reverts commit 9c4df35174.
This commit is contained in:
neauoire 2021-04-20 20:09:10 -07:00
parent 9c4df35174
commit c9e35a5ad8
3 changed files with 6 additions and 6 deletions

View File

@ -184,7 +184,7 @@ doctrl(Uxn *u, SDL_Event *event, int z)
Uint8 Uint8
system_poke(Uxn *u, Uint8 *m, Uint8 b0, Uint8 b1) system_poke(Uxn *u, Uint8 *m, Uint8 b0, Uint8 b1)
{ {
putcolors(&ppu, genpeek16(m, 0x8), genpeek16(m, 0xa), genpeek16(m, 0xc)); getcolors(&ppu, &m[0x8]);
printf("%02x%02x %02x%02x %02x%02x\n", m[0x8], m[0x9], m[0xa], m[0xb], m[0xc], m[0xd]); printf("%02x%02x %02x%02x %02x%02x\n", m[0x8], m[0x9], m[0xa], m[0xb], m[0xc], m[0xd]);
reqdraw = 1; reqdraw = 1;
(void)u; (void)u;

View File

@ -111,14 +111,14 @@ drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr)
} }
void void
putcolors(Ppu *p, Uint16 rr, Uint16 gg, Uint16 bb) getcolors(Ppu *p, Uint8 *addr)
{ {
int i; int i;
for(i = 0; i < 4; ++i) { for(i = 0; i < 4; ++i) {
Uint8 Uint8
r = ((rr >> (1 - i / 2) * 8) >> (!(i % 2) << 2)) & 0x0f, r = (*(addr + i / 2) >> (!(i % 2) << 2)) & 0x0f,
g = ((gg >> (1 - i / 2) * 8) >> (!(i % 2) << 2)) & 0x0f, g = (*(addr + 2 + i / 2) >> (!(i % 2) << 2)) & 0x0f,
b = ((bb >> (1 - i / 2) * 8) >> (!(i % 2) << 2)) & 0x0f; b = (*(addr + 4 + i / 2) >> (!(i % 2) << 2)) & 0x0f;
p->colors[i] = (r << 20) + (r << 16) + (g << 12) + (g << 8) + (b << 4) + b; p->colors[i] = (r << 20) + (r << 16) + (g << 12) + (g << 8) + (b << 4) + b;
} }
} }

View File

@ -26,7 +26,7 @@ typedef struct Ppu {
int initppu(Ppu *p, Uint8 hor, Uint8 ver, Uint8 pad); int initppu(Ppu *p, Uint8 hor, Uint8 ver, Uint8 pad);
void drawppu(Ppu *p); void drawppu(Ppu *p);
void drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr); void drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr);
void putcolors(Ppu *p, Uint16 rr, Uint16 gg, Uint16 bb); void getcolors(Ppu *p, Uint8 *addr);
void putpixel(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 color); void putpixel(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 color);
void puticn(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color); void puticn(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color);
void putchr(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color); void putchr(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color);