| ... | ... |
@@ -1,140 +1,97 @@ |
| 1 |
-( dev/screen ) |
|
| 1 |
+( Screen ) |
|
| 2 | 2 |
|
| 3 |
-%RTN { JMP2r }
|
|
| 4 |
-%2/ { #01 SFT }
|
|
| 5 |
-%4/ { #02 SFT }
|
|
| 6 |
- |
|
| 7 |
-%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
|
|
| 8 |
-%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
|
|
| 9 |
-%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
|
|
| 10 |
-%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
|
|
| 11 |
- |
|
| 12 |
-%AUTO-NONE { #00 .Screen/auto DEO }
|
|
| 13 |
-%AUTO-X { #01 .Screen/auto DEO }
|
|
| 14 |
-%AUTO-Y { #02 .Screen/auto DEO }
|
|
| 15 |
-%AUTO-XY { #03 .Screen/auto DEO }
|
|
| 16 |
-%AUTO-ADDR { #04 .Screen/auto DEO }
|
|
| 17 |
-%AUTO-XADDR { #05 .Screen/auto DEO }
|
|
| 18 |
-%AUTO-YADDR { #06 .Screen/auto DEO }
|
|
| 19 |
- |
|
| 20 |
-( devices ) |
|
| 21 |
- |
|
| 22 |
-|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ] |
|
| 23 |
-|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
| 24 |
- |
|
| 25 |
-( variables ) |
|
| 3 |
+|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
|
| 4 |
+|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
| 26 | 5 |
|
| 27 | 6 |
|0000 |
| 28 | 7 |
|
| 29 | 8 |
@count $2 |
| 30 |
-@center |
|
| 31 |
- &x $2 &y $2 |
|
| 32 |
- |
|
| 33 |
-( init ) |
|
| 9 |
+@center &x $2 &y $2 |
|
| 34 | 10 |
|
| 35 | 11 |
|0100 ( -> ) |
| 36 | 12 |
|
| 37 | 13 |
( vector ) |
| 38 | 14 |
;on-frame .Screen/vector DEO2 |
| 39 |
- |
|
| 40 | 15 |
( theme ) |
| 41 | 16 |
#f07f .System/r DEO2 |
| 42 | 17 |
#f0e0 .System/g DEO2 |
| 43 | 18 |
#f0c0 .System/b DEO2 |
| 44 |
- |
|
| 19 |
+ ( gba screen size 00c0 x 00a0 ) |
|
| 20 |
+ ( nds screen size 0100 x 00c0 ) |
|
| 21 |
+ #0100 .Screen/width DEO2 |
|
| 22 |
+ #00c0 .Screen/height DEO2 |
|
| 45 | 23 |
( find screen center ) |
| 46 |
- .Screen/width DEI2 #01 SFT2 #0020 -- .center/x STZ2 |
|
| 24 |
+ .Screen/width DEI2 #01 SFT2 .center/x STZ2 |
|
| 47 | 25 |
.Screen/height DEI2 #01 SFT2 .center/y STZ2 |
| 48 |
- |
|
| 49 | 26 |
( draw ) |
| 50 |
- ;draw-table JSR2 |
|
| 51 | 27 |
;draw-sprites JSR2 |
| 52 | 28 |
;draw-1bpp JSR2 |
| 53 | 29 |
;draw-2bpp JSR2 |
| 54 |
- ;draw-pixels JSR2 |
|
| 55 |
- ;draw-autobytes JSR2 |
|
| 56 |
- AUTO-NONE |
|
| 30 |
+ #00 .Screen/auto DEO |
|
| 57 | 31 |
|
| 58 | 32 |
BRK |
| 59 | 33 |
|
| 60 | 34 |
@on-frame ( -> ) |
| 61 | 35 |
|
| 62 |
- AUTO-X |
|
| 36 |
+ #01 .Screen/auto DEO |
|
| 63 | 37 |
.count LDZ2 INC2 [ DUP2 ] .count STZ2 |
| 64 |
- .center/x LDZ2 #0048 ++ .Screen/x DEO2 |
|
| 65 |
- .center/y LDZ2 #0050 -- .Screen/y DEO2 |
|
| 66 |
- SWP |
|
| 67 |
- DUP #04 SFT [ #00 SWP ] #30 SFT2 ;font-hex ++ .Screen/addr DEO2 |
|
| 68 |
- #01 .Screen/sprite DEO |
|
| 69 |
- #0f AND [ #00 SWP ] #30 SFT2 ;font-hex ++ .Screen/addr DEO2 |
|
| 70 |
- #01 .Screen/sprite DEO |
|
| 71 |
- DUP #04 SFT [ #00 SWP ] #30 SFT2 ;font-hex ++ .Screen/addr DEO2 |
|
| 72 |
- #01 .Screen/sprite DEO |
|
| 73 |
- #0f AND [ #00 SWP ] #30 SFT2 ;font-hex ++ .Screen/addr DEO2 |
|
| 74 |
- #01 .Screen/sprite DEO |
|
| 38 |
+ .center/x LDZ2 #0040 ADD2 .Screen/x DEO2 |
|
| 39 |
+ .center/y LDZ2 #0048 SUB2 .Screen/y DEO2 |
|
| 40 |
+ ;draw-short JSR2 |
|
| 75 | 41 |
|
| 76 | 42 |
BRK |
| 77 | 43 |
|
| 78 |
-@draw-table ( -- ) |
|
| 44 |
+@draw-sprites ( -- ) |
|
| 79 | 45 |
|
| 80 |
- .center/x LDZ2 #0040 -- .Screen/x DEO2 |
|
| 81 |
- .center/y LDZ2 #0050 -- .Screen/y DEO2 |
|
| 46 |
+ .center/x LDZ2 #0060 SUB2 .Screen/x DEO2 |
|
| 47 |
+ .center/y LDZ2 #0048 SUB2 .Screen/y DEO2 |
|
| 82 | 48 |
;font-hex .Screen/addr DEO2 |
| 83 | 49 |
#f6 .Screen/auto DEO |
| 84 | 50 |
#01 .Screen/sprite DEO |
| 85 |
- .center/x LDZ2 #0050 -- .Screen/x DEO2 |
|
| 86 |
- .center/y LDZ2 #0040 -- .Screen/y DEO2 |
|
| 87 |
- ;font-hex .Screen/addr DEO2 |
|
| 88 |
- #f5 .Screen/auto DEO |
|
| 89 |
- #01 .Screen/sprite DEO |
|
| 90 |
- AUTO-NONE |
|
| 91 |
- |
|
| 92 |
-RTN |
|
| 93 |
- |
|
| 94 |
-@draw-sprites ( -- ) |
|
| 95 |
- |
|
| 51 |
+ #00 .Screen/auto DEO |
|
| 52 |
+ ( table ) |
|
| 96 | 53 |
;preview_icn .Screen/addr DEO2 |
| 97 | 54 |
#00 #00 |
| 98 | 55 |
&loop |
| 99 |
- ( move ) DUP #0f AND #40 SFT 2/ #00 SWP |
|
| 100 |
- .center/x LDZ2 #0040 -- ++ .Screen/x DEO2 |
|
| 101 |
- ( move ) DUP #f0 AND 2/ #00 SWP |
|
| 102 |
- .center/y LDZ2 #0040 -- ++ .Screen/y DEO2 |
|
| 56 |
+ ( move ) DUP #0f AND #40 SFT #01 SFT #00 SWP |
|
| 57 |
+ .center/x LDZ2 #0060 SUB2 ADD2 .Screen/x DEO2 |
|
| 58 |
+ ( move ) DUP #f0 AND #01 SFT #00 SWP |
|
| 59 |
+ .center/y LDZ2 #0038 SUB2 ADD2 .Screen/y DEO2 |
|
| 103 | 60 |
( draw ) DUP .Screen/sprite DEO |
| 104 | 61 |
INC NEQk ,&loop JCN |
| 105 | 62 |
POP2 |
| 106 | 63 |
|
| 107 |
-RTN |
|
| 64 |
+JMP2r |
|
| 108 | 65 |
|
| 109 | 66 |
@draw-1bpp ( -- ) |
| 110 | 67 |
|
| 111 | 68 |
#10 #00 |
| 112 | 69 |
&loop |
| 113 | 70 |
( color ) STHk |
| 114 |
- ( y ) DUP 4/ [ #00 SWP ] #40 SFT2 |
|
| 115 |
- [ .center/y LDZ2 #0040 -- ++ ] STH2 |
|
| 116 |
- ( x ) DUP #03 AND [ #00 SWP ] #40 SFT2 #0040 ++ |
|
| 117 |
- [ .center/x LDZ2 #0008 ++ ++ ] |
|
| 71 |
+ ( y ) DUP #02 SFT [ #00 SWP ] #40 SFT2 |
|
| 72 |
+ [ .center/y LDZ2 #0038 SUB2 ADD2 ] STH2 |
|
| 73 |
+ ( x ) DUP #03 AND [ #00 SWP ] #40 SFT2 #0040 ADD2 |
|
| 74 |
+ [ .center/x LDZ2 #0020 SUB2 ADD2 ] |
|
| 118 | 75 |
STH2r STHr #00 ,draw-circle JSR |
| 119 | 76 |
INC GTHk ,&loop JCN |
| 120 | 77 |
POP2 |
| 121 | 78 |
|
| 122 |
-RTN |
|
| 79 |
+JMP2r |
|
| 123 | 80 |
|
| 124 | 81 |
@draw-2bpp ( -- ) |
| 125 | 82 |
|
| 126 | 83 |
#10 #00 |
| 127 | 84 |
&loop |
| 128 | 85 |
( color ) STHk |
| 129 |
- ( y ) DUP 4/ [ #00 SWP ] #40 SFT2 |
|
| 130 |
- [ .center/y LDZ2 ++ ] STH2 |
|
| 131 |
- ( x ) DUP #03 AND [ #00 SWP ] #40 SFT2 #0040 ++ |
|
| 132 |
- [ .center/x LDZ2 #0008 ++ ++ ] |
|
| 86 |
+ ( y ) DUP #02 SFT [ #00 SWP ] #40 SFT2 |
|
| 87 |
+ [ .center/y LDZ2 #0008 ADD2 ADD2 ] STH2 |
|
| 88 |
+ ( x ) DUP #03 AND [ #00 SWP ] #40 SFT2 #0040 ADD2 |
|
| 89 |
+ [ .center/x LDZ2 #0020 SUB2 ADD2 ] |
|
| 133 | 90 |
STH2r STHr #80 ,draw-circle JSR |
| 134 | 91 |
INC GTHk ,&loop JCN |
| 135 | 92 |
POP2 |
| 136 | 93 |
|
| 137 |
-RTN |
|
| 94 |
+JMP2r |
|
| 138 | 95 |
|
| 139 | 96 |
@draw-circle ( x* y* color depth -- ) |
| 140 | 97 |
|
| ... | ... |
@@ -142,56 +99,31 @@ RTN |
| 142 | 99 |
;preview_icn .Screen/addr DEO2 |
| 143 | 100 |
.Screen/y DEO2 |
| 144 | 101 |
.Screen/x DEO2 |
| 145 |
- AUTO-X |
|
| 102 |
+ #01 .Screen/auto DEO |
|
| 146 | 103 |
STHr .Screen/sprite DEOk |
| 147 |
- AUTO-Y |
|
| 148 |
- SWP #10 + SWP DEOk |
|
| 149 |
- .Screen/x DEI2k #0008 -- ROT DEO2 |
|
| 150 |
- AUTO-X |
|
| 151 |
- SWP #10 + SWP DEOk |
|
| 152 |
- SWP #10 + SWP DEO |
|
| 153 |
- |
|
| 154 |
-RTN |
|
| 155 |
- |
|
| 156 |
-@draw-autobytes ( -- ) |
|
| 157 |
- |
|
| 158 |
- .center/x LDZ2 #0090 ++ .Screen/x DEO2 |
|
| 159 |
- .center/y LDZ2 #0040 -- .Screen/y DEO2 |
|
| 160 |
- ;23x-icns .Screen/addr DEO2 |
|
| 161 |
- #16 .Screen/auto DEO |
|
| 162 |
- #04 .Screen/sprite DEOk DEOk DEO |
|
| 163 |
- |
|
| 164 |
- .center/x LDZ2 #00a8 ++ .Screen/x DEO2 |
|
| 165 |
- .center/y LDZ2 #0030 -- .Screen/y DEO2 |
|
| 166 |
- ;23y-icns .Screen/addr DEO2 |
|
| 167 |
- #25 .Screen/auto DEO |
|
| 168 |
- #0c .Screen/sprite DEOk DEO |
|
| 169 |
- |
|
| 170 |
- .center/x LDZ2 #00a0 ++ .Screen/x DEO2 |
|
| 171 |
- .center/y LDZ2 #0040 -- .Screen/y DEO2 |
|
| 172 |
- ;32x-icns .Screen/addr DEO2 |
|
| 173 |
- #26 .Screen/auto DEO |
|
| 174 |
- #01 .Screen/sprite DEOk DEO |
|
| 175 |
- |
|
| 176 |
- .center/x LDZ2 #0090 ++ .Screen/x DEO2 |
|
| 177 |
- .center/y LDZ2 #0028 -- .Screen/y DEO2 |
|
| 178 |
- ;32y-icns .Screen/addr DEO2 |
|
| 179 |
- #15 .Screen/auto DEO |
|
| 180 |
- #03 .Screen/sprite DEOk DEOk DEO |
|
| 181 |
- |
|
| 182 |
-RTN |
|
| 183 |
- |
|
| 184 |
-@draw-pixels ( -- ) |
|
| 185 |
- |
|
| 186 |
- .center/y LDZ2 #0040 -- .Screen/y DEO2 |
|
| 187 |
- .center/x LDZ2 #0048 ++ .Screen/x DEO2 |
|
| 188 |
- AUTO-X |
|
| 189 |
- #00 .Screen/pixel DEO |
|
| 190 |
- #01 .Screen/pixel DEO |
|
| 191 |
- #02 .Screen/pixel DEO |
|
| 192 |
- #03 .Screen/pixel DEO |
|
| 104 |
+ #02 .Screen/auto DEO |
|
| 105 |
+ SWP #10 ADD SWP DEOk |
|
| 106 |
+ .Screen/x DEI2k #0008 SUB2 ROT DEO2 |
|
| 107 |
+ #01 .Screen/auto DEO |
|
| 108 |
+ SWP #10 ADD SWP DEOk |
|
| 109 |
+ SWP #10 ADD SWP DEO |
|
| 110 |
+ |
|
| 111 |
+JMP2r |
|
| 112 |
+ |
|
| 113 |
+@draw-short ( short* -- ) |
|
| 193 | 114 |
|
| 194 |
-RTN |
|
| 115 |
+ SWP ,draw-byte JSR |
|
| 116 |
+ |
|
| 117 |
+@draw-byte ( byte -- ) |
|
| 118 |
+ |
|
| 119 |
+ DUP #04 SFT ,draw-hex JSR #0f AND |
|
| 120 |
+ |
|
| 121 |
+@draw-hex ( char -- ) |
|
| 122 |
+ |
|
| 123 |
+ #00 SWP #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 |
|
| 124 |
+ #01 .Screen/sprite DEO |
|
| 125 |
+ |
|
| 126 |
+JMP2r |
|
| 195 | 127 |
|
| 196 | 128 |
@preview_icn |
| 197 | 129 |
0f38 675f dfbf bfbf 0007 1820 2344 4848 |
| ... | ... |
@@ -205,23 +137,3 @@ RTN |
| 205 | 137 |
007c 8202 7e82 827e 00fc 8282 fc82 82fc |
| 206 | 138 |
007c 8280 8080 827c 00fc 8282 8282 82fc |
| 207 | 139 |
007c 8280 f080 827c 007c 8280 f080 8080 |
| 208 |
- |
|
| 209 |
-@23x-icns |
|
| 210 |
- 0010 2847 2810 0001 0000 00e0 2040 8000 |
|
| 211 |
- 0204 080f 0000 0001 0000 00e0 2040 8000 |
|
| 212 |
- 0204 080f 0000 0000 0010 28c4 2810 0000 |
|
| 213 |
- |
|
| 214 |
-@23y-icns |
|
| 215 |
- 0010 2844 2810 1111 1111 1111 1111 1111 |
|
| 216 |
- 1112 1418 0000 0000 0000 0030 5090 1010 |
|
| 217 |
- 1010 1010 1010 1010 1010 2844 2810 0000 |
|
| 218 |
- |
|
| 219 |
-@32x-icns |
|
| 220 |
- 0010 2847 2810 0001 0000 00ff 0000 00ff |
|
| 221 |
- 0000 00f0 1020 4080 0204 080f 0000 0000 |
|
| 222 |
- 0000 00ff 0000 0000 0010 28c4 2810 0000 |
|
| 223 |
- |
|
| 224 |
-@32y-icns |
|
| 225 |
- 0010 2844 2810 1011 1214 1800 0000 0000 |
|
| 226 |
- 0000 0000 3050 9011 1214 1800 0000 0000 |
|
| 227 |
- 0000 0000 3050 9010 1010 2844 2810 0000 |