... | ... |
@@ -65,11 +65,21 @@ ppu_write(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 color) |
65 | 65 |
int original = p->pixels[row]; |
66 | 66 |
Uint8 next = 0x0; |
67 | 67 |
if(x % 2) { |
68 |
- next |= original & 0xf0; |
|
69 |
- next |= color << (layer * 2); |
|
68 |
+ if(layer) { |
|
69 |
+ next |= original & 0xf3; |
|
70 |
+ next |= color << 0x02; |
|
71 |
+ } else { |
|
72 |
+ next |= original & 0xfc; |
|
73 |
+ next |= color; |
|
74 |
+ } |
|
70 | 75 |
} else { |
71 |
- next |= original & 0x0f; |
|
72 |
- next |= color << (4 + (layer * 2)); |
|
76 |
+ if(layer) { |
|
77 |
+ next |= original & 0x3f; |
|
78 |
+ next |= color << 0x06; |
|
79 |
+ } else { |
|
80 |
+ next |= original & 0xcf; |
|
81 |
+ next |= color << 0x04; |
|
82 |
+ } |
|
73 | 83 |
} |
74 | 84 |
p->pixels[row] = next; |
75 | 85 |
p->reqdraw = 1; |