Faster file loading

This commit is contained in:
Devine Lu Linvega 2024-05-27 21:07:01 -07:00
parent 7924b340c2
commit 73cf6df2dd
1 changed files with 19 additions and 14 deletions

View File

@ -2,7 +2,7 @@
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1
|a0 @File &vector $2 &success $2 &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
@ -154,9 +154,7 @@ BRK
[ LIT2 &last $1 &f $1 ] INCk ,&f STR
#05 SFT DUP ,&last STR
EQU ?&unchanged
draw-note
&unchanged
EQU ?{ draw-note }
BRK
@ -165,7 +163,7 @@ BRK
@insert ( char -- )
get-from scap get-page #1000 ADD2 LTH2 ?&has-space
get-from scap/ get-page #1000 ADD2 LTH2 ?&has-space
POP JMP2r
&has-space
@ -221,7 +219,7 @@ BRK
get-page
!scap
!scap/
@cut-char ( addr* -- )
@ -271,7 +269,7 @@ BRK
get-page
DUP2 .selection/a STZ2
scap #0001 SUB2 .selection/b STZ2
scap/ #0001 SUB2 .selection/b STZ2
( >> )
@ -373,7 +371,7 @@ JMP2r
[ LIT2r 0000 ]
&s
;&b .File/read DEO2
.File/success DEI2 #0000 EQU2 ?&eof
[ LIT2 00 -File/success-lb ] DEI EQU ?&eof
INC2r !&s &eof
STH2r
@ -447,7 +445,7 @@ JMP2r
@change-page ( id -- )
.page STZ
get-page scap #0001 SUB2
get-page scap/ #0001 SUB2
!select-from
@ -530,6 +528,7 @@ JMP2r
DUP #7e GTH ?&missing
DUP #20 LTH ?&blank
DUP2 #0a3e EQU2 ?&marker
DUP2 #093e EQU2 ?&marker
DUP2 #092d EQU2 ?&bullet
NIP #20 SUB
@ -739,6 +738,11 @@ JMP2r
(
@|stdlib )
@scap ( str* -- end* )
&>w ( -- )
INC2 & LDAk ?&>w
JMP2r
@<phex> ( short* -: )
SWP /b
&b ( byte -: )
@ -754,17 +758,18 @@ JMP2r
;&r .File/read DEO2
;&g .File/read DEO2
;&b .File/read DEO2
.File/success DEI2 ORA [ #01 JCN JMP2r ]
LIT2 &r $2 .System/r DEO2
LIT2 &g $2 .System/g DEO2
LIT2 &b $2 .System/b DEO2
[ LIT2 00 -File/success-lb ] DEI EQU ?{
[ LIT2 &r $2 ] .System/r DEO2
[ LIT2 &g $2 ] .System/g DEO2
[ LIT2 &b $2 ] .System/b DEO2
}
JMP2r
&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
@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
~src/assets.tal