... | ... |
@@ -3,19 +3,17 @@ |
3 | 3 |
|
4 | 4 |
TODO |
5 | 5 |
- Follow cursor when moving out of the screen |
6 |
- - Moving should using selection instead of position |
|
7 |
- - Slowdown ctrl keys |
|
8 | 6 |
- Save/Load |
9 | 7 |
- Select blank lines |
10 | 8 |
- Real scrolling distance |
11 | 9 |
- page up/down move with ctrl+arrow |
12 |
- - Select entire line by clicking line number |
|
13 |
- - Syntax highlight? |
|
14 | 10 |
- Double-click select word |
15 | 11 |
- Right-click find next instance of selection |
16 |
- - Mouse block selection |
|
12 |
+ - Mouse down selection |
|
17 | 13 |
- Copy/Cut/Paste |
18 | 14 |
- x scroll |
15 |
+ - Don't scroll past oef |
|
16 |
+ - Don't draw past eof |
|
19 | 17 |
) |
20 | 18 |
|
21 | 19 |
&Console { pad 8 stdio 1 } |
... | ... |
@@ -33,12 +31,14 @@ |
33 | 31 |
&Label2d { x 2 y 2 color 1 addr 2 } |
34 | 32 |
&Textarea2d { x1 2 y1 2 x2 2 y2 2 addr 2 cursor 1 } |
35 | 33 |
|
34 |
+;ctrl_lock 1 |
|
36 | 35 |
;selection Range2d |
37 | 36 |
;pt Point2d ;mouse Point2d ;position Point2d ;scroll Point2d |
38 | 37 |
;textarea Textarea2d |
39 | 38 |
;label Label2d |
40 | 39 |
;j 2 ;addr 2 |
41 | 40 |
|
41 |
+ |
|
42 | 42 |
|0100 @RESET |
43 | 43 |
|
44 | 44 |
( load file ) |
... | ... |
@@ -53,29 +53,39 @@ |
53 | 53 |
BRK |
54 | 54 |
|
55 | 55 |
@FRAME |
56 |
- |
|
56 |
+ |
|
57 | 57 |
( ctrl ) |
58 | 58 |
|
59 |
- ,ctrl-end ~dev/ctrl #00 EQU JMP? POP2 |
|
59 |
+ ,ctrl-end ~dev/ctrl #00 EQU ~ctrl_lock #00 NEQ #0000 NEQ2 JMP? POP2 |
|
60 | 60 |
|
61 |
- ,no-ctrl-down ~dev/ctrl #04 ROR #01 NEQ JMP? POP2 |
|
62 |
- ,move-up JSR |
|
63 |
- ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
64 |
- @no-ctrl-down |
|
65 |
- ,no-ctrl-up ~dev/ctrl #04 ROR #02 NEQ JMP? POP2 |
|
66 |
- ,get-position JSR ~position.y #0001 SUB2 =position.y ,select JSR |
|
67 |
- ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
61 |
+ ( lock ) #04 =ctrl_lock |
|
62 |
+ |
|
63 |
+ ,no-ctrl-up ~dev/ctrl #10 NEQ JMP? POP2 |
|
64 |
+ ,find-wordstart JSR DUP2 =selection.from #0001 ADD2 =selection.to |
|
65 |
+ ,redraw JSR ,ctrl-end JMP |
|
68 | 66 |
@no-ctrl-up |
67 |
+ ,no-ctrl-down ~dev/ctrl #20 NEQ JMP? POP2 |
|
68 |
+ ,find-wordend JSR DUP2 =selection.from #0001 ADD2 =selection.to |
|
69 |
+ ,redraw JSR ,ctrl-end JMP |
|
70 |
+ @no-ctrl-down |
|
69 | 71 |
,no-ctrl-left ~dev/ctrl #40 NEQ JMP? POP2 |
70 |
- ~selection.from #0001 SUB2 DUP2 =selection.from =selection.to |
|
71 |
- ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
72 |
+ ~selection.from #0001 SUB2 DUP2 =selection.from #0001 ADD2 =selection.to |
|
73 |
+ ,redraw JSR ,ctrl-end JMP |
|
72 | 74 |
@no-ctrl-left |
73 | 75 |
,no-ctrl-right ~dev/ctrl #80 NEQ JMP? POP2 |
74 |
- ~selection.from #0001 ADD2 DUP2 =selection.from =selection.to |
|
75 |
- ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
76 |
+ ~selection.from #0001 ADD2 DUP2 =selection.from #0001 ADD2 =selection.to |
|
77 |
+ ,redraw JSR ,ctrl-end JMP |
|
76 | 78 |
@no-ctrl-right |
77 | 79 |
( alt ) |
78 | 80 |
,no-alt ~dev/ctrl #0f AND #02 NEQ JMP? POP2 |
81 |
+ ,no-aup ~dev/ctrl #04 ROR #01 NEQ JMP? POP2 |
|
82 |
+ ,find-wordstart JSR =selection.to |
|
83 |
+ ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
84 |
+ @no-aup |
|
85 |
+ ,no-adown ~dev/ctrl #04 ROR #02 NEQ JMP? POP2 |
|
86 |
+ ,find-wordend JSR =selection.to |
|
87 |
+ ,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
|
88 |
+ @no-adown |
|
79 | 89 |
,no-aleft ~dev/ctrl #04 ROR #04 NEQ JMP? POP2 |
80 | 90 |
~selection.to #0001 SUB2 =selection.to |
81 | 91 |
,clamp-selection JSR ,redraw JSR ,ctrl-end JMP |
... | ... |
@@ -88,12 +98,10 @@ BRK |
88 | 98 |
( ctrl ) |
89 | 99 |
,no-ctrl ~dev/ctrl #0f AND #01 NEQ JMP? POP2 |
90 | 100 |
,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 |
|
101 |
+ ,goto-linestart JSR ,redraw JSR ,ctrl-end JMP |
|
93 | 102 |
@no-cleft |
94 | 103 |
,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 |
|
104 |
+ ,goto-lineend JSR ,redraw JSR ,ctrl-end JMP |
|
97 | 105 |
@no-cright |
98 | 106 |
@no-ctrl |
99 | 107 |
|
... | ... |
@@ -139,33 +147,37 @@ BRK |
139 | 147 |
|
140 | 148 |
( scrollbar ) |
141 | 149 |
,no-click-scroll ~dev/mouse.x ~dev/screen.width #0008 SUB2 LTH2 JMP? POP2 |
142 |
- |
|
143 | 150 |
,no-click-scroll-up ~dev/mouse.y #0008 GTH2 JMP? POP2 |
144 |
- ,scroll-up JSR |
|
145 |
- ,click-end JMP |
|
151 |
+ ( decr ) ~scroll.y #00 ~scroll.y #0000 NEQ2 SUB2 =scroll.y |
|
152 |
+ ,redraw JSR ,click-end JMP |
|
146 | 153 |
@no-click-scroll-up |
147 |
- |
|
148 | 154 |
,no-click-scroll-down ~dev/mouse.y ~dev/screen.height #0008 SUB2 LTH2 JMP? POP2 |
149 |
- ,scroll-down JSR |
|
150 |
- ,click-end JMP |
|
155 |
+ ( incr ) ~scroll.y #0001 ADD2 =scroll.y |
|
156 |
+ ,redraw JSR ,click-end JMP |
|
151 | 157 |
@no-click-scroll-down |
152 |
- |
|
153 | 158 |
( on scrollbar ) |
154 | 159 |
~dev/mouse.y #0008 SUB2 =scroll.y |
155 |
- ,redraw JSR |
|
156 |
- ,click-end JMP |
|
157 |
- |
|
160 |
+ ,redraw JSR ,click-end JMP |
|
158 | 161 |
@no-click-scroll |
159 | 162 |
|
163 |
+ ( line number ) |
|
164 |
+ ,no-click-line ~dev/mouse.x #0010 GTH2 JMP? POP2 |
|
165 |
+ ~dev/mouse.y #0008 DIV2 ~scroll.y ADD2 =position.y #0001 =position.x ,select JSR |
|
166 |
+ ,clamp-selection JSR ,redraw JSR ,click-end JMP |
|
167 |
+ @no-click-line |
|
168 |
+ |
|
160 | 169 |
( select body ) |
161 | 170 |
~dev/mouse.y #0008 DIV2 ~scroll.y ADD2 =position.y |
162 |
- ~dev/mouse.x ~textarea.x1 SUB2 #0008 ADD2 #0008 DIV2 =position.x |
|
171 |
+ ~dev/mouse.x ~textarea.x1 SUB2 #0007 ADD2 #0007 DIV2 =position.x |
|
163 | 172 |
|
164 | 173 |
,select JSR |
165 | 174 |
,redraw JSR |
166 | 175 |
|
167 | 176 |
@click-end |
168 | 177 |
|
178 |
+ ( decr ctrl lock ) |
|
179 |
+ ,skip-unlock ~ctrl_lock #00 EQU JMP? POP2 ~ctrl_lock #01 SUB =ctrl_lock @skip-unlock |
|
180 |
+ |
|
169 | 181 |
,draw-cursor JSR |
170 | 182 |
|
171 | 183 |
BRK |
... | ... |
@@ -197,43 +209,55 @@ RTS |
197 | 209 |
|
198 | 210 |
RTS |
199 | 211 |
|
200 |
-@scroll-down |
|
201 |
- |
|
202 |
- ( incr ) ~scroll.y #0001 ADD2 =scroll.y |
|
203 |
- ,redraw JSR |
|
212 |
+@goto-linestart |
|
204 | 213 |
|
205 |
-RTS |
|
214 |
+ @goto-linestart-loop |
|
215 |
+ ~selection.from #0001 SUB2 LDR #0a EQU RTS? |
|
216 |
+ ~selection.from #0001 SUB2 LDR #0d EQU RTS? |
|
217 |
+ ( decr ) ~selection.from DUP2 =selection.to #0001 SUB2 =selection.from |
|
218 |
+ ,goto-linestart-loop ~selection.from LDR #00 NEQ JMP? POP2 |
|
219 |
+ ( clamp at document body ) |
|
220 |
+ ~selection.from ,document.body GTH2 RTS? |
|
221 |
+ ,document.body DUP2 =selection.from #0001 ADD2 =selection.to |
|
206 | 222 |
|
207 |
-@find-linestart |
|
223 |
+RTS |
|
208 | 224 |
|
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 |
|
225 |
+@goto-lineend |
|
226 |
+ |
|
227 |
+ @goto-lineend-loop |
|
228 |
+ ~selection.from LDR #0a EQU RTS? |
|
229 |
+ ~selection.from LDR #0d EQU RTS? |
|
230 |
+ ( incr ) ~selection.from #0001 ADD2 DUP2 #0001 ADD2 =selection.to =selection.from |
|
231 |
+ ,goto-lineend-loop ~selection.from LDR #00 NEQ JMP? POP2 |
|
232 |
+ ( clamp at document body ) |
|
233 |
+ ~selection.from ,document.eof LTH2 RTS? |
|
234 |
+ ,document.eof #0001 SUB2 DUP2 =selection.from #0001 ADD2 =selection.to |
|
217 | 235 |
|
218 | 236 |
RTS |
219 | 237 |
|
220 |
-@find-lineend |
|
238 |
+@find-wordstart |
|
221 | 239 |
|
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 |
|
240 |
+ ~selection.to =j |
|
241 |
+ @find-wordstart-loop |
|
242 |
+ ( decr ) ~j #0001 SUB2 =j |
|
243 |
+ ,find-wordstart-end ~j LDR #20 EQU JMP? POP2 |
|
244 |
+ ,find-wordstart-end ~j LDR #0a EQU JMP? POP2 |
|
245 |
+ ,find-wordstart-end ~j LDR #0d EQU JMP? POP2 |
|
246 |
+ ,find-wordstart-loop ~j ,document.body GTH2 JMP? POP2 |
|
247 |
+ @find-wordstart-end ~j #0001 SUB2 |
|
230 | 248 |
|
231 | 249 |
RTS |
232 | 250 |
|
233 |
-@move-up |
|
251 |
+@find-wordend |
|
234 | 252 |
|
235 |
- ,find-linestart JSR =selection.from |
|
236 |
- ,find-lineend JSR =selection.to |
|
253 |
+ ~selection.to =j |
|
254 |
+ @find-wordend-loop |
|
255 |
+ ( incr ) ~j #0001 ADD2 =j |
|
256 |
+ ,find-wordend-end ~j LDR #20 EQU JMP? POP2 |
|
257 |
+ ,find-wordend-end ~j LDR #0a EQU JMP? POP2 |
|
258 |
+ ,find-wordend-end ~j LDR #0d EQU JMP? POP2 |
|
259 |
+ ,find-wordend-loop ~j ,document.body GTH2 JMP? POP2 |
|
260 |
+ @find-wordend-end ~j #0001 ADD2 |
|
237 | 261 |
|
238 | 262 |
RTS |
239 | 263 |
|
... | ... |
@@ -415,7 +439,7 @@ RTS |
415 | 439 |
#05 MUL ADD =dev/sprite.color |
416 | 440 |
|
417 | 441 |
( incr ) ~j #0001 ADD2 =j |
418 |
- ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x |
|
442 |
+ ( incr ) ~dev/sprite.x #0007 ADD2 =dev/sprite.x |
|
419 | 443 |
|
420 | 444 |
,draw-textarea-loop ~j LDR #00 NEQ JMP? POP2 |
421 | 445 |
|
... | ... |
@@ -545,8 +569,8 @@ RTS |
545 | 569 |
@arrowdown_icn [ 0010 1010 fe7c 3810 ] |
546 | 570 |
@load_icn [ feaa d6aa d4aa f400 ] |
547 | 571 |
@save_icn [ fe82 8282 848a f400 ] |
548 |
-@filepath1 [ test.txt 00 ] |
|
549 |
-@filepath [ projects/software/left.usm 00 ] |
|
572 |
+@filepath1 [ test.txt 00 ] |
|
573 |
+@filepath [ projects/software/left.usm 00 ] |
|
550 | 574 |
|
551 | 575 |
|4000 ;document Document |
552 | 576 |
|
... | ... |
@@ -561,4 +585,4 @@ RTS |
561 | 585 |
|FF60 ;dev/file File |
562 | 586 |
|
563 | 587 |
|FFF0 .RESET .FRAME .ERROR ( vectors ) |
564 |
-|FFF8 [ 40ff c09f a09f ] ( palette ) |
|
588 |
+|FFF8 [ a0fe a0f7 a0f2 ] ( palette ) |