... | ... |
@@ -172,6 +172,20 @@ error(char *msg, const char *err) |
172 | 172 |
return 0; |
173 | 173 |
} |
174 | 174 |
|
175 |
+void |
|
176 |
+loadtheme(Uint8 *addr) |
|
177 |
+{ |
|
178 |
+ Uint8 r, g, b; |
|
179 |
+ r = *(addr + 0) >> 4 & 0xf, g = *(addr + 2) >> 4 & 0xf, b = *(addr + 4) >> 4 & 0xf; |
|
180 |
+ theme[0] = ((r + (r << 4)) << 16) + ((g + (g << 4)) << 8) + (b + (b << 4)); |
|
181 |
+ r = *(addr + 0) & 0xf, g = *(addr + 2) & 0xf, b = *(addr + 4) & 0xf; |
|
182 |
+ theme[1] = ((r + (r << 4)) << 16) + ((g + (g << 4)) << 8) + (b + (b << 4)); |
|
183 |
+ r = *(addr + 1) >> 4 & 0xf, g = *(addr + 3) >> 4 & 0xf, b = *(addr + 5) >> 4 & 0xf; |
|
184 |
+ theme[2] = ((r + (r << 4)) << 16) + ((g + (g << 4)) << 8) + (b + (b << 4)); |
|
185 |
+ r = *(addr + 1) & 0xf, g = *(addr + 3) & 0xf, b = *(addr + 5) & 0xf; |
|
186 |
+ theme[3] = ((r + (r << 4)) << 16) + ((g + (g << 4)) << 8) + (b + (b << 4)); |
|
187 |
+} |
|
188 |
+ |
|
175 | 189 |
void |
176 | 190 |
drawdebugger(Uint32 *dst, Uxn *u) |
177 | 191 |
{ |
... | ... |
@@ -307,6 +321,7 @@ screenr(Device *d, Memory *m, Uint8 b) |
307 | 321 |
case 2: return (HEIGHT >> 8) & 0xff; |
308 | 322 |
case 3: return HEIGHT & 0xff; |
309 | 323 |
} |
324 |
+ loadtheme(m->dat + 0xfff0); |
|
310 | 325 |
(void)m; |
311 | 326 |
return d->mem[b]; |
312 | 327 |
} |
... | ... |
@@ -355,6 +370,7 @@ start(Uxn *u) |
355 | 370 |
{ |
356 | 371 |
int ticknext = 0; |
357 | 372 |
evaluxn(u, u->vreset); |
373 |
+ loadtheme(u->ram.dat + 0xfff0); |
|
358 | 374 |
if(screen.reqdraw) |
359 | 375 |
redraw(pixels, u); |
360 | 376 |
while(1) { |
... | ... |
@@ -3,22 +3,23 @@ |
3 | 3 |
:dev/r fff8 ( std read port ) |
4 | 4 |
:dev/w fff9 ( std write port ) |
5 | 5 |
|
6 |
-;mousex 2 ;mousey 2 ;lastx 2 ;lasty 2 ;color 1 ;mode 1 ;state 1 ;brush 2 |
|
6 |
+;mousex 2 ;mousey 2 ;lastx 2 ;lasty 2 |
|
7 |
+;state 1 ;color 1 ;brush 2 |
|
7 | 8 |
|
8 | 9 |
|0100 @RESET |
9 | 10 |
|
10 | 11 |
#05 =dev/r ( set dev/read mouse ) |
11 | 12 |
#02 =dev/w ( set dev/write to sprite ) |
12 | 13 |
|
13 |
- #05 =color |
|
14 |
- ,draw-interface JSR |
|
15 |
- ,brush_large ,brush STR2 |
|
14 |
+ #05 =color ( select a default color ) |
|
15 |
+ ,brush_large ,brush STR2 ( select a default brush ) |
|
16 |
+ |
|
17 |
+ ,draw-interface JSR |
|
16 | 18 |
|
17 | 19 |
BRK |
18 | 20 |
|
19 | 21 |
|c000 @FRAME |
20 | 22 |
|
21 |
- #02 =dev/w ( set dev/write to sprite ) |
|
22 | 23 |
( clear last cursor ) |
23 | 24 |
#10 ,clear_icn ~lastx ~lasty ,draw-sprite JSR |
24 | 25 |
( record mouse values ) |
... | ... |
@@ -58,7 +59,7 @@ BRK |
58 | 59 |
~color ~brush ~mousex #0004 SUB2 ~mousey #0004 SUB2 ,draw-sprite JSR |
59 | 60 |
@end-touch |
60 | 61 |
|
61 |
- ~mousex =lastx ~mousey =lasty |
|
62 |
+ ~mousex =lastx ~mousey =lasty ( update last post ) |
|
62 | 63 |
|
63 | 64 |
BRK |
64 | 65 |
|
... | ... |
@@ -90,4 +91,5 @@ BRK |
90 | 91 |
|
91 | 92 |
|d000 @ERROR BRK |
92 | 93 |
|
94 |
+|FFF0 [ f2af 35bb 2b5f ] ( palette ) |
|
93 | 95 |
|FFFA .RESET .FRAME .ERROR |