Road toward uxnfor

This commit is contained in:
Devine Lu Linvega 2024-05-28 08:27:26 -07:00
parent 84bef276ee
commit 3872c8d272
1 changed files with 25 additions and 24 deletions

View File

@ -49,25 +49,25 @@ BRK
@on-control ( -> ) @on-control ( -> )
.Controller/key DEI .Controller/button DEI .Controller/key DEI .Controller/button DEI
( shortcuts ) ( | shortcuts )
DUP2 [ LIT2 "a 01 ] NEQ2 ?{ POP2 select-all BRK } DUP2 [ LIT2 "a 01 ] NEQ2 ?{ POP2 select-all BRK }
DUP2 [ LIT2 "x 01 ] NEQ2 ?{ POP2 edit-cut BRK } DUP2 [ LIT2 "x 01 ] NEQ2 ?{ POP2 edit-cut BRK }
DUP2 [ LIT2 "c 01 ] NEQ2 ?{ POP2 edit-copy BRK } DUP2 [ LIT2 "c 01 ] NEQ2 ?{ POP2 edit-copy BRK }
DUP2 [ LIT2 "v 01 ] NEQ2 ?{ POP2 edit-paste BRK } DUP2 [ LIT2 "v 01 ] NEQ2 ?{ POP2 edit-paste BRK }
( mask shift key ) ( | mask shift key )
#fb AND #fb AND
( arrows ) ( | arrows )
DUP #10 NEQ ?{ get-to #0001 SUB2 find-line-start select-variable } DUP #10 NEQ ?{ get-to #0001 SUB2 find-line-start select-variable }
DUP #20 NEQ ?{ get-to INC2 find-line-end select-variable } DUP #20 NEQ ?{ get-to INC2 find-line-end select-variable }
DUP #40 NEQ ?{ select-left } DUP #40 NEQ ?{ select-left }
DUP #80 NEQ ?{ select-right } DUP #80 NEQ ?{ select-right }
DUP #42 NEQ ?{ .selection/b LDZ2 #0001 SUB2 find-word-start select-variable } DUP #42 NEQ ?{ .selection/b LDZ2 #0001 SUB2 find-word-start select-variable }
DUP #82 NEQ ?{ .selection/b LDZ2 INC2 find-word-end select-variable } DUP #82 NEQ ?{ .selection/b LDZ2 INC2 find-word-end select-variable }
( pagination ) ( | pagination )
DUP #21 NEQ OVR #81 NEQ AND ?{ next-page } DUP #21 NEQ OVR #81 NEQ AND ?{ next-page }
DUP #11 NEQ OVR #41 NEQ AND ?{ prev-page } DUP #11 NEQ OVR #41 NEQ AND ?{ prev-page }
POP POP
( key ) ( | key )
DUP #08 NEQ ?{ erase } DUP #08 NEQ ?{ erase }
DUP #7f NEQ ?{ delete } DUP #7f NEQ ?{ delete }
DUP #09 LTH ?{ DUP insert } DUP #09 LTH ?{ DUP insert }
@ -163,7 +163,7 @@ BRK
POP JMP2r POP JMP2r
&has-space &has-space
( convert linebreaks ) ( | convert linebreaks )
DUP #0d EQU #03 MUL SUB DUP #0d EQU #03 MUL SUB
.selection/length LDZ2 #0000 EQU2 ?{ erase-selection } .selection/length LDZ2 #0000 EQU2 ?{ erase-selection }
@ -329,7 +329,7 @@ JMP2r
;notepad-txt file-size #0000 EQU2 ?file-new ;notepad-txt file-size #0000 EQU2 ?file-new
( load file ) ( | load file )
;notepad-txt .File/name DEO2 ;notepad-txt .File/name DEO2
#8000 .File/length DEO2 #8000 .File/length DEO2
@ -379,7 +379,7 @@ JMP2r
STH2 STH2
.File/name DEO2 .File/name DEO2
STH2kr .File/length DEO2 STH2kr .File/length DEO2
( erase when selection length ) ( | erase when selection length )
.selection/length LDZ2 #0000 EQU2 ?{ .selection/length LDZ2 #0000 EQU2 ?{
get-from get-eof .selection/length LDZ2 msfl get-from get-eof .selection/length LDZ2 msfl
} }
@ -463,7 +463,7 @@ JMP2r
#0008 .Screen/x DEO2 #0008 .Screen/x DEO2
#0018 .Screen/y DEO2 #0018 .Screen/y DEO2
( walk to line ) ( | walk to line )
.Mouse/y DEI2 pos-to-line ,&line STR .Mouse/y DEI2 pos-to-line ,&line STR
get-page get-page
&walk-line &walk-line
@ -471,7 +471,7 @@ JMP2r
walk-char POP walk-char POP
INC2 LDAk ?&walk-line INC2 LDAk ?&walk-line
&end-line &end-line
( walk to char ) ( | walk to char )
.Mouse/x DEI2 #0001 SUB2 ,&x STR2 .Mouse/x DEI2 #0001 SUB2 ,&x STR2
&walk-char &walk-char
.Screen/x DEI2 [ LIT2 &x $2 ] GTH2 ?&end-char .Screen/x DEI2 [ LIT2 &x $2 ] GTH2 ?&end-char
@ -483,10 +483,10 @@ JMP2r
@walk-char ( addr* -- addr* lb ) @walk-char ( addr* -- addr* lb )
( wrap ) ( | wrap )
LDAk #20 GTH ?&no-wrap LDAk #20 GTH ?&no-wrap
DUP2 word-width .Screen/x DEI2 ADD2 #00d0 LTH2 ?&no-wrap DUP2 word-width .Screen/x DEI2 ADD2 #00d0 LTH2 ?&no-wrap
( tabbed ) ( | tabbed )
DUP2 find-line-start LDA2 DUP2 find-line-start LDA2
DUP2 #093e NEQ2 ?{ DUP2 #093e NEQ2 ?{
POP2 #01 #0021 !draw-linebreak } POP2 #01 #0021 !draw-linebreak }
@ -495,14 +495,14 @@ JMP2r
POP2 POP2
#01 #0008 !draw-linebreak #01 #0008 !draw-linebreak
&no-wrap &no-wrap
( char ) ( | char )
LDAk char-width .Screen/x DEI2 ADD2 LDAk char-width .Screen/x DEI2 ADD2
.Screen/x DEO2 .Screen/x DEO2
( tab ) ( | tab )
LDAk #09 NEQ ?{ LDAk #09 NEQ ?{
#00 !draw-tab #00 !draw-tab
} }
( linebreak ) ( | linebreak )
LDAk #0a NEQ ?{ LDAk #0a NEQ ?{
#01 #0008 !draw-linebreak #01 #0008 !draw-linebreak
} }
@ -602,19 +602,19 @@ JMP2r
@draw-header ( -- ) @draw-header ( -- )
( a ) ( | a )
#0000 #0000
DUP2 .Screen/x DEO2 DUP2 .Screen/x DEO2
.Screen/y DEO2 .Screen/y DEO2
[ LIT2 15 -Screen/auto ] DEO [ LIT2 15 -Screen/auto ] DEO
;bar-icn/a .Screen/addr DEO2 ;bar-icn/a .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEO [ LIT2 01 -Screen/sprite ] DEO
( close ) ( | close )
;close-icn ;close-icn
#00 [ LIT2 00 -Mouse/state ] DEI NEQ .Mouse/x DEI2 #0008 SUB2 #000a LTH2 AND #00 [ LIT2 00 -Mouse/state ] DEI NEQ .Mouse/x DEI2 #0008 SUB2 #000a LTH2 AND
#50 SFT2 ADD2 .Screen/addr DEO2 #50 SFT2 ADD2 .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEOk DEO [ LIT2 01 -Screen/sprite ] DEOk DEO
( lead ) ( | lead )
#e9 &l #e9 &l
;bar-icn/b .Screen/addr DEO2 ;bar-icn/b .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEO [ LIT2 01 -Screen/sprite ] DEO
@ -622,12 +622,12 @@ JMP2r
POP POP
;bar-icn/b .Screen/addr DEO2 ;bar-icn/b .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEOk DEO [ LIT2 01 -Screen/sprite ] DEOk DEO
( title ) ( | title )
#004b .Screen/x DEO2 #004b .Screen/x DEO2
[ LIT2 86 -Screen/auto ] DEO [ LIT2 86 -Screen/auto ] DEO
;title-icn .Screen/addr DEO2 ;title-icn .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEOk DEO [ LIT2 01 -Screen/sprite ] DEOk DEO
( line ) ( | line )
[ LIT2 d2 -Screen/auto ] DEO [ LIT2 d2 -Screen/auto ] DEO
#0000 .Screen/x DEO2 #0000 .Screen/x DEO2
#0010 .Screen/y DEO2 #0010 .Screen/y DEO2
@ -644,6 +644,7 @@ JMP2r
#0000 .Screen/x DEO2 #0000 .Screen/x DEO2
#0018 .Screen/y DEO2 #0018 .Screen/y DEO2
[ LIT2 80 -Screen/pixel ] DEO [ LIT2 80 -Screen/pixel ] DEO
( >> )
@draw-note ( -- ) @draw-note ( -- )
@ -652,11 +653,11 @@ JMP2r
#0018 .Screen/y DEO2 #0018 .Screen/y DEO2
get-page get-page
&while &while
( draw char ) ( | draw char )
DUP2 #0001 SUB2 LDA2 char-addr .Screen/addr DEO2 DUP2 #0001 SUB2 LDA2 char-addr .Screen/addr DEO2
is-selected STH #0701 STHr [ JMP SWP POP ] .Screen/sprite DEOk DEO is-selected STH #0701 STHr [ JMP SWP POP ] .Screen/sprite DEOk DEO
.Screen/x DEI2k #0010 SUB2 ROT DEO2 .Screen/x DEI2k #0010 SUB2 ROT DEO2
( draw selector ) ( | draw selector )
get-from get-to NEQ2 ?&block get-from get-to NEQ2 ?&block
DUP2 get-from NEQ2 ?&block DUP2 get-from NEQ2 ?&block
;on-frame/last LDA #01 AND ?&block ;on-frame/last LDA #01 AND ?&block
@ -678,7 +679,7 @@ JMP2r
.Screen/height DEI2 #0020 SUB2 .Screen/y DEO2 .Screen/height DEI2 #0020 SUB2 .Screen/y DEO2
;page-icn .Screen/addr DEO2 ;page-icn .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEOk DEOk DEOk DEO [ LIT2 01 -Screen/sprite ] DEOk DEOk DEOk DEO
( across ) ( | across )
[ LIT2 01 -Screen/auto ] DEO [ LIT2 01 -Screen/auto ] DEO
#0018 .Screen/x DEO2 #0018 .Screen/x DEO2
.Screen/height DEI2 #0008 SUB2 .Screen/y DEO2 .Screen/height DEI2 #0008 SUB2 .Screen/y DEO2
@ -687,7 +688,7 @@ JMP2r
[ LIT2 01 -Screen/sprite ] DEO [ LIT2 01 -Screen/sprite ] DEO
INC DUP ?&l INC DUP ?&l
POP POP
( page number ) ( | page number )
[ LIT2 15 -Screen/auto ] DEO [ LIT2 15 -Screen/auto ] DEO
.Screen/width DEI2 #01 SFT2 #0003 SUB2 .Screen/x DEO2 .Screen/width DEI2 #01 SFT2 #0003 SUB2 .Screen/x DEO2
.Screen/height DEI2 #0020 SUB2 .Screen/y DEO2 .Screen/height DEI2 #0020 SUB2 .Screen/y DEO2