| ... | ... |
@@ -184,7 +184,7 @@ doctrl(Uxn *u, SDL_Event *event, int z) |
| 184 | 184 |
Uint8 |
| 185 | 185 |
system_poke(Uxn *u, Uint8 *m, Uint8 b0, Uint8 b1) |
| 186 | 186 |
{
|
| 187 |
- getcolors(&ppu, &m[0x8]); |
|
| 187 |
+ putcolors(&ppu, genpeek16(m, 0x8), genpeek16(m, 0xa), genpeek16(m, 0xc)); |
|
| 188 | 188 |
printf("%02x%02x %02x%02x %02x%02x\n", m[0x8], m[0x9], m[0xa], m[0xb], m[0xc], m[0xd]);
|
| 189 | 189 |
reqdraw = 1; |
| 190 | 190 |
(void)u; |
| ... | ... |
@@ -111,14 +111,14 @@ drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr) |
| 111 | 111 |
} |
| 112 | 112 |
|
| 113 | 113 |
void |
| 114 |
-getcolors(Ppu *p, Uint8 *addr) |
|
| 114 |
+putcolors(Ppu *p, Uint16 rr, Uint16 gg, Uint16 bb) |
|
| 115 | 115 |
{
|
| 116 | 116 |
int i; |
| 117 | 117 |
for(i = 0; i < 4; ++i) {
|
| 118 | 118 |
Uint8 |
| 119 |
- r = (*(addr + i / 2) >> (!(i % 2) << 2)) & 0x0f, |
|
| 120 |
- g = (*(addr + 2 + i / 2) >> (!(i % 2) << 2)) & 0x0f, |
|
| 121 |
- b = (*(addr + 4 + i / 2) >> (!(i % 2) << 2)) & 0x0f; |
|
| 119 |
+ r = ((rr >> (1 - i / 2) * 8) >> (!(i % 2) << 2)) & 0x0f, |
|
| 120 |
+ g = ((gg >> (1 - i / 2) * 8) >> (!(i % 2) << 2)) & 0x0f, |
|
| 121 |
+ b = ((bb >> (1 - i / 2) * 8) >> (!(i % 2) << 2)) & 0x0f; |
|
| 122 | 122 |
p->colors[i] = (r << 20) + (r << 16) + (g << 12) + (g << 8) + (b << 4) + b; |
| 123 | 123 |
} |
| 124 | 124 |
} |
| ... | ... |
@@ -26,7 +26,7 @@ typedef struct Ppu {
|
| 26 | 26 |
int initppu(Ppu *p, Uint8 hor, Uint8 ver, Uint8 pad); |
| 27 | 27 |
void drawppu(Ppu *p); |
| 28 | 28 |
void drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr); |
| 29 |
-void getcolors(Ppu *p, Uint8 *addr); |
|
| 29 |
+void putcolors(Ppu *p, Uint16 rr, Uint16 gg, Uint16 bb); |
|
| 30 | 30 |
void putpixel(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 color); |
| 31 | 31 |
void puticn(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color); |
| 32 | 32 |
void putchr(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color); |
| 33 | 33 |
\ No newline at end of file |