Formatted

This commit is contained in:
Devine Lu Linvega 2024-05-28 08:36:49 -07:00
parent 98eb9cf1f7
commit 884f4a2b08
1 changed files with 204 additions and 419 deletions

View File

@ -5,15 +5,15 @@
|80 @Controller &vector $2 &button $1 &key $1 |80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 |90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1
|a0 @File &vector $2 &success $1 &success-lb $1 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |a0 @File &vector $2 &success $1 &success-lb $1 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|000 |000
@page $1 @page $1
@collapsed $1 @collapsed $1
@selection &a $2 &b $2 &length $2 @selection &a $2 &b $2 &length $2
|100 @on-reset ( -> ) |100
@on-reset ( -> )
( | meta ) ( | meta )
;meta #06 DEO2 ;meta #06 DEO2
( | theme ) ( | theme )
@ -29,40 +29,39 @@
;on-frame .Screen/vector DEO2 ;on-frame .Screen/vector DEO2
;on-control .Controller/vector DEO2 ;on-control .Controller/vector DEO2
( | let's go! ) ( | let's go! )
file-init file-init <draw-header>
draw-header #00 change-page BRK
#00 change-page
BRK
@meta 00 @meta 00
( name ) "Note 20 "Pad 0a ( name ) "Note 20 "Pad 0a
( details ) "Original 20 "by 20 "Donn 20 "Denman 0a ( details ) "Original 20 "by 20 "Donn 20 "Denman 0a
( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a ( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
( date ) "May 20 "28, 20 "2024 00 ( date ) "May 20 "28, 20 "2024 00 01
01 ( icon ) 83 =appicon
( icon ) 83 =appicon
( (
@|vectors ) @|vectors )
@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 ?{
DUP #20 NEQ ?{ get-to INC2 find-line-end select-variable } get-to #0001 SUB2 find-line-start <select-variable> }
DUP #40 NEQ ?{ select-left } DUP #20 NEQ ?{ get-to INC2 find-line-end <select-variable> }
DUP #80 NEQ ?{ select-right } DUP #40 NEQ ?{ <select-left> }
DUP #42 NEQ ?{ .selection/b LDZ2 #0001 SUB2 find-word-start select-variable } DUP #80 NEQ ?{ <select-right> }
DUP #82 NEQ ?{ .selection/b LDZ2 INC2 find-word-end 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> }
( | 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 }
@ -71,556 +70,347 @@ BRK
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 }
POP POP #00 ;on-frame/f STA
#00 ;on-frame/f STA BRK
BRK
@on-mouse-head ( -> ) @on-mouse-head ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn <update-cursor>
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn update-cursor
.Mouse/state DEI #01 GTH .Mouse/y DEI2 #0012 LTH2 AND ?&toggle-collapse .Mouse/state DEI #01 GTH .Mouse/y DEI2 #0012 LTH2 AND ?&toggle-collapse
<trap-mouse>
trap-mouse [ LIT &last $1 ] .Mouse/state DEI DUP ,&last STR
[ LIT &last $1 ]
.Mouse/state DEI
DUP ,&last STR
EQU ?&unchanged EQU ?&unchanged
draw-header <draw-header>
( release on close button ) ( release on close button ) .Mouse/state DEI ?&unchanged
.Mouse/state DEI ?&unchanged
.Mouse/x DEI2 #0008 SUB2 #000a GTH2 ?&unchanged .Mouse/x DEI2 #0008 SUB2 #000a GTH2 ?&unchanged
( exit ) #800f DEO ( exit ) #800f DEO
&unchanged &unchanged BRK
&toggle-collapse ( -> )
BRK #00f8 #0011 .collapsed LDZ ?{ SWP2 }
POP2 .Screen/height DEO2
&toggle-collapse ( -> )
#00f8 #0011
.collapsed LDZ ?{ SWP2 }
POP2 .Screen/height DEO2
[ LIT2 00 -collapsed ] LDZ EQU .collapsed STZ [ LIT2 00 -collapsed ] LDZ EQU .collapsed STZ
draw-header <draw-header>
redraw <redraw>
[ LIT2 00 -Mouse/state ] DEO [ LIT2 00 -Mouse/state ] DEO
BRK
BRK
@on-mouse-body ( -> ) @on-mouse-body ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;caret-icn <update-cursor>
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;caret-icn update-cursor <trap-mouse>
[ LIT &last $1 ] .Mouse/state DEI DUP #02 LTH ?{ get-position <select-word> }
trap-mouse DUP2 #0001 NEQ2 ?{ get-position <select-variable> }
DUP2 #0101 NEQ2 ?{ get-position <select-to> }
[ LIT &last $1 ] .Mouse/state DEI ,&last STR
DUP #02 LTH ?{ get-position select-word } POP BRK
DUP2 #0001 NEQ2 ?{ get-position select-variable }
DUP2 #0101 NEQ2 ?{ get-position select-to }
,&last STR POP
BRK
@on-mouse-foot ( -> ) @on-mouse-foot ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn <update-cursor>
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn update-cursor <trap-mouse>
trap-mouse
[ LIT2 00 -Mouse/state ] DEI NEQ .Mouse/x DEI2 #0018 LTH2 AND ?&on-mouse-down [ LIT2 00 -Mouse/state ] DEI NEQ .Mouse/x DEI2 #0018 LTH2 AND ?&on-mouse-down
BRK
BRK &on-mouse-down ( -> )
&on-mouse-down ( -> )
[ LIT2 00 -Mouse/state ] DEO [ LIT2 00 -Mouse/state ] DEO
.Mouse/y DEI2 #00d6 SUB2 NIP [ LIT2 18 -Mouse/x ] DEI2 NIP SUB ADD #18 LTH ?&go-next
.Mouse/y DEI2 #00d6 SUB2 NIP prev-page BRK &go-next next-page BRK
[ LIT2 18 -Mouse/x ] DEI2 NIP SUB
ADD #18 LTH ?&go-next
prev-page BRK
&go-next
next-page
BRK
@on-frame ( -> ) @on-frame ( -> )
[ LIT2 &last $1 &f $1 ] INCk ,&f STR [ LIT2 &last $1 &f $1 ] INCk ,&f STR
#05 SFT DUP ,&last STR #05 SFT DUP ,&last STR
EQU ?{ draw-note } EQU ?{ <draw-note> }
BRK
BRK
( (
@|editor ) @|editor )
@insert ( char -- ) @insert ( char -- )
get-from scap/ get-page #1000 ADD2 LTH2 ?{ POP JMP2r }
get-from scap/ get-page #1000 ADD2 LTH2 ?{
POP JMP2r
}
( | convert linebreaks ) ( | convert linebreaks )
DUP #0d EQU #03 MUL SUB DUP #0d EQU #03 MUL SUB .selection/length LDZ2 #0000 EQU2 ?{ erase-selection }
get-from STH2k #0001 SUB2 get-eof #0001 <msfr>
.selection/length LDZ2 #0000 EQU2 ?{ erase-selection }
get-from STH2k #0001 SUB2 get-eof #0001 msfr
STH2kr STA STH2kr STA
STH2r INC2 select-from STH2r INC2 <select-from>
!file-save
!file-save
@erase ( -- ) @erase ( -- )
.selection/length LDZ2 #0000 EQU2 ?{ erase-selection !<select-reset> }
.selection/length LDZ2 #0000 EQU2 ?{ get-from get-page NEQ2 [ JMP JMP2r ] get-from #0001 SUB2 DUP2 cut-char <select-from>
erase-selection !file-save
!select-reset }
get-from get-page NEQ2 [ JMP JMP2r ]
get-from #0001 SUB2
DUP2 cut-char
select-from
!file-save
@erase-selection ( -- ) @erase-selection ( -- )
get-from get-eof .selection/length LDZ2 <msfl>
get-from get-eof .selection/length LDZ2 msfl !file-save
!file-save
@delete ( -- ) @delete ( -- )
get-eof get-from SUB2 ORA #01 [ JCN JMP2r ] .selection/length LDZ2 #0000 EQU2 ?{ erase-selection !<select-reset> }
get-eof get-from SUB2 ORA #01 [ JCN JMP2r ] get-from cut-char <redraw>
!file-save
.selection/length LDZ2 #0000 EQU2 ?{
erase-selection
!select-reset }
get-from cut-char
redraw
!file-save
@get-eof ( -- addr* ) @get-eof ( -- addr* )
get-page !scap/
get-page
!scap/
@cut-char ( addr* -- ) @cut-char ( addr* -- )
get-eof #0001 !<msfl>
get-eof #0001
!msfl
( (
@|selection ) @|selection )
@select-variable ( addr* -- ) @<select-variable> ( addr* -- )
[ LIT2 04 -Controller/button ] DEI AND ?<select-to>
[ LIT2 04 -Controller/button ] DEI AND ?select-to !<select-from>
!select-from
@select-reset ( -- )
@<select-reset> ( -- )
get-from get-from
( >> )
( >> ) @<select-from> ( addr* -- )
clamp-selection DUP2 .selection/a STZ2
@select-from ( addr* -- )
clamp-selection
DUP2 .selection/a STZ2
.selection/b STZ2
!select
@select-to ( addr* -- )
clamp-selection
.selection/b STZ2 .selection/b STZ2
!select
!select @<select-to> ( addr* -- )
clamp-selection .selection/b STZ2
!select
@select-word ( addr* -- ) @<select-word> ( addr* -- )
DUP2 &back #0001 SUB2 LDAk #20 GTH ?&back
INC2 .selection/a STZ2
&next INC2 LDAk #20 GTH ?&next
.selection/b STZ2
!select
DUP2 @<select-all> ( -- )
&back #0001 SUB2 LDAk #20 GTH ?&back INC2 .selection/a STZ2 get-page DUP2 .selection/a STZ2
&next INC2 LDAk #20 GTH ?&next .selection/b STZ2 scap/ #0001 SUB2 .selection/b STZ2
( >> )
!select
@select-all ( -- )
get-page
DUP2 .selection/a STZ2
scap/ #0001 SUB2 .selection/b STZ2
( >> )
@select ( -- ) @select ( -- )
get-to get-from SUB2 .selection/length STZ2 get-to get-from SUB2 .selection/length STZ2
#00 ;on-frame/f STA #00 ;on-frame/f STA
!<redraw>
!redraw @<select-left> ( -- )
.selection/length LDZ2 #0000 EQU2 [ LIT2 04 -Controller/button ] DEI AND #00 NEQ ORA ?{ get-from !<select-from> }
.selection/b LDZ2 #0001 SUB2 !<select-variable>
@select-left ( -- ) @<select-right> ( -- )
.selection/length LDZ2 #0000 EQU2 [ LIT2 04 -Controller/button ] DEI AND #00 NEQ ORA ?{ get-to !<select-from> }
.selection/length LDZ2 #0000 EQU2 .selection/b LDZ2 INC2 !<select-variable>
[ LIT2 04 -Controller/button ] DEI AND #00 NEQ
ORA ?{
get-from !select-from
}
.selection/b LDZ2 #0001 SUB2
!select-variable
@select-right ( -- )
.selection/length LDZ2 #0000 EQU2
[ LIT2 04 -Controller/button ] DEI AND #00 NEQ
ORA ?{
get-to !select-from
}
.selection/b LDZ2 INC2
!select-variable
@get-from ( -- addr* ) @get-from ( -- addr* )
.selection/b LDZ2 .selection/a LDZ2 LTH2k [ JMP SWP2 POP2 ] JMP2r
.selection/b LDZ2 .selection/a LDZ2 LTH2k [ JMP SWP2 POP2 ]
JMP2r
@get-to ( -- addr* ) @get-to ( -- addr* )
.selection/a LDZ2 .selection/b LDZ2 GTH2k [ JMP SWP2 POP2 ] JMP2r
.selection/a LDZ2 .selection/b LDZ2 GTH2k [ JMP SWP2 POP2 ]
JMP2r
@clamp-selection ( addr* -- addr* ) @clamp-selection ( addr* -- addr* )
( min ) get-page GTH2k [ JMP SWP2 POP2 ] ( min ) get-page GTH2k [ JMP SWP2 POP2 ]
( max ) get-eof #0001 SUB2 LTH2k [ JMP SWP2 POP2 ] ( max ) get-eof #0001 SUB2 LTH2k [ JMP SWP2 POP2 ] JMP2r
JMP2r
@is-selected ( addr* -- addr* f ) @is-selected ( addr* -- addr* f )
DUP2 get-from LTH2 ?&false DUP2 get-from LTH2 ?&false
DUP2 get-to #0001 SUB2 GTH2 ?&false DUP2 get-to #0001 SUB2 GTH2 ?&false
#01 #01 JMP2r
JMP2r
&false #00 JMP2r &false #00 JMP2r
( (
@|file ) @|file )
@file-init ( -- ) @file-init ( -- )
;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
;mem .File/read DEO2 ;mem .File/read DEO2
JMP2r
JMP2r
@file-new ( -- ) @file-new ( -- )
#0801 #0801
&>l ( -- ) &>l ( -- )
#00 OVR #c0 SFT2 ;mem ADD2 STH2 #20 STH2r STA #00 OVR #c0 SFT2 ;mem ADD2 STH2
#20 STH2r STA
INC GTHk ?&>l INC GTHk ?&>l
POP2 POP2 JMP2r
JMP2r
@file-save ( -- ) @file-save ( -- )
;notepad-txt .File/name DEO2 ;notepad-txt .File/name DEO2
#8000 .File/length DEO2 #8000 .File/length DEO2
;mem .File/write DEO2 ;mem .File/write DEO2
JMP2r
JMP2r @notepad-txt ".notepad $1
@notepad-txt ".notepad $1
@file-size ( path* -- size* ) @file-size ( path* -- size* )
.File/name DEO2 .File/name DEO2
#0001 .File/length DEO2 #0001 .File/length DEO2
[ LIT2r 0000 ] [ LIT2r 0000 ]
&>s ( -- ) &>s ( -- )
;&b .File/read DEO2 ;&b .File/read DEO2
[ LIT2 00 -File/success-lb ] DEI EQU ?&eof [ LIT2 00 -File/success-lb ] DEI EQU ?&eof
INC2r !&>s &eof INC2r !&>s
STH2r &eof STH2r JMP2r
JMP2r
&b $1 &b $1
@file-inject ( name* -- ) @file-inject ( name* -- )
DUP2 file-size ORAk ?{ POP2 POP2 JMP2r }
DUP2 file-size STH2
ORAk ?{
POP2 POP2 JMP2r
}
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> }
} ( push right ) get-from #0001 SUB2 get-eof STH2kr <msfr>
( push right ) get-from #0001 SUB2
get-eof STH2kr msfr
get-from .File/read DEO2 get-from .File/read DEO2
get-from STH2r ADD2 get-from STH2r ADD2 !<select-from>
!select-from
@edit-cut ( -- ) @edit-cut ( -- )
.selection/length LDZ2 #0001 GTH2 [ JMP JMP2r ] edit-copy erase-selection <select-reset>
.selection/length LDZ2 #0001 GTH2 [ JMP JMP2r ] !file-save
edit-copy
erase-selection
select-reset
!file-save
@edit-copy ( -- ) @edit-copy ( -- )
.selection/length LDZ2 #0001 GTH2 [ JMP JMP2r ] ;snarf-txt .File/name DEO2
.selection/length LDZ2 #0001 GTH2 [ JMP JMP2r ]
;snarf-txt .File/name DEO2
.selection/length LDZ2 .File/length DEO2 .selection/length LDZ2 .File/length DEO2
get-from .File/write DEO2 get-from .File/write DEO2
JMP2r
JMP2r
@edit-paste ( -- ) @edit-paste ( -- )
;snarf-txt file-inject !file-save
;snarf-txt file-inject @snarf-txt ".snarf $1
!file-save
@snarf-txt ".snarf $1
( (
@|core ) @|core )
@trap-mouse ( -- ) @<trap-mouse> ( -- )
.Mouse/y DEI2 DUP2 #0018 GTH2 ?{
.Mouse/y DEI2 POP2 ;on-mouse-head .Mouse/vector DEO2
DUP2 #0018 GTH2 ?{ JMP2r }
POP2 ;on-mouse-head .Mouse/vector DEO2 JMP2r
}
DUP2 #00d6 LTH2 ?{ DUP2 #00d6 LTH2 ?{
POP2 ;on-mouse-foot .Mouse/vector DEO2 JMP2r POP2 ;on-mouse-foot .Mouse/vector DEO2
} JMP2r }
POP2 POP2 ;on-mouse-body .Mouse/vector DEO2
;on-mouse-body .Mouse/vector DEO2 JMP2r
JMP2r
@change-page ( id -- ) @change-page ( id -- )
.page STZ .page STZ
get-page scap/ #0001 SUB2 get-page scap/ #0001 SUB2 !<select-from>
!select-from
@prev-page ( -- ) @prev-page ( -- )
.page LDZ #01 SUB #07 AND !change-page
.page LDZ #01 SUB #07 AND
!change-page
@next-page ( -- ) @next-page ( -- )
.page LDZ INC #07 AND !change-page
.page LDZ INC #07 AND
!change-page
@pos-to-line ( y* -- line ) @pos-to-line ( y* -- line )
#0012 SUB2 #04 SFT2 NIP JMP2r
#0012 SUB2 #04 SFT2 NIP
JMP2r
@get-position ( -- addr* ) @get-position ( -- addr* )
#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 ( -- )
.Screen/y DEI2 pos-to-line [ LIT &line $1 ] EQU ?&end-line .Screen/y DEI2 pos-to-line [ LIT &line $1 ] EQU ?&end-line
walk-char POP walk-char POP INC2 LDAk ?&>walk-line
INC2 LDAk ?&>walk-line &end-line ( walk to char )
&end-line
( | 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
walk-char ?&end-char walk-char ?&end-char
INC2 LDAk ?&>walk-char INC2 LDAk ?&>walk-char
&end-char &end-char JMP2r
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 ?{ POP2 #01 #0021 !<draw-linebreak> }
DUP2 #093e NEQ2 ?{ DUP2 #092d NEQ2 ?{ POP2 #01 #0022 !<draw-linebreak> }
POP2 #01 #0021 !draw-linebreak } POP2 #01 #0008 !<draw-linebreak>
DUP2 #092d NEQ2 ?{ &no-wrap ( char )
POP2 #01 #0022 !draw-linebreak } LDAk char-width .Screen/x DEI2 ADD2 .Screen/x DEO2
POP2
#01 #0008 !draw-linebreak
&no-wrap
( | char )
LDAk char-width .Screen/x DEI2 ADD2
.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 #00 JMP2r
}
#00
JMP2r
@get-page ( -- addr* ) @get-page ( -- addr* )
;mem [ LIT2 00 -page ] LDZ #c0 SFT2 ADD2 JMP2r
;mem [ LIT2 00 -page ] LDZ #c0 SFT2 ADD2
JMP2r
@char-addr ( prev char -- addr* ) @char-addr ( prev char -- addr* )
DUP #7e GTH ?&missing DUP #7e GTH ?&missing
DUP #20 LTH ?&blank DUP #20 LTH ?&blank
DUP2 #0a3e EQU2 ?&marker DUP2 #0a3e EQU2 ?&marker
DUP2 #093e EQU2 ?&marker DUP2 #093e EQU2 ?&marker
DUP2 #092d EQU2 ?&bullet DUP2 #092d EQU2 ?&bullet
NIP #20 SUB NIP #20 SUB #00 SWP #50 SFT2 ;font/glyphs ADD2 JMP2r
#00 SWP #50 SFT2 ;font/glyphs ADD2
JMP2r
&blank POP2 ;font/glyphs JMP2r &blank POP2 ;font/glyphs JMP2r
&missing POP2 ;error-icn JMP2r &missing POP2 ;error-icn JMP2r
&marker POP2 ;marker-icn JMP2r &marker POP2 ;marker-icn JMP2r
&bullet POP2 ;bullet-icn JMP2r &bullet POP2 ;bullet-icn JMP2r
@char-width ( char -- width* ) @char-width ( char -- width* )
DUP #7e GTH ?{
DUP #7e GTH ?&missing #20 SUB #00 SWP ;font ADD2 LDA #00 SWP JMP2r }
#20 SUB #00 SWP ;font ADD2 LDA #00 SWP POP #0008 JMP2r
JMP2r
&missing POP #0008 JMP2r
@word-width ( str* -- length* ) @word-width ( str* -- length* )
[ LIT2r 0000 ] [ LIT2r 0000 ]
&>w ( -- ) &>w ( -- )
LDAk char-width STH2 ADD2r LDAk char-width STH2
INC2 LDAk #20 GTH ?&>w ADD2r INC2 LDAk #20 GTH ?&>w
POP2 POP2 STH2r JMP2r
STH2r
JMP2r
@find-line-start ( addr* -- addr* ) @find-line-start ( addr* -- addr* )
;mem SWP2 ;mem SWP2
&>l ( -- ) &>l ( -- )
#0001 SUB2 LDAk #0001 SUB2 LDAk DUP #0a EQU SWP #00 EQU ORA ?&end
DUP #0a EQU SWP #00 EQU ORA ?&end
LTH2k ?&>l LTH2k ?&>l
&end &end NIP2 INC2 JMP2r
NIP2 INC2
JMP2r
@find-line-end ( addr* -- addr* ) @find-line-end ( addr* -- addr* )
get-eof SWP2 get-eof SWP2
&>l ( -- ) &>l ( -- )
LDAk #0a EQU ?&end LDAk #0a EQU ?&end
LDAk #00 EQU ?&end LDAk #00 EQU ?&end
INC2 GTH2k ?&>l INC2 GTH2k ?&>l
&end &end NIP2 JMP2r
NIP2
JMP2r
@find-word-start ( addr* -- addr* ) @find-word-start ( addr* -- addr* )
;mem SWP2 ;mem SWP2
&>l ( -- ) &>l ( -- )
#0001 SUB2 LDAk #21 LTH ?&end #0001 SUB2 LDAk #21 LTH ?&end
LTH2k ?&>l LTH2k ?&>l
&end &end NIP2 INC2 JMP2r
NIP2 INC2
JMP2r
@find-word-end ( addr* -- addr* ) @find-word-end ( addr* -- addr* )
get-eof SWP2 get-eof SWP2
&>l ( -- ) &>l ( -- )
LDAk #21 LTH ?&end LDAk #21 LTH ?&end
INC2 GTH2k ?&>l INC2 GTH2k ?&>l
&end &end NIP2 JMP2r
NIP2
JMP2r
( (
@|drawing ) @|drawing )
@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 #50 SFT2 ADD2 .Screen/addr DEO2
#00 [ LIT2 00 -Mouse/state ] DEI NEQ .Mouse/x DEI2 #0008 SUB2 #000a LTH2 AND
#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
INC DUP ?&>l INC DUP ?&>l
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
@ -636,18 +426,15 @@ JMP2r
#0070 .Screen/x DEO2 #0070 .Screen/x DEO2
#0010 .Screen/y DEO2 #0010 .Screen/y DEO2
[ LIT2 01 -Screen/sprite ] DEO [ LIT2 01 -Screen/sprite ] DEO
JMP2r
JMP2r @<redraw> ( -- )
@redraw ( -- )
#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> ( -- )
[ LIT2 15 -Screen/auto ] DEO [ LIT2 15 -Screen/auto ] DEO
#0008 .Screen/x DEO2 #0008 .Screen/x DEO2
#0018 .Screen/y DEO2 #0018 .Screen/y DEO2
@ -655,25 +442,21 @@ JMP2r
&>w ( -- ) &>w ( -- )
( | 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
;blink-icn .Screen/addr DEO2 ;blink-icn .Screen/addr DEO2
[ LIT2 05 -Screen/sprite ] DEO [ LIT2 05 -Screen/sprite ] DEO
.Screen/x DEI2k #0008 SUB2 ROT DEO2 .Screen/x DEI2k #0008 SUB2 ROT DEO2
&block &block walk-char POP INC2 LDAk ?&>w
walk-char POP
INC2 LDAk ?&>w
POP2 POP2
@draw-footer ( -- ) @<draw-footer> ( -- )
.Screen/height DEI2 #0020 GTH2 ?{ JMP2r }
.Screen/height DEI2 #0020 GTH2 ?{
JMP2r
}
[ LIT2 26 -Screen/auto ] DEO [ LIT2 26 -Screen/auto ] DEO
#0000 .Screen/x DEO2 #0000 .Screen/x DEO2
.Screen/height DEI2 #0020 SUB2 .Screen/y DEO2 .Screen/height DEI2 #0020 SUB2 .Screen/y DEO2
@ -684,7 +467,8 @@ JMP2r
#0018 .Screen/x DEO2 #0018 .Screen/x DEO2
.Screen/height DEI2 #0008 SUB2 .Screen/y DEO2 .Screen/height DEI2 #0008 SUB2 .Screen/y DEO2
;page-icn/bottom .Screen/addr DEO2 ;page-icn/bottom .Screen/addr DEO2
#e7 &>l ( -- ) #e7
&>l ( -- )
[ LIT2 01 -Screen/sprite ] DEO [ LIT2 01 -Screen/sprite ] DEO
INC DUP ?&>l INC DUP ?&>l
POP POP
@ -694,39 +478,31 @@ JMP2r
.Screen/height DEI2 #0020 SUB2 .Screen/y DEO2 .Screen/height DEI2 #0020 SUB2 .Screen/y DEO2
#0011 .page LDZ ADD #50 SFT2 ;font/glyphs ADD2 .Screen/addr DEO2 #0011 .page LDZ ADD #50 SFT2 ;font/glyphs ADD2 .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEOk DEO [ LIT2 01 -Screen/sprite ] DEOk DEO
JMP2r
JMP2r @<draw-tab> ( -- )
@draw-tab ( -- )
.Screen/x DEI2k #0010 ADD2 #33 SFT2 ROT DEO2 .Screen/x DEI2k #0010 ADD2 #33 SFT2 ROT DEO2
JMP2r
JMP2r @<draw-linebreak> ( x* -- )
@draw-linebreak ( x* -- )
.Screen/x DEO2 .Screen/x DEO2
.Screen/y DEI2k #0010 ADD2 ROT DEO2 .Screen/y DEI2k #0010 ADD2 ROT DEO2
JMP2r
JMP2r @<update-cursor> ( color addr* -- )
@update-cursor ( color addr* -- )
[ LIT2 15 -Screen/auto ] DEO [ LIT2 15 -Screen/auto ] DEO
;fill-icn .Screen/addr DEO2 ;fill-icn .Screen/addr DEO2
#40 draw-cursor #40 <draw-cursor>
.Mouse/x DEI2 ,draw-cursor/x STR2 .Mouse/x DEI2 ,<draw-cursor>/x STR2
.Mouse/y DEI2 ,draw-cursor/y STR2 .Mouse/y DEI2 ,<draw-cursor>/y STR2
.Screen/addr DEO2 .Screen/addr DEO2
( >> ) ( >> )
@draw-cursor ( color -- ) @<draw-cursor> ( color -- )
[ LIT2 &x $2 ] .Screen/x DEO2 [ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 &y $2 ] .Screen/y DEO2 [ LIT2 &y $2 ] .Screen/y DEO2
.Screen/sprite DEO .Screen/sprite DEO
JMP2r
JMP2r
( (
@|stdlib ) @|stdlib )
@ -739,13 +515,12 @@ JMP2r
@<phex> ( short* -: ) @<phex> ( short* -: )
SWP /b SWP /b
&b ( byte -: ) &b ( byte -: )
DUP #04 SFT /c DUP #04 SFT /c
&c ( byte -: ) &c ( byte -: )
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO #0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO
JMP2r JMP2r
@load-theme ( -- ) @load-theme ( -- )
;&path .File/name DEO2 ;&path .File/name DEO2
#0002 .File/length DEO2 #0002 .File/length DEO2
;&r .File/read DEO2 ;&r .File/read DEO2
@ -754,15 +529,25 @@ JMP2r
[ LIT2 00 -File/success-lb ] DEI EQU ?{ [ LIT2 00 -File/success-lb ] DEI EQU ?{
[ LIT2 &r $2 ] .System/r DEO2 [ LIT2 &r $2 ] .System/r DEO2
[ LIT2 &g $2 ] .System/g DEO2 [ LIT2 &g $2 ] .System/g DEO2
[ LIT2 &b $2 ] .System/b DEO2 [ LIT2 &b $2 ] .System/b DEO2 }
} JMP2r
JMP2r
&path ".theme $1 &path ".theme $1
@msfl ( b* a* len* -- ) STH2 SWP2 EQU2k ?&e &l DUP2k STH2kr ADD2 LDA ROT ROT STA INC2 GTH2k ?&l POP2 POP2 &e POP2r JMP2r @<msfl> ( b* a* len* -- )
@msfr ( b* a* len* -- ) STH2 EQU2k ?&e &l DUP2 LDAk ROT ROT STH2kr ADD2 STA #0001 SUB2 LTH2k ?&l POP2 POP2 &e POP2r JMP2r 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
~src/assets.tal ~src/assets.tal