commit cfd2764992ff3281b5b050f6d7b33012e0d05940
parent 2ea562948de3ac9da5fd357f31756753178dd2bb
Author: neauoire <aliceffekt@gmail.com>
Date: Sun, 28 Feb 2021 11:41:28 -0800
Fixed issue in system device offset was wrong
Diffstat:
9 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/emulator.c b/emulator.c
@@ -181,6 +181,7 @@ loadtheme(Uint8 *addr)
theme[2] = ((r + (r << 4)) << 16) + ((g + (g << 4)) << 8) + (b + (b << 4));
r = *(addr + 1) & 0xf, g = *(addr + 3) & 0xf, b = *(addr + 5) & 0xf;
theme[3] = ((r + (r << 4)) << 16) + ((g + (g << 4)) << 8) + (b + (b << 4));
+ screen.reqdraw = 1;
}
void
@@ -371,7 +372,7 @@ sprite_poke(Uint8 *m, Uint16 ptr, Uint8 b0, Uint8 b1)
Uint8
system_poke(Uint8 *m, Uint16 ptr, Uint8 b0, Uint8 b1)
{
- printf("system_poke\n");
+ loadtheme(&m[0xfff8]);
return b1;
}
@@ -442,7 +443,7 @@ main(int argc, char **argv)
devkey = portuxn(&u, "key", ppnil, ppnil);
devmouse = portuxn(&u, "mouse", ppnil, ppnil);
- u.devices = 7;
+ u.devices = 15; /* pad to last device */
devsystem = portuxn(&u, "system", ppnil, system_poke);
/* Write screen size to dev/screen */
diff --git a/examples/blank.usm b/examples/blank.usm
@@ -21,5 +21,5 @@
|FF30 ;dev/ctrl Controller
|FF50 ;dev/mouse Mouse
-|FFF0 [ f2ac 35bb 2b53 ] ( palette )
-|FFFA .RESET .FRAME .ERROR
+|FFF0 .RESET .FRAME .ERROR ( vectors )
+|FFF8 [ f2ac 35bb 2b53 ] ( palette )
diff --git a/examples/dev.console.usm b/examples/dev.console.usm
@@ -25,5 +25,5 @@ RTS
|FF00 ;dev/console Console
-|FFF0 .RESET .FRAME .ERROR
+|FFF0 .RESET .FRAME .ERROR ( vectors )
|FFF8 [ f3f0 f30b f30a ] ( palette )
\ No newline at end of file
diff --git a/examples/dev.ctrl.usm b/examples/dev.ctrl.usm
@@ -75,5 +75,5 @@ RTS
|FF20 ;dev/sprite Sprite
|FF30 ;dev/ctrl Controller
-|FFF0 .RESET .FRAME .ERROR
+|FFF0 .RESET .FRAME .ERROR ( vectors )
|FFF8 [ 0daf 02ff 035f ] ( palette )
diff --git a/examples/dev.key.usm b/examples/dev.key.usm
@@ -130,5 +130,5 @@ RTS
|FF20 ;dev/sprite Sprite
|FF40 ;dev/key Keyboard
-|FFF0 .RESET .FRAME .ERROR
+|FFF0 .RESET .FRAME .ERROR ( vectors )
|FFF8 [ f0ff f00f f00f ] ( palette )
diff --git a/examples/dev.mouse.usm b/examples/dev.mouse.usm
@@ -231,5 +231,5 @@ RTS
|FF20 ;dev/sprite Sprite
|FF50 ;dev/mouse Mouse
-|FFF0 .RESET .FRAME .ERROR
+|FFF0 .RESET .FRAME .ERROR ( vectors )
|FFF8 [ 0f85 0fd5 0fb5 ] ( palette )
diff --git a/examples/dev.screen.usm b/examples/dev.screen.usm
@@ -3,6 +3,7 @@
&Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
&Sprite { pad 8 x 2 y 2 addr 2 color 1 }
+;timer 1
;centerx 2 ;centery 2 ;i 2 ;j 1
|0100 @RESET
@@ -47,7 +48,25 @@ BRK
@icon [ 3c7e e7c3 c3e7 7e3c ]
-|c000 @FRAME BRK
+|c000 @FRAME
+
+ ( update colors every 40 frames )
+ ~timer #40 NEQ ,skip1 ROT JMP? POP2
+ #0fac =fffa #f0bb =fffc #f053 =fff8
+ @skip1
+ ~timer #80 NEQ ,skip2 ROT JMP? POP2
+ #00fc =fffc #f0bb =fff8 #f053 =fffa
+ @skip2
+ ~timer #c0 NEQ ,skip3 ROT JMP? POP2
+ #000f =fff8 #0f0f =fffa #ff00 =fffc
+ @skip3
+ ~timer #00 NEQ ,skip4 ROT JMP? POP2
+ #f0ac =fff8 #f0bb =fffa #f053 =fffc
+ @skip4
+ ~timer #01 ADD =timer
+
+BRK
+
|d000 @ERROR BRK
|FF10 ;dev/screen Screen
diff --git a/examples/gui.picture.usm b/examples/gui.picture.usm
@@ -312,5 +312,5 @@ RTS
|FF10 ;dev/screen Screen
|FF20 ;dev/sprite Sprite
-|FFF0 .RESET .FRAME .ERROR
+|FFF0 .RESET .FRAME .ERROR ( vectors )
|FFF8 [ 0ffc 0f0b 0f03 ] ( palette )
diff --git a/uxn.h b/uxn.h
@@ -42,7 +42,7 @@ typedef struct {
Uint16 counter, vreset, vframe, verror;
Stack wst, rst;
Memory ram;
- Device dev[8];
+ Device dev[16];
} Uxn;
void setflag(Uint8 *status, char flag, int b);