(notepad) Starting text-editing
This commit is contained in:
parent
7d469ec9f1
commit
e174a4b3c4
|
@ -8,7 +8,8 @@
|
|||
|0000
|
||||
|
||||
@page $1
|
||||
@selection &from $2 &to $2
|
||||
@selection &from $2 &to $2 &length $2
|
||||
@textarea &length $2
|
||||
|
||||
|0100
|
||||
|
||||
|
@ -25,6 +26,8 @@
|
|||
;on-frame .Screen/vector DEO2
|
||||
;on-control .Controller/vector DEO2
|
||||
|
||||
;mem/end ;mem SUB2 .textarea/length STZ2
|
||||
|
||||
;mem select-from
|
||||
|
||||
draw-header
|
||||
|
@ -35,20 +38,12 @@ BRK
|
|||
@on-control ( -> )
|
||||
|
||||
.Controller/button DEI
|
||||
DUP #40 NEQ ?&no-l
|
||||
.selection/from LDZ2 #0001 SUB2 select-from
|
||||
&no-l
|
||||
DUP #80 NEQ ?&no-r
|
||||
.selection/from LDZ2 INC2 select-from
|
||||
&no-r
|
||||
DUP #44 NEQ ?&no-sl
|
||||
.selection/to LDZ2 #0001 SUB2 select-to
|
||||
&no-sl
|
||||
DUP #84 NEQ ?&no-sr
|
||||
.selection/to LDZ2 INC2 select-to
|
||||
&no-sr
|
||||
DUP #40 NEQ ?&no-l .selection/from LDZ2 #0001 SUB2 select-from &no-l
|
||||
DUP #80 NEQ ?&no-r .selection/from LDZ2 INC2 select-from &no-r
|
||||
DUP #44 NEQ ?&no-sl .selection/to LDZ2 #0001 SUB2 select-to &no-sl
|
||||
DUP #84 NEQ ?&no-sr .selection/to LDZ2 INC2 select-to &no-sr
|
||||
POP
|
||||
.Controller/key DEI ;mem sput
|
||||
.Controller/key DEI insert
|
||||
#00 ;on-frame/f STA
|
||||
redraw
|
||||
|
||||
|
@ -144,6 +139,89 @@ BRK
|
|||
|
||||
BRK
|
||||
|
||||
(
|
||||
@|editor )
|
||||
|
||||
@erase-selection ( -- )
|
||||
|
||||
.selection/from LDZ2 get-eof .selection/length LDZ2 msfl
|
||||
#0000 .selection/length LDZ2 SUB2
|
||||
|
||||
!mod-length
|
||||
|
||||
@insert ( char -- )
|
||||
|
||||
( move ) #fff0 get-eof SUB2 ORA ?&valid
|
||||
POP JMP2r
|
||||
&valid
|
||||
|
||||
( convert linebreaks )
|
||||
DUP #0d EQU #03 MUL SUB
|
||||
|
||||
.selection/length LDZ2 #0001 EQU2 ?&no-block
|
||||
erase-selection
|
||||
&no-block
|
||||
|
||||
.selection/from LDZ2 STH2k #0001 SUB2 get-eof #0001 msfr
|
||||
#0001 mod-length
|
||||
STH2kr STA
|
||||
STH2r INC2
|
||||
|
||||
!select-from
|
||||
|
||||
@erase ( -- )
|
||||
|
||||
.selection/length LDZ2 #0001 EQU2 ?&no-block
|
||||
erase-selection
|
||||
!reset-selection
|
||||
&no-block
|
||||
|
||||
.selection/from LDZ2 ;mem NEQ2 [ JMP JMP2r ]
|
||||
|
||||
.selection/from LDZ2 #0001 SUB2
|
||||
DUP2 cut-char
|
||||
|
||||
!select-from
|
||||
|
||||
@delete ( -- )
|
||||
|
||||
get-eof .selection/from LDZ2 SUB2 ORA #01 [ JCN JMP2r ]
|
||||
|
||||
.selection/length LDZ2 #0001 EQU2 ?&no-block
|
||||
erase-selection
|
||||
!reset-selection
|
||||
&no-block
|
||||
|
||||
.selection/from LDZ2 cut-char
|
||||
|
||||
!redraw
|
||||
|
||||
@get-eof ( -- addr* )
|
||||
|
||||
#a000
|
||||
|
||||
JMP2r
|
||||
|
||||
@cut-char ( addr* -- )
|
||||
|
||||
get-eof #0001 msfl
|
||||
#ffff
|
||||
|
||||
( >> )
|
||||
|
||||
@mod-length ( change* -- )
|
||||
|
||||
.textarea/length LDZ2 ADD2 .textarea/length STZ2
|
||||
|
||||
JMP2r
|
||||
|
||||
@reset-selection ( -- )
|
||||
|
||||
.selection/from LDZ2 select-from
|
||||
redraw
|
||||
|
||||
JMP2r
|
||||
|
||||
(
|
||||
@|core )
|
||||
|
||||
|
@ -222,6 +300,8 @@ JMP2r
|
|||
|
||||
DUP2 .selection/from STZ2
|
||||
.selection/to STZ2
|
||||
.selection/to LDZ2 .selection/from LDZ2 SUB2 .selection/length STZ2
|
||||
|
||||
redraw
|
||||
|
||||
JMP2r
|
||||
|
@ -369,6 +449,9 @@ JMP2r
|
|||
|
||||
JMP2r
|
||||
|
||||
@msfl ( b* a* len* -- ) STH2 SWP2 EQU2k ?&e &l DUP2k STH2kr ADD2 LDA ROT ROT STA INC2 GTH2k ?&l POP2 POP2 &e POP2r JMP2r
|
||||
@msfr ( b* a* len* -- ) STH2 EQU2k ?&e &l DUP2 LDAk ROT ROT STH2kr ADD2 STA #0001 SUB2 LTH2k ?&l POP2 POP2 &e POP2r JMP2r
|
||||
|
||||
@scap ( str* -- end* ) LDAk #00 NEQ [ JMP JMP2r ] &w INC2 LDAk ?&w JMP2r
|
||||
@sput ( chr str* -- ) scap INC2k #00 ROT ROT STA STA JMP2r
|
||||
|
||||
|
@ -560,6 +643,7 @@ JMP2r
|
|||
"Keep 20 "up 20 "to 20 "eight 20 "pages 20 "of 20 "notes 20 "in 20 "the 20 "Note 20 "Pad. 20
|
||||
"Click 20 "on 20 "the 20 "dog-ear 20 "to 20 "turn 20 "to 20 "the 20 "next 20 "following 20 "page. 20
|
||||
"Click 20 "in 20 "the 20 "lower 20 "left 20 "corner 20 "to 20 "turn 20 "to 20 "the 20 "next 20 "previous 20 "page.
|
||||
$1 &end
|
||||
|
||||
|a000 "The 20 "other 20 "page.
|
||||
|
||||
|
|
Loading…
Reference in New Issue