... | ... |
@@ -154,11 +154,11 @@ JMP2r |
154 | 154 |
( |
155 | 155 |
@|assets ) |
156 | 156 |
|
157 |
-@x-icn |
|
158 |
- 0000 0018 1800 0000 |
|
159 |
-@preview-chr |
|
160 |
- 0f38 675f dfbf bfbf 0007 1820 2344 4848 |
|
161 |
-@font-icn ( 0-f ) |
|
157 |
+@x-icn [ |
|
158 |
+ 0000 0018 1800 0000 ] |
|
159 |
+@preview-chr [ |
|
160 |
+ 0f38 675f dfbf bfbf 0007 1820 2344 4848 ] |
|
161 |
+@font-icn ( 0-f ) [ |
|
162 | 162 |
007c 8282 8282 827c 0030 1010 1010 1010 |
163 | 163 |
007c 8202 7c80 80fe 007c 8202 1c02 827c |
164 | 164 |
000c 1424 4484 fe04 00fe 8080 7c02 827c |
... | ... |
@@ -166,11 +166,11 @@ JMP2r |
166 | 166 |
007c 8282 7c82 827c 007c 8282 7e02 827c |
167 | 167 |
007c 8202 7e82 827e 00fc 8282 fc82 82fc |
168 | 168 |
007c 8280 8080 827c 00fc 8282 8282 82fc |
169 |
- 007c 8280 f080 827c 007c 8280 f080 8080 |
|
170 |
-@anim-chr |
|
169 |
+ 007c 8280 f080 827c 007c 8280 f080 8080 [ |
|
170 |
+@anim-chr [ |
|
171 | 171 |
0000 0018 1800 0000 c381 0000 0000 81c3 0000 183c 3c18 0000 0000 0000 0000 0000 |
172 | 172 |
0018 3c7e 7e3c 1800 0000 0000 0000 0000 3c7e ffe7 e7ff 7e3c 0000 0018 1800 0000 |
173 | 173 |
ffff e7c3 c3e7 ffff 0000 183c 3c18 0000 ffe7 c381 81c3 e7ff 0018 3c7e 7e3c 1800 |
174 | 174 |
c381 0000 0000 81c3 3c7e ffe7 e7ff 7e3c 0000 0000 0000 0000 ffff e7c3 c3e7 ffff |
175 |
- 0000 0000 0000 0000 ffe7 c381 81c3 e7ff |
|
175 |
+ 0000 0000 0000 0000 ffe7 c381 81c3 e7ff ] |
|
176 | 176 |
|
... | ... |
@@ -1,4 +1,5 @@ |
1 | 1 |
#include <stdlib.h> |
2 |
+#include <stdio.h> |
|
2 | 3 |
|
3 | 4 |
#include "../uxn.h" |
4 | 5 |
#include "screen.h" |
... | ... |
@@ -36,14 +37,9 @@ static void |
36 | 37 |
screen_fill(UxnScreen *p, Layer *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, Uint8 color) |
37 | 38 |
{ |
38 | 39 |
int x, y; |
39 |
- if(x2 >= p->width) x2 = p->width; |
|
40 |
- if(y2 >= p->height) y2 = p->height; |
|
41 |
- if(x1 >= x2 || y1 >= y2) |
|
42 |
- return; |
|
43 |
- for(y = y1; y < y2; y++) |
|
44 |
- for(x = x1; x < x2; x++) |
|
40 |
+ for(y = y1; y < y2 && y < p->height; y++) |
|
41 |
+ for(x = x1; x < x2 && x < p->width; x++) |
|
45 | 42 |
layer->pixels[x + y * p->width] = color; |
46 |
- layer->changed = 1; |
|
47 | 43 |
} |
48 | 44 |
|
49 | 45 |
static void |
... | ... |
@@ -135,13 +131,26 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port) |
135 | 131 |
screen_resize(&uxn_screen, uxn_screen.width, PEEK2(d + 4)); |
136 | 132 |
break; |
137 | 133 |
case 0xe: { |
138 |
- Uint16 x = PEEK2(d + 0x8), y = PEEK2(d + 0xa); |
|
139 |
- Layer *layer = (d[0xe] & 0x40) ? &uxn_screen.fg : &uxn_screen.bg; |
|
140 |
- if(d[0xe] & 0x80) { |
|
141 |
- Uint8 xflip = d[0xe] & 0x10, yflip = d[0xe] & 0x20; |
|
142 |
- screen_fill(&uxn_screen, layer, xflip ? 0 : x, yflip ? 0 : y, xflip ? x : uxn_screen.width, yflip ? y : uxn_screen.height, d[0xe] & 0x3); |
|
143 |
- } else { |
|
144 |
- screen_pixel(&uxn_screen, layer, x, y, d[0xe] & 0x3); |
|
134 |
+ Uint8 ctrl = d[0xe]; |
|
135 |
+ Uint8 color = ctrl & 0x3; |
|
136 |
+ Uint16 x = PEEK2(d + 0x8); |
|
137 |
+ Uint16 y = PEEK2(d + 0xa); |
|
138 |
+ Layer *layer = (ctrl & 0x40) ? &uxn_screen.fg : &uxn_screen.bg; |
|
139 |
+ /* fill mode */ |
|
140 |
+ if(ctrl & 0x80) { |
|
141 |
+ Uint16 x2 = uxn_screen.width; |
|
142 |
+ Uint16 y2 = uxn_screen.height; |
|
143 |
+ if(ctrl & 0x10) x2 = x, x = 0; |
|
144 |
+ if(ctrl & 0x20) y2 = y, y = 0; |
|
145 |
+ screen_fill(&uxn_screen, layer, x, y, x2, y2, color); |
|
146 |
+ layer->changed = 1; |
|
147 |
+ } |
|
148 |
+ /* pixel mode */ |
|
149 |
+ else { |
|
150 |
+ Uint16 width = uxn_screen.width; |
|
151 |
+ Uint16 height = uxn_screen.height; |
|
152 |
+ if(x < width && y < height) |
|
153 |
+ layer->pixels[x + y * width] = color; |
|
145 | 154 |
layer->changed = 1; |
146 | 155 |
if(d[0x6] & 0x1) POKE2(d + 0x8, x + 1); /* auto x+1 */ |
147 | 156 |
if(d[0x6] & 0x2) POKE2(d + 0xa, y + 1); /* auto y+1 */ |
... | ... |
@@ -149,11 +158,15 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port) |
149 | 158 |
break; |
150 | 159 |
} |
151 | 160 |
case 0xf: { |
152 |
- Uint16 x = PEEK2(d + 0x8), y = PEEK2(d + 0xa), dx, dy, addr = PEEK2(d + 0xc); |
|
153 |
- Uint8 i, n = d[0x6] >> 4, twobpp = !!(d[0xf] & 0x80); |
|
154 | 161 |
Layer *layer = (d[0xf] & 0x40) ? &uxn_screen.fg : &uxn_screen.bg; |
155 |
- dx = (d[0x6] & 0x01) << 3; |
|
156 |
- dy = (d[0x6] & 0x02) << 2; |
|
162 |
+ Uint16 x = PEEK2(d + 0x8); |
|
163 |
+ Uint16 y = PEEK2(d + 0xa); |
|
164 |
+ Uint16 addr = PEEK2(d + 0xc); |
|
165 |
+ Uint16 dx = (d[0x6] & 0x01) << 3; |
|
166 |
+ Uint16 dy = (d[0x6] & 0x02) << 2; |
|
167 |
+ Uint8 n = d[0x6] >> 4; |
|
168 |
+ Uint8 twobpp = !!(d[0xf] & 0x80); |
|
169 |
+ Uint8 i; |
|
157 | 170 |
if(addr > 0x10000 - ((n + 1) << (3 + twobpp))) |
158 | 171 |
return; |
159 | 172 |
for(i = 0; i <= n; i++) { |