... | ... |
@@ -59,12 +59,12 @@ BRK |
59 | 59 |
,ctrl-end ~dev/ctrl #00 EQU JMP? POP2 |
60 | 60 |
|
61 | 61 |
,no-ctrl-down ~dev/ctrl #04 ROR #01 NEQ JMP? POP2 |
62 |
- ~position.y #0001 SUB2 =position.y |
|
63 |
- ,select JSR ,ctrl-end JMP |
|
62 |
+ ,move-up JSR |
|
63 |
+ ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
64 | 64 |
@no-ctrl-down |
65 | 65 |
,no-ctrl-up ~dev/ctrl #04 ROR #02 NEQ JMP? POP2 |
66 |
- ~position.y #0001 ADD2 =position.y |
|
67 |
- ,select JSR ,ctrl-end JMP |
|
66 |
+ ,get-position JSR ~position.y #0001 SUB2 =position.y ,select JSR |
|
67 |
+ ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
68 | 68 |
@no-ctrl-up |
69 | 69 |
,no-ctrl-left ~dev/ctrl #40 NEQ JMP? POP2 |
70 | 70 |
~selection.from #0001 SUB2 DUP2 =selection.from =selection.to |
... | ... |
@@ -85,6 +85,17 @@ BRK |
85 | 85 |
,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
86 | 86 |
@no-aright |
87 | 87 |
@no-alt |
88 |
+ ( ctrl ) |
|
89 |
+ ,no-ctrl ~dev/ctrl #0f AND #01 NEQ JMP? POP2 |
|
90 |
+ ,no-cleft ~dev/ctrl #04 ROR #04 NEQ JMP? POP2 |
|
91 |
+ ,find-linestart JSR #0001 ADD2 DUP2 =selection.from =selection.to |
|
92 |
+ ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
93 |
+ @no-cleft |
|
94 |
+ ,no-cright ~dev/ctrl #04 ROR #08 NEQ JMP? POP2 |
|
95 |
+ ,find-lineend JSR #0001 SUB2 DUP2 =selection.from =selection.to |
|
96 |
+ ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
97 |
+ @no-cright |
|
98 |
+ @no-ctrl |
|
88 | 99 |
|
89 | 100 |
@ctrl-end |
90 | 101 |
|
... | ... |
@@ -193,33 +204,79 @@ RTS |
193 | 204 |
|
194 | 205 |
RTS |
195 | 206 |
|
196 |
-@select |
|
207 |
+@find-linestart |
|
208 |
+ |
|
209 |
+ ~selection.from =j |
|
210 |
+ @goto-linestart-loop |
|
211 |
+ ~j |
|
212 |
+ ~j LDR #0a EQU RTS? |
|
213 |
+ ~j LDR #0d EQU RTS? |
|
214 |
+ POP2 |
|
215 |
+ ( decr ) ~j #0001 SUB2 =j |
|
216 |
+ ,goto-linestart-loop ~j LDR #00 NEQ JMP? POP2 |
|
217 |
+ |
|
218 |
+RTS |
|
219 |
+ |
|
220 |
+@find-lineend |
|
221 |
+ |
|
222 |
+ ~selection.from =j |
|
223 |
+ @goto-lineend-loop |
|
224 |
+ ( incr ) ~j #0001 ADD2 =j |
|
225 |
+ ~j |
|
226 |
+ ~j LDR #0a EQU RTS? |
|
227 |
+ ~j LDR #0d EQU RTS? |
|
228 |
+ POP2 |
|
229 |
+ ,goto-lineend-loop ~j LDR #00 NEQ JMP? POP2 |
|
230 |
+ |
|
231 |
+RTS |
|
232 |
+ |
|
233 |
+@move-up |
|
197 | 234 |
|
198 |
- ,document.body =j #0000 =pt.x #0000 =pt.y |
|
235 |
+ ,find-linestart JSR =selection.from |
|
236 |
+ ,find-lineend JSR =selection.to |
|
199 | 237 |
|
200 |
- @select-loop |
|
238 |
+RTS |
|
201 | 239 |
|
202 |
- ,no-reached ~pt.y ~position.y NEQ2 JMP? POP2 |
|
203 |
- ,no-reached ~pt.x ~position.x NEQ2 JMP? POP2 |
|
240 |
+@get-position ( selection -> position ) |
|
204 | 241 |
|
205 |
- ,no-ctrl-yes ~dev/ctrl #0f AND #01 NEQ JMP? POP2 |
|
206 |
- ~j =selection.to |
|
207 |
- RTS |
|
208 |
- @no-ctrl-yes |
|
242 |
+ ,document.body =j #0000 =position.x #0000 =position.y |
|
209 | 243 |
|
210 |
- ~j =selection.from |
|
211 |
- ~j #0001 ADD2 =selection.to |
|
212 |
- RTS |
|
213 |
- @no-reached |
|
244 |
+ @get-position-loop |
|
245 |
+ |
|
246 |
+ ,no-position-space ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP? POP2 |
|
247 |
+ ( incr ) ~position.y #0001 ADD2 =position.y |
|
248 |
+ #0000 =position.x |
|
249 |
+ @no-position-space |
|
214 | 250 |
|
215 |
- ,no-space ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP? POP2 |
|
251 |
+ ,no-position-reached ~j ~selection.from NEQ2 JMP? POP2 |
|
252 |
+ RTS |
|
253 |
+ @no-position-reached |
|
254 |
+ |
|
255 |
+ ( incr ) ~position.x #0001 ADD2 =position.x |
|
256 |
+ ( incr ) ~j #0001 ADD2 =j |
|
257 |
+ ,get-position-loop ~j LDR #00 NEQ JMP? POP2 |
|
258 |
+ |
|
259 |
+RTS |
|
260 |
+ |
|
261 |
+@select ( position -> selection ) |
|
262 |
+ |
|
263 |
+ ,document.body =selection.from #0000 =pt.x #0000 =pt.y |
|
264 |
+ |
|
265 |
+ @select-loop |
|
266 |
+ |
|
267 |
+ ,no-space ~selection.from LDR #0a NEQ ~selection.from LDR #0d NEQ #0101 EQU2 JMP? POP2 |
|
216 | 268 |
( incr ) ~pt.y #0001 ADD2 =pt.y |
217 | 269 |
#0000 =pt.x |
218 | 270 |
@no-space |
219 | 271 |
|
272 |
+ ,no-reached ~pt.y ~position.y #0001 SUB2 GTH2 ~pt.x ~position.x #0001 SUB2 GTH2 #0101 NEQ2 JMP? POP2 |
|
273 |
+ ~selection.from #0001 ADD2 =selection.to |
|
274 |
+ RTS |
|
275 |
+ @no-reached |
|
276 |
+ |
|
220 | 277 |
( incr ) ~pt.x #0001 ADD2 =pt.x |
221 |
- ( incr ) ~j #0001 ADD2 =j |
|
222 |
- ,select-loop ~j LDR #00 NEQ JMP? POP2 |
|
278 |
+ ( incr ) ~selection.from #0001 ADD2 =selection.from |
|
279 |
+ ,select-loop ~selection.from LDR #00 NEQ JMP? POP2 |
|
223 | 280 |
|
224 | 281 |
RTS |
225 | 282 |
|
... | ... |
@@ -333,11 +390,15 @@ RTS |
333 | 390 |
@draw-textarea-loop |
334 | 391 |
|
335 | 392 |
,no-linebreak ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP? POP2 |
393 |
+ ( draw linebreak ) |
|
394 |
+ ,linebreak_icn =dev/sprite.addr |
|
395 |
+ #02 =dev/sprite.color |
|
396 |
+ |
|
336 | 397 |
( fill clear ) |
337 | 398 |
@fill-clear |
399 |
+ ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x |
|
338 | 400 |
,font =dev/sprite.addr |
339 | 401 |
#01 =dev/sprite.color |
340 |
- ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x |
|
341 | 402 |
,fill-clear ~dev/sprite.x ~dev/screen.width #0008 SUB2 LTH2 JMP? POP2 |
342 | 403 |
#0010 =dev/sprite.x |
343 | 404 |
( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y |
... | ... |
@@ -475,6 +536,7 @@ RTS |
475 | 536 |
|
476 | 537 |
] |
477 | 538 |
|
539 |
+@linebreak_icn [ 003e 7474 3414 1400 ] |
|
478 | 540 |
@blank_icn [ 0000 0000 0000 0000 ] |
479 | 541 |
@cursor_icn [ 80c0 e0f0 f8e0 1000 ] |
480 | 542 |
@scrollbar_bg [ aa55 aa55 aa55 aa55 ] |