| ... | ... |
@@ -3,13 +3,14 @@ |
| 3 | 3 |
|
| 4 | 4 |
|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
| 5 | 5 |
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
| 6 |
+|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 |
|
| 6 | 7 |
|
| 7 | 8 |
|0000 |
| 8 | 9 |
|
| 9 | 10 |
@center &x $2 &y $2 |
| 10 | 11 |
|
| 11 | 12 |
|0100 ( -> ) |
| 12 |
- |
|
| 13 |
+ |
|
| 13 | 14 |
( vector ) |
| 14 | 15 |
;on-frame .Screen/vector DEO2 |
| 15 | 16 |
( theme ) |
| ... | ... |
@@ -24,10 +25,10 @@ |
| 24 | 25 |
.Screen/width DEI2 #01 SFT2 .center/x STZ2 |
| 25 | 26 |
.Screen/height DEI2 #01 SFT2 .center/y STZ2 |
| 26 | 27 |
( draw ) |
| 27 |
- ;draw-size JSR2 |
|
| 28 |
- ;draw-sprites JSR2 |
|
| 29 |
- ;draw-1bpp JSR2 |
|
| 30 |
- ;draw-2bpp JSR2 |
|
| 28 |
+ draw-size |
|
| 29 |
+ draw-sprites |
|
| 30 |
+ draw-1bpp |
|
| 31 |
+ draw-2bpp |
|
| 31 | 32 |
|
| 32 | 33 |
BRK |
| 33 | 34 |
|
| ... | ... |
@@ -36,11 +37,24 @@ BRK |
| 36 | 37 |
|
| 37 | 38 |
@on-frame ( -> ) |
| 38 | 39 |
|
| 40 |
+ ( scroll background ) |
|
| 41 |
+ [ LIT2 &f $2 ] INC2k ,&f STR2 |
|
| 42 |
+ #01 SFT2 |
|
| 43 |
+ #001f AND2 |
|
| 44 |
+ #0040 SUB2 |
|
| 45 |
+ DUP2 .Screen/x DEO2 |
|
| 46 |
+ .Screen/y DEO2 |
|
| 47 |
+ ;patt-icn draw-fill |
|
| 48 |
+ |
|
| 39 | 49 |
.center/x LDZ2 #0070 SUB2 .Screen/x DEO2 |
| 40 | 50 |
.center/y LDZ2 #0048 SUB2 .Screen/y DEO2 |
| 41 |
- ;anim-chr #00 [ LIT &f $1 ] INCk ,&f STR |
|
| 42 |
- #02 SFT #07 AND #40 SFT ADD2 .Screen/addr DEO2 |
|
| 43 |
- #81 .Screen/sprite DEO |
|
| 51 |
+ ;anim-chr ,&f LDR2 #00ff AND2 #02 SFT #07 AND #40 SFT ADD2 .Screen/addr DEO2 |
|
| 52 |
+ #8f .Screen/sprite DEO |
|
| 53 |
+ |
|
| 54 |
+ draw-size |
|
| 55 |
+ draw-sprites |
|
| 56 |
+ draw-1bpp |
|
| 57 |
+ draw-2bpp |
|
| 44 | 58 |
|
| 45 | 59 |
BRK |
| 46 | 60 |
|
| ... | ... |
@@ -48,19 +62,19 @@ BRK |
| 48 | 62 |
@|drawing ) |
| 49 | 63 |
|
| 50 | 64 |
@draw-sprites ( -- ) |
| 51 |
- |
|
| 65 |
+ |
|
| 52 | 66 |
( horizontal ) |
| 53 | 67 |
.center/x LDZ2 #0060 SUB2 .Screen/x DEO2 |
| 54 | 68 |
.center/y LDZ2 #0048 SUB2 .Screen/y DEO2 |
| 55 | 69 |
;font-icn .Screen/addr DEO2 |
| 56 | 70 |
#f6 .Screen/auto DEO |
| 57 |
- #01 .Screen/sprite DEO |
|
| 71 |
+ #05 .Screen/sprite DEO |
|
| 58 | 72 |
( vertical ) |
| 59 | 73 |
.center/x LDZ2 #0070 SUB2 .Screen/x DEO2 |
| 60 | 74 |
.center/y LDZ2 #0038 SUB2 .Screen/y DEO2 |
| 61 | 75 |
;font-icn .Screen/addr DEO2 |
| 62 | 76 |
#f5 .Screen/auto DEO |
| 63 |
- #01 .Screen/sprite DEO |
|
| 77 |
+ #05 .Screen/sprite DEO |
|
| 64 | 78 |
( table ) |
| 65 | 79 |
#00 .Screen/auto DEO |
| 66 | 80 |
;preview-chr .Screen/addr DEO2 |
| ... | ... |
@@ -71,9 +85,9 @@ BRK |
| 71 | 85 |
( move ) #00 OVR #f0 AND #01 SFT |
| 72 | 86 |
.center/y LDZ2 #0038 SUB2 ADD2 .Screen/y DEO2 |
| 73 | 87 |
( draw ) DUP .Screen/sprite DEO |
| 74 |
- INC DUP ,&loop JCN |
|
| 88 |
+ INC DUP ?&loop |
|
| 75 | 89 |
POP |
| 76 |
- |
|
| 90 |
+ |
|
| 77 | 91 |
JMP2r |
| 78 | 92 |
|
| 79 | 93 |
@draw-1bpp ( -- ) |
| ... | ... |
@@ -85,10 +99,10 @@ JMP2r |
| 85 | 99 |
.center/y LDZ2 #0038 SUB2 ADD2 STH2 |
| 86 | 100 |
( x ) #00 OVR #03 AND #40 SFT2 #0040 ADD2 |
| 87 | 101 |
.center/x LDZ2 #0010 SUB2 ADD2 |
| 88 |
- STH2r STHr #00 ,draw-circle JSR |
|
| 89 |
- INC GTHk ,&loop JCN |
|
| 102 |
+ STH2r STHr #00 draw-circle |
|
| 103 |
+ INC GTHk ?&loop |
|
| 90 | 104 |
POP2 |
| 91 |
- |
|
| 105 |
+ |
|
| 92 | 106 |
JMP2r |
| 93 | 107 |
|
| 94 | 108 |
@draw-2bpp ( -- ) |
| ... | ... |
@@ -100,14 +114,14 @@ JMP2r |
| 100 | 114 |
.center/y LDZ2 #0008 ADD2 ADD2 STH2 |
| 101 | 115 |
( x ) #00 OVR #03 AND #40 SFT2 #0040 ADD2 |
| 102 | 116 |
.center/x LDZ2 #0010 SUB2 ADD2 |
| 103 |
- STH2r STHr #80 ,draw-circle JSR |
|
| 104 |
- INC GTHk ,&loop JCN |
|
| 117 |
+ STH2r STHr #80 draw-circle |
|
| 118 |
+ INC GTHk ?&loop |
|
| 105 | 119 |
POP2 |
| 106 |
- |
|
| 120 |
+ |
|
| 107 | 121 |
JMP2r |
| 108 | 122 |
|
| 109 | 123 |
@draw-circle ( x* y* color depth -- ) |
| 110 |
- |
|
| 124 |
+ |
|
| 111 | 125 |
ADD STH |
| 112 | 126 |
;preview-chr .Screen/addr DEO2 |
| 113 | 127 |
.Screen/y DEO2 |
| ... | ... |
@@ -123,12 +137,33 @@ JMP2r |
| 123 | 137 |
|
| 124 | 138 |
JMP2r |
| 125 | 139 |
|
| 140 |
+@draw-fill ( patt* color -- ) |
|
| 141 |
+ |
|
| 142 |
+ .Screen/addr DEO2 |
|
| 143 |
+ [ LIT2 01 -Screen/auto ] DEO |
|
| 144 |
+ .Screen/x DEI2 ,&anchor STR2 |
|
| 145 |
+ .Screen/width DEI2 #03 SFT2 NIP #08 ADD ,&x STR |
|
| 146 |
+ .Screen/height DEI2 #03 SFT2 NIP #08 ADD #00 |
|
| 147 |
+ &h |
|
| 148 |
+ DUP #02 SFT STH |
|
| 149 |
+ [ LIT &x $1 ] #00 |
|
| 150 |
+ &w |
|
| 151 |
+ DUP #02 SFT STHkr ADD #01 AND .Screen/sprite DEO |
|
| 152 |
+ INC GTHk ?&w |
|
| 153 |
+ .Screen/y DEI2k #0008 ADD2 ROT DEO2 |
|
| 154 |
+ [ LIT2 &anchor $2 ] .Screen/x DEO2 |
|
| 155 |
+ POP2 POPr |
|
| 156 |
+ INC GTHk ?&h |
|
| 157 |
+ POP2 |
|
| 158 |
+ |
|
| 159 |
+JMP2r |
|
| 160 |
+ |
|
| 126 | 161 |
@draw-size ( -- ) |
| 127 | 162 |
|
| 128 | 163 |
#01 .Screen/auto DEO |
| 129 | 164 |
.center/x LDZ2 #0030 ADD2 .Screen/x DEO2 |
| 130 | 165 |
.center/y LDZ2 #0048 SUB2 .Screen/y DEO2 |
| 131 |
- .Screen/width DEI2 ;draw-dec JSR2 |
|
| 166 |
+ .Screen/width DEI2 draw-dec |
|
| 132 | 167 |
;x-icn .Screen/addr DEO2 |
| 133 | 168 |
#01 .Screen/sprite DEO |
| 134 | 169 |
.Screen/height DEI2 |
| ... | ... |
@@ -136,13 +171,13 @@ JMP2r |
| 136 | 171 |
@draw-dec ( short* -- ) |
| 137 | 172 |
|
| 138 | 173 |
#00 ,&z STR |
| 139 |
- #2710 ,&parse JSR |
|
| 140 |
- #03e8 ,&parse JSR |
|
| 141 |
- #0064 ,&parse JSR |
|
| 142 |
- #000a ,&parse JSR |
|
| 174 |
+ #2710 draw-dec/parse |
|
| 175 |
+ #03e8 draw-dec/parse |
|
| 176 |
+ #0064 draw-dec/parse |
|
| 177 |
+ #000a draw-dec/parse |
|
| 143 | 178 |
NIP |
| 144 | 179 |
&emit |
| 145 |
- DUP [ LIT &z $1 ] EQU ,&skip JCN |
|
| 180 |
+ DUP [ LIT &z $1 ] EQU ?&skip |
|
| 146 | 181 |
#ff ,&z STR #00 OVR #30 SFT ;font-icn ADD2 .Screen/addr DEO2 |
| 147 | 182 |
#01 .Screen/sprite DEO |
| 148 | 183 |
&skip |
| ... | ... |
@@ -154,6 +189,8 @@ JMP2r |
| 154 | 189 |
( |
| 155 | 190 |
@|assets ) |
| 156 | 191 |
|
| 192 |
+@patt-icn [ |
|
| 193 |
+ aa55 aa55 aa55 aa55 ] |
|
| 157 | 194 |
@x-icn [ |
| 158 | 195 |
0000 0018 1800 0000 ] |
| 159 | 196 |
@preview-chr [ |
| ... | ... |
@@ -168,9 +205,13 @@ JMP2r |
| 168 | 205 |
007c 8280 8080 827c 00fc 8282 8282 82fc |
| 169 | 206 |
007c 8280 f080 827c 007c 8280 f080 8080 [ |
| 170 | 207 |
@anim-chr [ |
| 171 |
- 0000 0018 1800 0000 c381 0000 0000 81c3 0000 183c 3c18 0000 0000 0000 0000 0000 |
|
| 172 |
- 0018 3c7e 7e3c 1800 0000 0000 0000 0000 3c7e ffe7 e7ff 7e3c 0000 0018 1800 0000 |
|
| 173 |
- ffff e7c3 c3e7 ffff 0000 183c 3c18 0000 ffe7 c381 81c3 e7ff 0018 3c7e 7e3c 1800 |
|
| 174 |
- c381 0000 0000 81c3 3c7e ffe7 e7ff 7e3c 0000 0000 0000 0000 ffff e7c3 c3e7 ffff |
|
| 208 |
+ 0000 0018 1800 0000 c381 0000 0000 81c3 |
|
| 209 |
+ 0000 183c 3c18 0000 0000 0000 0000 0000 |
|
| 210 |
+ 0018 3c7e 7e3c 1800 0000 0000 0000 0000 |
|
| 211 |
+ 3c7e ffe7 e7ff 7e3c 0000 0018 1800 0000 |
|
| 212 |
+ ffff e7c3 c3e7 ffff 0000 183c 3c18 0000 |
|
| 213 |
+ ffe7 c381 81c3 e7ff 0018 3c7e 7e3c 1800 |
|
| 214 |
+ c381 0000 0000 81c3 3c7e ffe7 e7ff 7e3c |
|
| 215 |
+ 0000 0000 0000 0000 ffff e7c3 c3e7 ffff |
|
| 175 | 216 |
0000 0000 0000 0000 ffe7 c381 81c3 e7ff ] |
| 176 | 217 |
|
| ... | ... |
@@ -37,8 +37,6 @@ static void |
| 37 | 37 |
screen_blit(UxnScreen *s, Uint8 *pixels, Uint16 x1, Uint16 y1, Uint8 *ram, Uint16 addr, Uint8 color, Uint8 flipx, Uint8 flipy, Uint8 twobpp) |
| 38 | 38 |
{
|
| 39 | 39 |
int v, h, width = s->width, height = s->height, opaque = (color % 5) || !color; |
| 40 |
- if(!color) |
|
| 41 |
- return screen_fill(s, pixels, x1, y1, x1 + 8, y1 + 8, 0); |
|
| 42 | 40 |
for(v = 0; v < 8; v++) {
|
| 43 | 41 |
Uint16 c = ram[(addr + v) & 0xffff] | (twobpp ? (ram[(addr + v + 8) & 0xffff] << 8) : 0); |
| 44 | 42 |
Uint16 y = y1 + (flipy ? 7 - v : v); |