@@ 159,11 159,11 @@ BRK
.Controller/key DEI
DUP #1b EQU ?&escape
DUP .filepath skey ?&open
- #01 draw-filepath
POP
+ #01 draw-filepath
BRK
- &open ( c -- ) file-open ( , )
+ &open ( c -- ) file-open ( >> )
&escape ( c -- ) POP untrap BRK
@on-mouse-trap ( -> )
@@ 565,7 565,7 @@ JMP2r
@delete ( -- )
- get-eof .selection/from LDZ2 SUB2 ORA #01 [ JCN JMP2r ]
+ get-eof .selection/from LDZ2 SUB2 ORA #01 [ JCN JMP2r ]
.selection/length LDZ2 #0001 EQU2 ?&no-block
erase-selection
@@ 883,6 883,235 @@ JMP2r
JMP2r
(
+@|go )
+
+@go-directory ( -- )
+
+ #00 draw-filepath
+ ;filepath DUP2 scap #0001 SUB2 EQU2k ?&skip
+ &w
+ #0001 SUB2
+ LDAk LIT "/ NEQ ?&no-path
+ NIP2 ( null ) LITr 00 STH2 INC2r STAr
+ #0000 set-scroll-y !file-open
+ &no-path
+ NEQ2k ?&w
+ &skip
+ POP2
+ LIT2 ". 00 SWP2 STA2
+ #0000 set-scroll-y
+
+!file-open
+
+@go-selection ( -- )
+
+ .selection/from LDZ2 LDA2 [ LIT2 ".. ] EQU2 ?go-directory
+ .selection/length LDZ2 #0002 GTH2 [ JMP JMP2r ]
+
+ ( append to path, if path is folder )
+ [ LITr -filepath ]
+ #00 STHkr scap #0001 SUB2 LDAk LIT "/ NEQ ?&no-append
+ POPr INCk STH
+ &no-append
+ POP2
+
+ #00 draw-filepath
+ ( copy selection to filepath )
+ .selection/to LDZ2 .selection/from LDZ2
+ &w
+ ( end of buffer ) STHkr .filepath/end EQU ?&e
+ ( end of selection ) EQU2k ?&e
+ ( whitespace ) LDAk #21 LTH ?&e
+ LDAk STHkr STZ INC2 INCr !&w
+ &e
+ ( cap buffer ) #00 STHr STZ
+ POP2 POP2
+ #0000 set-scroll-y
+
+!file-open
+
+(
+@|document )
+
+@file-new ( -- )
+
+ #00 draw-filepath
+ ( clear )
+ ;text #fff8 OVR2 SUB2 mclr
+ #0000 .textarea/length STZ2
+ ( rename to untitled.txt )
+ ;&untitled-txt ;filepath scpy
+ ( reset position )
+ #01 draw-state
+ ;text select-start
+ #0000
+ DUP2 set-scroll-y
+ set-scroll-x
+ ( draw )
+ #01 draw-filepath
+ update-nav
+
+!draw-textarea
+ &untitled-txt "untitled.txt $1
+
+@file-open ( -- )
+
+ file-is-bin ?file-open-binary
+
+ ;text #ffff OVR2 SUB2 mclr
+ ;filepath .File/name DEO2
+ #fff0 ;text SUB2 .File/length DEO2
+ ;text .File/read DEO2
+ .File/success DEI2 .textarea/length STZ2
+
+ file-detect
+
+ ( draw )
+ reset-selection
+ #01 draw-filepath
+ #01
+
+!draw-state
+
+@file-open-binary ( -- )
+
+ #0000 .textarea/length STZ2
+
+ ;filepath .File/name DEO2
+ #0001 .File/length DEO2
+ #0000
+ &s
+ ;&b .File/read DEO2
+ .File/success DEI2 #0000 EQU2 ?&end
+ [ LIT &b $1 ] put-byte INC2
+ ( format )
+ DUP #01 AND ?&no-odd
+ DUP #0f AND #00 NEQ #16 MUL #0a ADD put-char &no-odd
+ !&s
+ &end
+ POP2
+ #0000 scroll-to
+ #0101 .textarea STZ2
+ reset-selection
+ #01 draw-filepath
+ #02
+
+!draw-state
+
+@file-save ( -- )
+
+ ;filepath .File/name DEO2
+ ;text
+ DUP2 slen .File/length DEO2
+ .File/write DEO2
+ #01
+
+!draw-state
+
+@file-detect ( -- )
+
+ file-is-dir ?&dir
+ file-is-tal ?&tal
+ #0100 .textarea STZ2
+
+JMP2r
+ &dir #0101 .textarea STZ2 JMP2r
+ &tal #0000 .textarea STZ2 JMP2r
+
+@file-is-dir ( -- bool )
+
+ ;filepath scap #0001 SUB2 LDA DUP LIT "/ EQU SWP LIT ". EQU ORA
+
+JMP2r
+
+@file-is-tal ( -- bool )
+
+ ;filepath scap #0004 SUB2 ;&tal-ext
+
+!scmp
+ &tal-ext ".tal $1
+
+@file-is-bin ( -- bool )
+
+ ;filepath .File/name DEO2
+ #0001 .File/length DEO2
+ &s
+ ;&b .File/read DEO2
+ .File/success DEI2 #0000 EQU2 ?&end
+ [ LIT &b $1 ] ?&no-null #01 JMP2r &no-null
+ !&s
+ &end
+ #00
+
+JMP2r
+
+(
+@|snarf )
+
+@snarf-txt ".snarf $1
+
+@edit-cut ( -- )
+
+ edit-copy
+ erase-selection
+
+!reset-selection
+
+@edit-copy ( -- )
+
+ .selection/length LDZ2 STH2k #0001 GTH2 ?&continue
+ POP2r JMP2r
+ &continue
+
+ ;snarf-txt .File/name DEO2
+ STH2r .File/length DEO2
+ .selection/from LDZ2 .File/write DEO2
+
+JMP2r
+
+@edit-paste ( -- )
+
+ ( get paste length )
+ ;snarf-txt .File/name DEO2
+ #00f0 .File/length DEO2
+ #fff0 .File/stat DEO2
+ #00 #fff4 STA
+ ( erase when selection length )
+ .selection/length LDZ2 #0001 EQU2 ?&no-selection
+ erase-selection
+ &no-selection
+ ( push right ) .selection/from LDZ2 #0001 SUB2
+ get-eof #fff0 shex STH2k msfr
+ STH2kr mod-length
+ ;snarf-txt .File/name DEO2
+ STH2kr .File/length DEO2
+ .selection/from LDZ2 .File/read DEO2
+ .selection/from LDZ2 STH2r ADD2
+
+!select-start
+
+@edit-select-at ( -- )
+
+ .selection/from LDZ2
+
+!select-word
+
+@edit-trim ( -- )
+
+ get-eof ;text
+ &l
+ LDA2k #0920 NEQ2 ?&no-ts INC2k cut-char &no-ts
+ LDA2k #2009 NEQ2 ?&no-st DUP2 cut-char &no-st
+ LDA2k #2020 NEQ2 ?&no-ss INC2k cut-char &no-ss
+ LDA2k #200a NEQ2 ?&no-sl DUP2 cut-char &no-sl
+ LDA2k #090a NEQ2 ?&no-tl DUP2 cut-char &no-tl
+ LDA2k #0a20 NEQ2 ?&no-ls INC2k cut-char &no-ls
+ INC2 GTH2k ?&l
+ POP2 POP2
+
+!reset-selection
+
+(
@|drawing )
@redraw-all ( -- )
@@ 1102,7 1331,7 @@ JMP2r
DUP
( addr ) get-chr .Screen/addr DEO2
( anchor ) get-chrw STHk .Screen/x DEI2 ADD2
- [ LIT2 &color 01 -Screen/sprite ] DEOk STHr #08 LTH [ JMP DEOk ] POP2
+ [ LIT2 &color 01 -Screen/sprite ] DEOk STHr #08 LTH [ JMP DEOk ] POP2
.Screen/x DEO2
JMP2r
@@ 1119,7 1348,7 @@ JMP2r
INC2
JMP2r
- &truncate LIT ". DUP draw-chr !draw-chr
+ &truncate [ LIT2 ".. ] draw-chr !draw-chr
@draw-filepath ( color -- )
@@ 1129,18 1358,18 @@ JMP2r
#0004 .Screen/y DEO2
;filepath draw-str POP2
-( , )
+( >> )
@draw-position ( color -- )
#05 get-catx
;filepath get-strw ADD2 .Screen/x DEO2
#0004 .Screen/y DEO2
- DUP ;draw-chr/color STA
+ ;draw-chr/color STA
LIT "~ draw-chr
- .scroll/y LDZ2 INC2 ROT ;draw-chr/color STA
+ .scroll/y LDZ2 INC2
-( , )
+( >> )
@draw-dec ( short* -- )
@@ 1162,235 1391,6 @@ JMP2r
JMP2r
(
-@|go )
-
-@go-directory ( -- )
-
- #00 draw-filepath
- ;filepath DUP2 scap #0001 SUB2 EQU2k ?&skip
- &w
- #0001 SUB2
- LDAk LIT "/ NEQ ?&no-path
- NIP2 ( null ) LITr 00 STH2 INC2r STAr
- #0000 set-scroll-y !file-open
- &no-path
- NEQ2k ?&w
- &skip
- POP2
- LIT2 ". 00 SWP2 STA2
- #0000 set-scroll-y
-
-!file-open
-
-@go-selection ( -- )
-
- .selection/from LDZ2 LDA2 [ LIT2 ".. ] EQU2 ?go-directory
- .selection/length LDZ2 #0002 GTH2 [ JMP JMP2r ]
-
- ( append to path, if path is folder )
- [ LITr -filepath ]
- #00 STHkr scap #0001 SUB2 LDAk LIT "/ NEQ ?&no-append
- POPr INCk STH
- &no-append
- POP2
-
- #00 draw-filepath
- ( copy selection to filepath )
- .selection/to LDZ2 .selection/from LDZ2
- &w
- ( end of buffer ) STHkr .filepath/end EQU ?&e
- ( end of selection ) EQU2k ?&e
- ( whitespace ) LDAk #21 LTH ?&e
- LDAk STHkr STZ INC2 INCr !&w
- &e
- ( cap buffer ) #00 STHr STZ
- POP2 POP2
- #0000 set-scroll-y
-
-!file-open
-
-(
-@|document )
-
-@file-new ( -- )
-
- #00 draw-filepath
- ( clear )
- ;text #fff8 OVR2 SUB2 mclr
- #0000 .textarea/length STZ2
- ( rename to untitled.txt )
- ;&untitled-txt ;filepath scpy
- ( reset position )
- #01 draw-state
- ;text select-start
- #0000
- DUP2 set-scroll-y
- set-scroll-x
- ( draw )
- #01 draw-filepath
- update-nav
-
-!draw-textarea
- &untitled-txt "untitled.txt $1
-
-@file-open ( -- )
-
- file-is-bin ?file-open-binary
-
- ;text #ffff OVR2 SUB2 mclr
- ;filepath .File/name DEO2
- #fff0 ;text SUB2 .File/length DEO2
- ;text .File/read DEO2
- .File/success DEI2 .textarea/length STZ2
-
- file-detect
-
- ( draw )
- reset-selection
- #01 draw-filepath
- #01
-
-!draw-state
-
-@file-open-binary ( -- )
-
- #0000 .textarea/length STZ2
-
- ;filepath .File/name DEO2
- #0001 .File/length DEO2
- #0000
- &s
- ;&b .File/read DEO2
- .File/success DEI2 #0000 EQU2 ?&end
- [ LIT &b $1 ] put-byte INC2
- ( format )
- DUP #01 AND ?&no-odd
- DUP #0f AND #00 NEQ #16 MUL #0a ADD put-char &no-odd
- !&s
- &end
- POP2
- #0000 scroll-to
- #0101 .textarea STZ2
- reset-selection
- #01 draw-filepath
- #02
-
-!draw-state
-
-@file-save ( -- )
-
- ;filepath .File/name DEO2
- ;text
- DUP2 slen .File/length DEO2
- .File/write DEO2
- #01
-
-!draw-state
-
-@file-detect ( -- )
-
- file-is-dir ?&dir
- file-is-tal ?&tal
- #0100 .textarea STZ2
-
-JMP2r
- &dir #0101 .textarea STZ2 JMP2r
- &tal #0000 .textarea STZ2 JMP2r
-
-@file-is-dir ( -- bool )
-
- ;filepath scap #0001 SUB2 LDA DUP LIT "/ EQU SWP LIT ". EQU ORA
-
-JMP2r
-
-@file-is-tal ( -- bool )
-
- ;filepath scap #0004 SUB2 ;&tal-ext
-
-!scmp
- &tal-ext ".tal $1
-
-@file-is-bin ( -- bool )
-
- ;filepath .File/name DEO2
- #0001 .File/length DEO2
- &s
- ;&b .File/read DEO2
- .File/success DEI2 #0000 EQU2 ?&end
- [ LIT &b $1 ] ?&no-null #01 JMP2r &no-null
- !&s
- &end
- #00
-
-JMP2r
-
-(
-@|snarf )
-
-@snarf-txt ".snarf $1
-
-@edit-cut ( -- )
-
- edit-copy
- erase-selection
-
-!reset-selection
-
-@edit-copy ( -- )
-
- .selection/length LDZ2 STH2k #0001 GTH2 ?&continue
- POP2r JMP2r
- &continue
-
- ;snarf-txt .File/name DEO2
- STH2r .File/length DEO2
- .selection/from LDZ2 .File/write DEO2
-
-JMP2r
-
-@edit-paste ( -- )
-
- ( get paste length )
- ;snarf-txt .File/name DEO2
- #00f0 .File/length DEO2
- #fff0 .File/stat DEO2
- #00 #fff4 STA
- ( erase when selection length )
- .selection/length LDZ2 #0001 EQU2 ?&no-selection
- erase-selection
- &no-selection
- ( push right ) .selection/from LDZ2 #0001 SUB2
- get-eof #fff0 shex STH2k msfr
- STH2kr mod-length
- ;snarf-txt .File/name DEO2
- STH2kr .File/length DEO2
- .selection/from LDZ2 .File/read DEO2
- .selection/from LDZ2 STH2r ADD2
-
-!select-start
-
-@edit-select-at ( -- )
-
- .selection/from LDZ2
-
-!select-word
-
-@edit-trim ( -- )
-
- get-eof ;text
- &l
- LDA2k #0920 NEQ2 ?&no-ts INC2k cut-char &no-ts
- LDA2k #2009 NEQ2 ?&no-st DUP2 cut-char &no-st
- LDA2k #2020 NEQ2 ?&no-ss INC2k cut-char &no-ss
- LDA2k #200a NEQ2 ?&no-sl DUP2 cut-char &no-sl
- LDA2k #090a NEQ2 ?&no-tl DUP2 cut-char &no-tl
- LDA2k #0a20 NEQ2 ?&no-ls INC2k cut-char &no-ls
- INC2 GTH2k ?&l
- POP2 POP2
-
-!reset-selection
-
-(
@|stdlib )
@scmp ( a* b* -- f ) STH2 &l LDAk LDAkr STHr ANDk #00 EQU ?&e NEQk ?&e POP2 INC2 INC2r !&l &e NIP2 POP2r EQU JMP2r