...
|
...
|
@@ -46,24 +46,6 @@ screen_fill(Uint8 *layer, int x1, int y1, int x2, int y2, int color)
|
46
|
46
|
layer[x + y * width] = color;
|
47
|
47
|
}
|
48
|
48
|
|
49
|
|
-static void
|
50
|
|
-screen_blit(Uint8 *layer, Uint8 *ram, Uint16 addr, int x1, int y1, int color, int flipx, int flipy, int twobpp)
|
51
|
|
-{
|
52
|
|
- int v, h, width = uxn_screen.width, height = uxn_screen.height, opaque = (color % 5);
|
53
|
|
- for(v = 0; v < 8; v++) {
|
54
|
|
- Uint16 c = ram[(addr + v) & 0xffff] | (twobpp ? (ram[(addr + v + 8) & 0xffff] << 8) : 0);
|
55
|
|
- Uint16 y = y1 + (flipy ? 7 - v : v);
|
56
|
|
- for(h = 7; h >= 0; --h, c >>= 1) {
|
57
|
|
- Uint8 ch = (c & 1) | ((c >> 7) & 2);
|
58
|
|
- if(opaque || ch) {
|
59
|
|
- Uint16 x = x1 + (flipx ? 7 - h : h);
|
60
|
|
- if(x < width && y < height)
|
61
|
|
- layer[x + y * width] = blending[ch][color];
|
62
|
|
- }
|
63
|
|
- }
|
64
|
|
- }
|
65
|
|
-}
|
66
|
|
-
|
67
|
49
|
void
|
68
|
50
|
screen_palette(Uint8 *addr)
|
69
|
51
|
{
|
...
|
...
|
@@ -185,15 +167,28 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port)
|
185
|
167
|
Uint8 length = move >> 4;
|
186
|
168
|
Uint8 twobpp = !!(ctrl & 0x80);
|
187
|
169
|
Uint8 *layer = (ctrl & 0x40) ? uxn_screen.fg : uxn_screen.bg;
|
188
|
|
- Uint8 color = ctrl & 0xf;
|
|
170
|
+ Uint8 color = ctrl & 0xf, opaque = color % 5;
|
189
|
171
|
Uint16 x = PEEK2(d + 0x8), dx = (move & 0x1) << 3;
|
190
|
172
|
Uint16 y = PEEK2(d + 0xa), dy = (move & 0x2) << 2;
|
191
|
173
|
Uint16 addr = PEEK2(d + 0xc), addr_incr = (move & 0x4) << (1 + twobpp);
|
192
|
174
|
int flipx = (ctrl & 0x10), fx = flipx ? -1 : 1;
|
193
|
175
|
int flipy = (ctrl & 0x20), fy = flipy ? -1 : 1;
|
|
176
|
+ int v, h, width = uxn_screen.width, height = uxn_screen.height;
|
194
|
177
|
Uint16 dyx = dy * fx, dxy = dx * fy;
|
195
|
178
|
for(i = 0; i <= length; i++) {
|
196
|
|
- screen_blit(layer, ram, addr, x + dyx * i, y + dxy * i, color, flipx, flipy, twobpp);
|
|
179
|
+ Uint16 x1 = x + dyx * i, y1 = y + dxy * i;
|
|
180
|
+ for(v = 0; v < 8; v++) {
|
|
181
|
+ Uint16 c = ram[(addr + v) & 0xffff] | (twobpp ? (ram[(addr + v + 8) & 0xffff] << 8) : 0);
|
|
182
|
+ Uint16 y = y1 + (flipy ? 7 - v : v);
|
|
183
|
+ for(h = 7; h >= 0; --h, c >>= 1) {
|
|
184
|
+ Uint8 ch = (c & 1) | ((c >> 7) & 2);
|
|
185
|
+ if(opaque || ch) {
|
|
186
|
+ Uint16 x = x1 + (flipx ? 7 - h : h);
|
|
187
|
+ if(x < width && y < height)
|
|
188
|
+ layer[x + y * width] = blending[ch][color];
|
|
189
|
+ }
|
|
190
|
+ }
|
|
191
|
+ }
|
197
|
192
|
addr += addr_incr;
|
198
|
193
|
}
|
199
|
194
|
screen_change(x, y, x + dyx * length + 8, y + dxy * length + 8);
|