Tiny fix to PPU
This commit is contained in:
parent
a4e54062b8
commit
9c4df35174
|
@ -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)
|
||||||
{
|
{
|
||||||
getcolors(&ppu, &m[0x8]);
|
putcolors(&ppu, genpeek16(m, 0x8), genpeek16(m, 0xa), genpeek16(m, 0xc));
|
||||||
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;
|
||||||
|
|
|
@ -111,14 +111,14 @@ drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
getcolors(Ppu *p, Uint8 *addr)
|
putcolors(Ppu *p, Uint16 rr, Uint16 gg, Uint16 bb)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < 4; ++i) {
|
for(i = 0; i < 4; ++i) {
|
||||||
Uint8
|
Uint8
|
||||||
r = (*(addr + i / 2) >> (!(i % 2) << 2)) & 0x0f,
|
r = ((rr >> (1 - i / 2) * 8) >> (!(i % 2) << 2)) & 0x0f,
|
||||||
g = (*(addr + 2 + i / 2) >> (!(i % 2) << 2)) & 0x0f,
|
g = ((gg >> (1 - i / 2) * 8) >> (!(i % 2) << 2)) & 0x0f,
|
||||||
b = (*(addr + 4 + i / 2) >> (!(i % 2) << 2)) & 0x0f;
|
b = ((bb >> (1 - i / 2) * 8) >> (!(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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 getcolors(Ppu *p, Uint8 *addr);
|
void putcolors(Ppu *p, Uint16 rr, Uint16 gg, Uint16 bb);
|
||||||
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);
|
Loading…
Reference in New Issue