commit c0b337e9330d0b576a3f2e6773e6dadb27b591b7
parent 928ed1e1c928625065b34c47987d2e3e2c6f4193
Author: neauoire <aliceffekt@gmail.com>
Date: Wed, 21 Apr 2021 12:00:31 -0700
ported dvd animation
Diffstat:
6 files changed, 92 insertions(+), 81 deletions(-)
diff --git a/build.sh b/build.sh
@@ -32,7 +32,7 @@ else
fi
echo "Assembling.."
-./bin/assembler projects/examples/dev.file.usm bin/boot.rom
+./bin/assembler projects/examples/gui.animation.usm bin/boot.rom
echo "Running.."
if [ "${2}" = '--cli' ];
diff --git a/projects/examples/gui.animation-old.usm b/projects/examples/gui.animation-old.usm
@@ -1,63 +0,0 @@
-( GUI Animation )
-
-;dvd { x 2 y 2 dx 1 dy 1 }
-
-|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
-
-( program )
-
-|0200
-
- ( theme ) #4cfd =System.r #4cf3 =System.g #dcf2 =System.b
- ( vectors ) ,on-frame =Screen.vector
- ( init ) ~Screen.width #0002 DIV2 =dvd.x
- ( init ) ~Screen.height #0002 DIV2 =dvd.y
-
-BRK
-
-@on-frame ( -> )
-
- ( clear ) #20 ,draw-dvd JSR2
- ( hit-right ) ~dvd.x ~Screen.width #0020 SUB2 EQU2
- ( hit-left ) ~dvd.x #0000 EQU2
- #0000 EQU2 ^$no-flipx JNZ
- ~dvd.dx #00 EQU =dvd.dx $no-flipx
- ( hit-bottom ) ~dvd.y ~Screen.height #0010 SUB2 EQU2
- ( hit-top ) ~dvd.y #0000 EQU2
- #0000 EQU2 ^$no-flipy JNZ
- ~dvd.dy #00 EQU =dvd.dy $no-flipy
- ( incr ) ~dvd.x #0001 #00 ~dvd.dx #00 EQU #fffe MUL2 ADD2 ADD2 =dvd.x
- ( incr ) ~dvd.y #0001 #00 ~dvd.dy #00 EQU #fffe MUL2 ADD2 ADD2 =dvd.y
- ( draw ) #21 ,draw-dvd JSR2
-
-BRK
-
-@draw-dvd ( color -- )
-
- ( stash color ) STH
- ,dvd_icn =Screen.addr
- ~dvd.y ~dvd.y #0010 ADD2
- $ver
- OVR2 =Screen.y
- ~dvd.x ~dvd.x #0020 ADD2
- $hor
- OVR2 =Screen.x
- ( draw ) DUPr STHr =Screen.color
- ( next ) ~Screen.addr #0008 ADD2 =Screen.addr
- ( incr ) SWP2 #0008 ADD2 SWP2
- OVR2 OVR2 LTH2 ^$hor JNZ
- POP2 POP2
- ( incr ) SWP2 #0008 ADD2 SWP2
- OVR2 OVR2 LTH2 ^$ver JNZ
- POP2 POP2
- ( destroy color ) POPr
-
-JMP2r
-
-@dvd_icn [
- 001f 3f38 3838 787f 00fe fe7e 7777 e3c3
- 000f 1f3b 7b77 e7c7 00fc fe8f 8707 0efc
- 7f00 000f ff7f 0700 0301 00ff f0f8 ff00
- 8700 00ff 7f7f ff00 f000 00e0 fcfc 8000
-]
-\ No newline at end of file
diff --git a/projects/examples/gui.animation.usm b/projects/examples/gui.animation.usm
@@ -0,0 +1,74 @@
+( GUI Animation )
+
+|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
+|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
+
+|0100
+
+@dvd [ &x $2 &y $2 &dx $1 &dy $1 ]
+
+( program )
+
+|0100 ( -> )
+
+ ( theme )
+ #4cfd .System/r DEO2
+ #4cf3 .System/g DEO2
+ #dcf2 .System/b DEO2
+
+ ( vectors )
+ ;on-frame .Screen/vector DEO2
+
+ ( starting position )
+ .Screen/width DEI2 #0002 DIV2 .dvd/x POK2
+ .Screen/height DEI2 #0002 DIV2 .dvd/y POK2
+
+ #21 ;draw-dvd JSR2
+
+BRK
+
+@on-frame ( -> )
+
+ ( clear ) #20 ;draw-dvd JSR2
+ ( hit-right ) .dvd/x PEK2 .Screen/width DEI2 #0020 SUB2 EQU2
+ ( hit-left ) .dvd/x PEK2 #0000 EQU2
+ #0000 EQU2 ,&no-flipx JNZ
+ .dvd/dx PEK #00 EQU .dvd/dx POK &no-flipx
+ ( hit-bottom ) .dvd/y PEK2 .Screen/height DEI2 #0010 SUB2 EQU2
+ ( hit-top ) .dvd/y PEK2 #0000 EQU2
+ #0000 EQU2 ,&no-flipy JNZ
+ .dvd/dy PEK #00 EQU .dvd/dy POK &no-flipy
+ ( incr ) .dvd/x PEK2 #0001 #00 .dvd/dx PEK #00 EQU #fffe MUL2 ADD2 ADD2 .dvd/x POK2
+ ( incr ) .dvd/y PEK2 #0001 #00 .dvd/dy PEK #00 EQU #fffe MUL2 ADD2 ADD2 .dvd/y POK2
+ ( draw ) #21 ;draw-dvd JSR2
+
+BRK
+
+@draw-dvd ( color -- )
+
+ ( stash color ) STH
+ ;dvd_icn .Screen/addr DEO2
+ .dvd/y PEK2 .dvd/y PEK2 #0010 ADD2
+ &ver
+ OVR2 .Screen/y DEO2
+ .dvd/x PEK2 .dvd/x PEK2 #0020 ADD2
+ &hor
+ OVR2 .Screen/x DEO2
+ ( draw ) DUPr STHr .Screen/color DEO
+ ( next ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
+ ( incr ) SWP2 #0008 ADD2 SWP2
+ OVR2 OVR2 LTH2 ,&hor JNZ
+ POP2 POP2
+ ( incr ) SWP2 #0008 ADD2 SWP2
+ OVR2 OVR2 LTH2 ,&ver JNZ
+ POP2 POP2
+ ( destroy color ) POPr
+
+JMP2r
+
+@dvd_icn [
+ 001f 3f38 3838 787f 00fe fe7e 7777 e3c3
+ 000f 1f3b 7b77 e7c7 00fc fe8f 8707 0efc
+ 7f00 000f ff7f 0700 0301 00ff f0f8 ff00
+ 8700 00ff 7f7f ff00 f000 00e0 fcfc 8000
+]
+\ No newline at end of file
diff --git a/projects/examples/dev.screen-old.usm b/projects/examples/old.dev.screen.usm
diff --git a/projects/examples/dev.time-old.usm b/projects/examples/old.dev.time.usm
diff --git a/src/ppu.c b/src/ppu.c
@@ -13,22 +13,22 @@ WITH REGARD TO THIS SOFTWARE.
#include "ppu.h"
static Uint8 font[][8] = {
- {0x00, 0x3c, 0x46, 0x4a, 0x52, 0x62, 0x3c, 0x00},
- {0x00, 0x18, 0x28, 0x08, 0x08, 0x08, 0x3e, 0x00},
- {0x00, 0x3c, 0x42, 0x02, 0x3c, 0x40, 0x7e, 0x00},
- {0x00, 0x3c, 0x42, 0x1c, 0x02, 0x42, 0x3c, 0x00},
- {0x00, 0x08, 0x18, 0x28, 0x48, 0x7e, 0x08, 0x00},
- {0x00, 0x7e, 0x40, 0x7c, 0x02, 0x42, 0x3c, 0x00},
- {0x00, 0x3c, 0x40, 0x7c, 0x42, 0x42, 0x3c, 0x00},
- {0x00, 0x7e, 0x02, 0x04, 0x08, 0x10, 0x10, 0x00},
- {0x00, 0x3c, 0x42, 0x3c, 0x42, 0x42, 0x3c, 0x00},
- {0x00, 0x3c, 0x42, 0x42, 0x3e, 0x02, 0x3c, 0x00},
- {0x00, 0x3c, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x00},
- {0x00, 0x7c, 0x42, 0x7c, 0x42, 0x42, 0x7c, 0x00},
- {0x00, 0x3c, 0x42, 0x40, 0x40, 0x42, 0x3c, 0x00},
- {0x00, 0x78, 0x44, 0x42, 0x42, 0x44, 0x78, 0x00},
- {0x00, 0x7e, 0x40, 0x7c, 0x40, 0x40, 0x7e, 0x00},
- {0x00, 0x7e, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x00}};
+ {0x00, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c},
+ {0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10},
+ {0x00, 0x7c, 0x82, 0x02, 0x7c, 0x80, 0x80, 0xfe},
+ {0x00, 0x7c, 0x82, 0x02, 0x1c, 0x02, 0x82, 0x7c},
+ {0x00, 0x0c, 0x14, 0x24, 0x44, 0x84, 0xfe, 0x04},
+ {0x00, 0xfe, 0x80, 0x80, 0x7c, 0x02, 0x82, 0x7c},
+ {0x00, 0x7c, 0x82, 0x80, 0xfc, 0x82, 0x82, 0x7c},
+ {0x00, 0x7c, 0x82, 0x02, 0x1e, 0x02, 0x02, 0x02},
+ {0x00, 0x7c, 0x82, 0x82, 0x7c, 0x82, 0x82, 0x7c},
+ {0x00, 0x7c, 0x82, 0x82, 0x7e, 0x02, 0x82, 0x7c},
+ {0x00, 0x7c, 0x82, 0x02, 0x7e, 0x82, 0x82, 0x7e},
+ {0x00, 0xfc, 0x82, 0x82, 0xfc, 0x82, 0x82, 0xfc},
+ {0x00, 0x7c, 0x82, 0x80, 0x80, 0x80, 0x82, 0x7c},
+ {0x00, 0xfc, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfc},
+ {0x00, 0x7c, 0x82, 0x80, 0xf0, 0x80, 0x82, 0x7c},
+ {0x00, 0x7c, 0x82, 0x80, 0xf0, 0x80, 0x80, 0x80}};
void
clear(Ppu *p)