... | ... |
@@ -3,62 +3,76 @@ |
3 | 3 |
&Screen { width 2 height 2 pad 4 x 2 y 2 color 1 } |
4 | 4 |
&Sprite { pad 8 x 2 y 2 addr 2 color 1 } |
5 | 5 |
&Keyboard { key 1 } |
6 |
+&Mouse { x 2 y 2 state 1 chord 1 } |
|
6 | 7 |
|
7 | 8 |
&Textarea2d { x1 2 y1 2 x2 2 y2 2 color 1 addr 2 cursor 1 } |
8 |
- |
|
9 |
-&Point2d { x 2 y 2 } |
|
10 | 9 |
&Rect2d { x1 2 y1 2 x2 2 y2 2 } |
10 |
+&Point2d { x 2 y 2 } |
|
11 | 11 |
|
12 |
+;mouse Point2d |
|
12 | 13 |
;textarea Textarea2d |
13 | 14 |
;rect Rect2d |
14 | 15 |
;color 1 |
16 |
+;blink 1 |
|
17 |
+;timer 1 |
|
15 | 18 |
|
16 | 19 |
|0100 @RESET |
17 | 20 |
|
18 |
- #0010 =textarea.x1 #0040 =textarea.y1 #00c0 =textarea.x2 #0090 =textarea.y2 ,body =textarea.addr |
|
21 |
+ #0080 =textarea.x1 #0060 =textarea.y1 #00c0 =textarea.x2 #0090 =textarea.y2 ,body =textarea.addr |
|
19 | 22 |
,redraw JSR |
23 |
+ ,redraw-window JSR |
|
20 | 24 |
|
21 | 25 |
BRK |
22 | 26 |
|
23 | 27 |
|0200 @FRAME |
24 | 28 |
|
25 |
- ~dev/key #00 EQU BRK? ( skip on no-key ) |
|
26 |
- |
|
27 |
- ( backspace ) |
|
28 |
- ,on-erase ~dev/key #08 EQU JMP? POP2 |
|
29 |
- |
|
30 |
- ( otherwise ) |
|
31 |
- |
|
32 |
- ~dev/key ~textarea.addr #00 ~textarea.cursor ADD2 STR |
|
33 |
- |
|
34 |
- ( incr ) ~textarea.cursor #01 ADD =textarea.cursor |
|
35 |
- |
|
36 |
- @input-end |
|
37 |
- |
|
38 |
- #00 =dev/key ( release key ) |
|
39 |
- |
|
40 |
- ,redraw JSR |
|
29 |
+ ,do-cursor JSR |
|
30 |
+ ,do-textarea JSR |
|
41 | 31 |
|
42 | 32 |
BRK |
43 | 33 |
|
44 |
-@redraw |
|
34 |
+@redraw-window |
|
45 | 35 |
|
46 |
- ~textarea.x1 ~textarea.y1 ~textarea.x2 ~textarea.y2 #01 ,fill-rect JSR |
|
47 |
- ~textarea.x1 ~textarea.y1 #0f ~textarea.addr ,draw-textarea JSR |
|
36 |
+ #0000 #0000 ~dev/screen.width ~dev/screen.height #01 ,pattern ,tile-rect JSR |
|
37 |
+ ( dropshadow ) |
|
38 |
+ ~textarea.x2 #0001 ADD2 ~textarea.y1 ~textarea.x2 #0004 ADD2 ~textarea.y2 #0004 ADD2 #01 ,fill-rect JSR |
|
39 |
+ ~textarea.x1 ~textarea.y2 #0001 ADD2 ~textarea.x2 #0001 ADD2 ~textarea.y2 #0004 ADD2 #01 ,fill-rect JSR |
|
40 |
+ ~textarea.x1 #0001 SUB2 ~textarea.y1 #0001 SUB2 ~textarea.x2 ~textarea.y2 #00 ,line-rect JSR |
|
48 | 41 |
~textarea.x1 #0002 SUB2 ~textarea.y1 #0002 SUB2 ~textarea.x2 #0001 ADD2 ~textarea.y2 #0001 ADD2 #01 ,line-rect JSR |
49 | 42 |
|
50 | 43 |
RTS |
51 | 44 |
|
52 |
-@on-erase |
|
45 |
+@redraw |
|
46 |
+ |
|
47 |
+ ~textarea.x1 ~textarea.y1 ~textarea.x2 ~textarea.y2 #01 ,fill-rect JSR |
|
48 |
+ ~textarea.x1 ~textarea.y1 #04 ~textarea.addr ,draw-textarea JSR |
|
49 |
+ |
|
50 |
+RTS |
|
51 |
+ |
|
52 |
+@blink-cursor |
|
53 | 53 |
|
54 |
- ( skip if cursor is at 0 ) |
|
55 |
- ,input-end ~textarea.cursor #01 LTH JMP? POP2 |
|
54 |
+ ,skip ~timer #10 LTH JMP? POP2 |
|
55 |
+ #00 =timer |
|
56 |
+ ~blink #00 EQU =blink |
|
57 |
+ ,cursor =dev/sprite.addr |
|
58 |
+ #05 ~blink ADD =dev/sprite.color |
|
59 |
+ @skip |
|
60 |
+ ~timer #01 ADD =timer |
|
56 | 61 |
|
57 |
- #00 ~dev/key ~textarea.addr #00 ~textarea.cursor ADD2 STR |
|
62 |
+RTS |
|
58 | 63 |
|
59 |
- ( decr ) ~textarea.cursor #01 SUB =textarea.cursor |
|
64 |
+@tile-rect ( x1 y1 x2 y2 color addr ) |
|
60 | 65 |
|
61 |
- BRK |
|
66 |
+ =dev/sprite.addr =color =rect.y2 =rect.x2 DUP2 =dev/sprite.y =rect.y1 DUP2 =dev/sprite.x =rect.x1 |
|
67 |
+ |
|
68 |
+ @tile-rect-ver |
|
69 |
+ ~rect.x1 =dev/sprite.x |
|
70 |
+ @tile-rect-hor |
|
71 |
+ ( draw ) ~color =dev/sprite.color |
|
72 |
+ ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x |
|
73 |
+ ,tile-rect-hor ~dev/sprite.x ~rect.x2 LTH2 JMP? POP2 |
|
74 |
+ ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y |
|
75 |
+ ,tile-rect-ver ~dev/sprite.y ~rect.y2 LTH2 JMP? POP2 |
|
62 | 76 |
|
63 | 77 |
RTS |
64 | 78 |
|
... | ... |
@@ -115,12 +129,66 @@ RTS |
115 | 129 |
|
116 | 130 |
RTS |
117 | 131 |
|
132 |
+@do-textarea |
|
133 |
+ |
|
134 |
+ ( ,blink-cursor JSR ) |
|
135 |
+ ,do-textarea-end ~dev/key #00 EQU JMP? POP2 ( skip on no key ) |
|
136 |
+ ( backspace ) |
|
137 |
+ ,any-key ~dev/key #08 NEQ JMP? POP2 |
|
138 |
+ ,input-end ~textarea.cursor #00 EQU JMP? POP2 |
|
139 |
+ ( decr ) ~textarea.cursor #01 SUB =textarea.cursor |
|
140 |
+ #00 ~textarea.addr #00 ~textarea.cursor ADD2 STR |
|
141 |
+ ,input-end JMP |
|
142 |
+ @any-key |
|
143 |
+ ~dev/key ~textarea.addr #00 ~textarea.cursor ADD2 STR |
|
144 |
+ ( incr ) ~textarea.cursor #01 ADD =textarea.cursor |
|
145 |
+ @input-end |
|
146 |
+ #00 =dev/key ( release key ) |
|
147 |
+ ,redraw JSR |
|
148 |
+ ( add cursor ) |
|
149 |
+ ,cursor =dev/sprite.addr |
|
150 |
+ #06 =dev/sprite.color |
|
151 |
+ @do-textarea-end |
|
152 |
+ |
|
153 |
+RTS |
|
154 |
+ |
|
155 |
+@do-cursor |
|
156 |
+ |
|
157 |
+ ,skip-drag ~dev/mouse.state #01 NEQ JMP? POP2 |
|
158 |
+ ~mouse.x =textarea.x1 ~mouse.y =textarea.y1 |
|
159 |
+ ,redraw-window JSR |
|
160 |
+ ,redraw JSR |
|
161 |
+ @skip-drag |
|
162 |
+ |
|
163 |
+ ~mouse.x ~dev/mouse.x NEQU2 |
|
164 |
+ ~mouse.y ~dev/mouse.y NEQU2 |
|
165 |
+ |
|
166 |
+ #0000 EQU2 RTS? ( Return if unchanged ) |
|
167 |
+ |
|
168 |
+ ( clear last cursor ) |
|
169 |
+ #10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR |
|
170 |
+ ( record mouse positions ) |
|
171 |
+ ~dev/mouse.x =mouse.x ~dev/mouse.y =mouse.y |
|
172 |
+ #12 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR |
|
173 |
+ |
|
174 |
+ |
|
175 |
+RTS |
|
176 |
+ |
|
177 |
+@draw-sprite |
|
178 |
+ |
|
179 |
+ =dev/sprite.y |
|
180 |
+ =dev/sprite.x |
|
181 |
+ =dev/sprite.addr |
|
182 |
+ =dev/sprite.color |
|
183 |
+ |
|
184 |
+RTS |
|
185 |
+ |
|
118 | 186 |
@font ( spectrum-zx font ) |
119 | 187 |
[ |
120 | 188 |
0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000 |
121 | 189 |
0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000 |
122 | 190 |
007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000 |
123 |
- 0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800 |
|
191 |
+ 0038 446c 107c 1000 0000 0000 0000 0000 003e 2222 2266 6600 0000 0822 0022 0800 |
|
124 | 192 |
0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800 |
125 | 193 |
003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038 |
126 | 194 |
0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000 |
... | ... |
@@ -151,13 +219,18 @@ RTS |
151 | 219 |
0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c |
152 | 220 |
] |
153 | 221 |
|
154 |
-@body [ ] |
|
222 |
+@clear_icn [ 0000 0000 0000 0000 ] |
|
223 |
+@cursor_icn [ 80c0 e0f0 f8e0 1000 ] |
|
224 |
+@pattern [ aa55 aa55 aa55 aa55 ] |
|
225 |
+@cursor [ 7e7e 7e7e 7e7e 7e7e ] |
|
226 |
+@body [ ] |
|
155 | 227 |
|
156 | 228 |
|d000 @ERROR BRK |
157 | 229 |
|
158 | 230 |
|FF10 ;dev/screen Screen |
159 | 231 |
|FF20 ;dev/sprite Sprite |
160 | 232 |
|FF40 ;dev/key Keyboard |
233 |
+|FF50 ;dev/mouse Mouse |
|
161 | 234 |
|
162 | 235 |
|FFF0 .RESET .FRAME .ERROR ( vectors ) |
163 |
-|FFF8 [ f0ff f00f f00f ] ( palette ) |
|
236 |
+|FFF8 [ f0ff f000 f00f ] ( palette ) |