uxn-utils/gui/m291/src/m291.tal

603 lines
12 KiB
Tal
Raw Normal View History

2024-08-26 12:38:32 -04:00
( Well, I wasn't going to call it m7b )
2024-08-25 21:34:47 -04:00
|10 @Console &vector $2
|12 &read $1
|17 &type $1
|18 &write $1
|19 &error $1
|1c &addr $2
|1e &mode $1
|1f &exec $1
2024-08-25 21:22:50 -04:00
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
2024-08-25 18:22:45 -04:00
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
2024-08-25 18:58:25 -04:00
|80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 &pad $4 &scrolly &scrolly-hb $1 &scrolly-lb $1
|a0 @File &vector $2 &success $1 &success-lb $1 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
2024-08-25 21:22:50 -04:00
|000
2024-08-25 17:49:47 -04:00
2024-08-25 21:22:50 -04:00
@misc $1
@selection $1 &mod $1
@path $2 &null $80
@lines &folders $1 &roms $1 &misc $1
2024-08-25 22:57:14 -04:00
@playing $1
2024-08-25 17:49:47 -04:00
2024-08-25 21:22:50 -04:00
|100
@on-reset ( -> )
2024-08-25 18:58:25 -04:00
;meta #06 DEO2
2024-08-26 12:03:13 -04:00
( | theme )
2024-08-25 21:22:50 -04:00
#d2d2 DUP2 .System/r DEO2
DUP2 .System/g DEO2
.System/b DEO2
2024-08-25 18:58:25 -04:00
<load-theme>
2024-08-26 12:03:13 -04:00
( | size )
2024-08-25 18:58:25 -04:00
#0100 .Screen/width DEO2
2024-08-26 12:03:13 -04:00
( | .. )
message/<new>
;dict/mpg-cmd .Console/addr DEO2
[ LIT2 03 -Console/mode ] DEO
[ LIT2 01 -Console/exec ] DEO
2024-08-25 22:57:14 -04:00
[ LIT2 01 -playing ] STZ
2024-08-25 18:58:25 -04:00
;dict/home-path set-path <refresh-dir>
2024-08-26 12:03:13 -04:00
( | unlock )
2024-08-25 18:58:25 -04:00
;on-mouse .Mouse/vector DEO2
;on-control .Controller/vector DEO2
2024-08-25 21:54:16 -04:00
;on-console .Console/vector DEO2
2024-08-25 21:40:33 -04:00
BRK
2024-08-25 18:58:25 -04:00
@meta $1
2024-08-25 21:22:50 -04:00
( name ) "m291 0a
( desc ) "Audio 20 "Player 0a
2024-08-25 18:58:25 -04:00
( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
2024-08-25 21:34:47 -04:00
( date ) "25 20 "Aug 20 "2024 $2
2024-08-25 18:58:25 -04:00
2024-08-26 12:03:13 -04:00
(
@|vectors )
2024-08-25 21:54:16 -04:00
@on-console ( -> brk )
2024-08-25 22:07:48 -04:00
[ LIT2 01 -Console/type ] DEI EQU ?{ BRK }
[ LIT2 0a -Console/read ] DEI EQUk ?{ message/<append>
POP BRK }
POP2 message/<parse>
2024-08-25 21:54:16 -04:00
BRK
2024-08-25 18:58:25 -04:00
@on-mouse ( -> )
2024-08-25 19:45:44 -04:00
#c1 ;touch-chr/down ;touch-chr .Mouse/state DEI ?{ SWP2 }
POP2 <update-cursor>
2024-08-25 20:23:07 -04:00
.Mouse/y DEI2 DUP2 #0014 LTH2 ?&status-bar
<y-id>
2024-08-25 18:58:25 -04:00
.Mouse/state DEI DUP ?{ POP <select>
BRK }
#01 GTH .selection/mod STZ
<pick>
[ LIT2 00 -Mouse/state ] DEO
BRK
2024-08-25 20:23:07 -04:00
&status-bar ( y* -> )
POP2 BRK
2024-08-25 19:45:44 -04:00
2024-08-25 18:58:25 -04:00
@on-control ( -> )
( | mod )
[ LIT2 04 -Controller/button ] DEI AND #00 NEQ .selection/mod STZ
( | key )
.Controller/key DEI
( esc ) DUP #1b NEQ ?{ <escape> }
( tab ) DUP #09 NEQ ?{ <toggle-misc> }
( enter ) DUP #0d NEQ ?{ .selection LDZ <pick> }
POP
( | button )
.Controller/button DEI
( up ) DUP #10 NEQ ?{ #ff <move> }
( down ) DUP #20 NEQ ?{ #01 <move> }
( A ) DUP #01 NEQ ?{ .selection LDZ <pick> }
POP BRK
2024-08-25 22:07:48 -04:00
(
@|message )
@message/<parse> ( -- )
2024-08-25 22:12:10 -04:00
#00 /<append>
2024-08-25 22:07:48 -04:00
( | parse line )
2024-08-25 22:12:10 -04:00
;&buf LDAk [ LIT "@ ] EQU ?{ POP2 JMP2r }
2024-08-25 22:50:15 -04:00
INC2 LDAk
( | route )
DUP [ LIT "S ] EQU ?handle-status
DUP [ LIT "F ] EQU ?handle-frame
2024-08-25 23:14:00 -04:00
DUP [ LIT "I ] EQU ?handle-id3
2024-08-25 22:50:15 -04:00
POP
( | not-handled )
<perr>
2024-08-25 22:07:48 -04:00
#0a19 DEO
( >> )
@message/<new> ( -- )
2024-08-25 22:12:10 -04:00
( reset ) ;&buf ,&ptr STR2
2024-08-25 22:07:48 -04:00
JMP2r
@message/<append> ( c -- )
2024-08-25 22:12:10 -04:00
[ LIT2 &ptr =&buf ] INC2k ,&ptr STR2
STA
2024-08-25 22:07:48 -04:00
JMP2r
2024-08-26 12:38:32 -04:00
(
@|timestamp ) ( returns value between 0000 and 00d0 )
@calc-width ( total* curr* -- width* )
STH2
DUP2 #013c LTH2 ?&ready
&scale ( -- )
DUP2 #0277 LTH2 ?&almost
#01 SFT2 LITr 01 SFT2r !&scale
&almost INC2 #01 SFT2 INC2r LITr 01 SFT2r
&ready ( -- )
LIT2r 00d0 MUL2r STH2r SWP2 DIV2 JMP2r
2024-08-25 22:50:15 -04:00
(
@|events )
@handle-status ( buf* char -- )
2024-08-25 22:57:14 -04:00
[ LIT2 01 -playing ] STZ
fit-window POP <perr>
2024-08-25 22:50:15 -04:00
#0a19 DEO !message/<new>
@handle-frame ( buf* char -- )
2024-08-26 12:38:32 -04:00
POP
( skip key ) #0003 ADD2
( skip curr-frame ) #20 find-next INC2
( skip next-frame ) #20 find-next INC2
( | <curr-secs> )
parse-dec STH2
INC2 LDAk [ LIT "5 ] LTH ?{ INC2r }
#20 find-next INC2
( | <remaining-secs> )
parse-dec STH2
INC2 LDAk [ LIT "5 ] LTH ?{ INC2r }
POP2 STH2r STH2r SWP2 OVR2 ADD2 SWP2
( | print )
calc-width <draw-progress> !message/<new>
2024-08-25 22:50:15 -04:00
2024-08-25 23:14:00 -04:00
@handle-id3 ( buf* char -- )
POP <perr>
#0a19 DEO !message/<new>
2024-08-25 18:58:25 -04:00
(
@|core )
2024-08-25 22:50:15 -04:00
@<y-id> ( y* -- id )
2024-08-25 22:57:14 -04:00
[ LIT2 00 -playing ] LDZ EQU ?{ #0080 SUB2 }
2024-08-25 22:50:15 -04:00
#0014 SUB2
( | above )
DUP2 #8000 GTH2 ?&outside
( | spacer )
has-spacer #00 EQU ?{
DUP2 [ LIT2 00 -lines/folders ] LDZ #40 SFT2 SUB2 #0008 LTH2 ?&outside
DUP2 [ LIT2 00 -lines/folders ] LDZ #40 SFT2 GTH2 #00 SWP #30 SFT2 SUB2 }
#04 SFT2 NIP
( | below )
DUP count-lines LTH ?{ POP #ff }
JMP2r
&outside ( y* -- id )
POP2 #ff JMP2r
2024-08-25 18:58:25 -04:00
@<refresh-dir> ( -- )
;path .File/name DEO2
#0800 .File/length DEO2
;mem/dir .File/read DEO2
( | clean )
[ LIT2 00 -lines/folders ] STZ
[ LIT2 00 -lines/roms ] STZ
[ LIT2 00 -lines/misc ] STZ
( | parse )
;mem/dir
&w ( -- )
2024-08-25 19:40:01 -04:00
DUP2 <parse-line>
lcap/ INC2 LDAk ?&w
2024-08-25 18:58:25 -04:00
POP2
( >> )
@fit-window ( -- )
#00 count-lines
( empty ) DUP #00 EQU ADD #40 SFT2
( no-folder spacer ) has-spacer #00 EQU ?{ #0008 ADD2 }
2024-08-25 22:57:14 -04:00
( padding ) #0020 ADD2
( playing ) [ LIT2 00 -playing ] LDZ EQU ?{ #0080 ADD2 }
.Screen/height DEO2 !<redraw>
2024-08-25 18:58:25 -04:00
@<parse-line> ( line* -- )
#0005 ADD2 LDAk [ LIT ". ] EQU ?&hidden
is-folder ?&folder
2024-08-25 21:22:50 -04:00
is-mp3 ?&mp3
2024-08-25 18:58:25 -04:00
;mem/misc [ LIT2 00 -lines/misc ] LDZ #40 SFT2 ADD2 <lcpy>
.lines/misc LDZ INC .lines/misc STZ
JMP2r
2024-08-25 19:40:01 -04:00
2024-08-25 18:58:25 -04:00
&folder ( line* -- )
2024-08-25 19:40:01 -04:00
;mem/folders [ LIT2 00 -lines/folders ] LDZ #40 SFT2 ADD2 <lcpy>
.lines/folders LDZ INC .lines/folders STZ
JMP2r
2024-08-25 21:22:50 -04:00
&mp3 ( line* -- )
2024-08-25 19:40:01 -04:00
;mem/roms [ LIT2 00 -lines/roms ] LDZ #40 SFT2 ADD2 <lcpy>
.lines/roms LDZ INC .lines/roms STZ
JMP2r
2024-08-25 18:58:25 -04:00
&hidden ( line* -- )
2024-08-25 19:40:01 -04:00
POP2 JMP2r
2024-08-25 18:58:25 -04:00
@<move> ( mod -- )
.selection LDZ ADD INCk ?{
POP count-lines #01 SUB !<select> }
count-lines DIVk MUL SUB
( >> )
@<select> ( id -- )
[ LIT &last ff ] NEQk ?{ POP2 JMP2r }
POP DUP ,&last STR
2024-08-25 19:40:01 -04:00
.selection STZ !<redraw>
2024-08-25 18:58:25 -04:00
@<pick> ( alt id -- )
DUP .lines/folders LDZ LTH ?&folder
.lines/folders LDZ SUB DUP .lines/roms LDZ LTH ?&roms
.lines/roms LDZ SUB DUP .lines/misc LDZ LTH ?&misc
POP JMP2r
2024-08-25 19:40:01 -04:00
2024-08-25 18:58:25 -04:00
&roms ( id -- )
2024-08-25 21:46:26 -04:00
#00 SWP #40 SFT2 ;mem/roms ADD2 !<send-load>
2024-08-25 19:40:01 -04:00
2024-08-25 18:58:25 -04:00
&misc ( id -- )
2024-08-25 21:46:26 -04:00
#00 SWP #40 SFT2 ;mem/misc ADD2 !<send-load>
2024-08-25 19:40:01 -04:00
2024-08-25 18:58:25 -04:00
&folder ( id -- )
2024-08-25 19:40:01 -04:00
#00 SWP #40 SFT2 ;mem/folders ADD2 !<enter>
2024-08-25 18:58:25 -04:00
2024-08-25 21:46:26 -04:00
@<send-load> ( file* -- )
2024-08-25 21:40:33 -04:00
;dict/load-cmd <pstr>
2024-08-25 18:58:25 -04:00
;path <pstr>
<pstr>/
2024-08-25 21:34:47 -04:00
#0a18 DEO
JMP2r
2024-08-25 19:40:01 -04:00
2024-08-25 18:58:25 -04:00
@<enter> ( folder* -- )
.selection/mod LDZ ?&special
push-path !<refresh-dir>
2024-08-25 19:40:01 -04:00
2024-08-25 18:58:25 -04:00
&special ( folder* -- )
2024-08-25 19:40:01 -04:00
;path <pstr>
<pstr>/
#0a18 DEO
JMP2r
2024-08-25 18:58:25 -04:00
@<leave> ( -- )
pop-path !<refresh-dir>
@<escape> ( -- )
;path/null LDA ?<leave>
JMP2r
@<toggle-misc> ( -- )
2024-08-25 19:40:01 -04:00
[ LIT2 00 -misc ] LDZ EQU .misc STZ !fit-window
2024-08-25 18:58:25 -04:00
@count-lines ( -- lines )
.lines/folders LDZ .lines/roms LDZ ADD
( ) [ LIT2 00 -misc ] LDZ EQU ?{ .lines/misc LDZ ADD }
JMP2r
@has-spacer ( -- f )
[ LIT2 00 -lines/folders ] LDZ NEQ
( ) [ LIT2 00 -lines/roms ] LDZ NEQ
( ) [ LIT2 00 -misc ] LDZ EQU ?{
[ LIT2 00 -lines/misc ] LDZ NEQ ORA }
AND JMP2r
@is-folder ( line* -- line* f )
DUP2 lcap/ #0001 SUB2 LDA [ LIT "/ ] EQU JMP2r
2024-08-25 21:22:50 -04:00
@is-mp3 ( line* -- line*f )
2024-08-25 18:58:25 -04:00
DUP2 lcap/ #0003 SUB2 ;dict/mp3-ext !scmp3
(
@|path )
@set-path ( path* -- )
;path !<scpy>
@push-path ( subpath* -- )
;path scap/ !<scpy>
@pop-path ( -- )
;path scap/ #0001 SUB2
&w ( -- )
2024-08-25 19:40:01 -04:00
;path/null LDA ?{ POP2 JMP2r }
#0001 SUB2 LDAk [ LIT "/ ] NEQ ?{
LITr 00 STH2
INC2r STAr
JMP2r }
!&w
2024-08-25 18:58:25 -04:00
(
@|drawing )
@<redraw> ( -- )
( | clear )
#0000 DUP2 .Screen/x DEO2
2024-08-25 18:22:45 -04:00
.Screen/y DEO2
2024-08-25 18:58:25 -04:00
[ LIT2 80 -Screen/pixel ] DEO
2024-08-25 19:40:01 -04:00
( | status )
#0008 .Screen/x DEO2
#0004 .Screen/y DEO2
;path #01 <draw-uf2>
( | spacer )
#0014 .Screen/y DEO2
;line-icn <draw-spacer>
2024-08-25 18:58:25 -04:00
( | content )
2024-08-25 22:57:14 -04:00
#001c [ LIT2 00 -playing ] LDZ EQU ?{ <draw-player>
#0080 ADD2 }
.Screen/y DEO2
2024-08-25 18:58:25 -04:00
( | empty )
count-lines ?{
#0008 .Screen/x DEO2
;dict/empty #0f !<draw-uf2> }
( | folders )
2024-08-25 20:23:07 -04:00
;mem/folders .lines/folders LDZ #01 .selection LDZ <draw-list>
2024-08-25 19:40:01 -04:00
[ LIT2 00 -lines/folders ] LDZ EQU ?{ ;dash-icn <draw-spacer> }
2024-08-25 21:22:50 -04:00
;mem/roms .lines/roms LDZ #00 .selection LDZ .lines/folders LDZ SUB <draw-list>
2024-08-25 18:58:25 -04:00
[ LIT2 00 -misc ] LDZ EQU ?{
2024-08-25 21:34:47 -04:00
;mem/misc .lines/misc LDZ #00 .selection LDZ !<draw-list> }
2024-08-25 18:22:45 -04:00
JMP2r
2024-08-25 22:57:14 -04:00
@<draw-player> ( -- )
2024-08-25 23:14:00 -04:00
#0080 .Screen/x DEO2
#0020 .Screen/y DEO2
;placeholder/track #01 <draw-uf2-center>
#0080 .Screen/x DEO2
#0030 .Screen/y DEO2
;placeholder/artist #01 <draw-uf2-center>
#0080 .Screen/x DEO2
#0040 .Screen/y DEO2
;placeholder/album #01 <draw-uf2-center>
#0070 .Screen/x DEO2
#0058 .Screen/y DEO2
[ LIT2 36 -Screen/auto ] DEO
;button-icn .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEOk DEOk DEOk DEO
2024-08-25 23:17:17 -04:00
( | .. )
#0008 .Screen/x DEO2
2024-08-25 23:30:34 -04:00
#0070 .Screen/y DEO2
2024-08-25 23:17:17 -04:00
;placeholder/time-a #01 <draw-uf2>
( | .. )
.Screen/width DEI2 #0008 SUB2 .Screen/x DEO2
2024-08-25 23:30:34 -04:00
#0070 .Screen/y DEO2
2024-08-25 23:17:17 -04:00
;placeholder/time-b #01 <draw-uf2-right>
2024-08-26 12:38:32 -04:00
( fill width ) #00e7
2024-08-25 23:30:34 -04:00
( >> )
2024-08-26 12:38:32 -04:00
@<draw-progress> ( width* -- )
2024-08-25 23:30:34 -04:00
[ LIT2 01 -Screen/auto ] DEO
#0004 .Screen/x DEO2
#0088 .Screen/y DEO2
2024-08-26 12:38:32 -04:00
( | cap left )
2024-08-25 23:30:34 -04:00
;progress-icn/left .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEO
2024-08-26 12:38:32 -04:00
( | fill )
2024-08-25 23:30:34 -04:00
#e3
&>t ( -- )
;progress-icn/middle .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEO
INC DUP ?&>t
2024-08-26 12:38:32 -04:00
POP
( | cap right )
;progress-icn/right .Screen/addr DEO2
2024-08-25 23:30:34 -04:00
[ LIT2 01 -Screen/sprite ] DEO
2024-08-26 12:38:32 -04:00
( | fill )
#0008 .Screen/x DEO2
[ LIT2 00 -Screen/auto ] DEO
;progress-icn/fill .Screen/addr DEO2
#0000
&>l ( -- )
[ LIT2 05 -Screen/sprite ] DEO
.Screen/x DEI2 INC2 .Screen/x DEO2
INC2 GTH2k ?&>l
POP2 POP2 JMP2r
2024-08-25 22:57:14 -04:00
2024-08-25 19:40:01 -04:00
@<draw-spacer> ( addr* -- )
2024-08-25 18:58:25 -04:00
#0000 .Screen/x DEO2
2024-08-25 19:40:01 -04:00
.Screen/addr DEO2
2024-08-25 18:58:25 -04:00
[ LIT2 f2 -Screen/auto ] DEO
2024-08-25 19:40:01 -04:00
[ LIT2 05 -Screen/sprite ] DEOk #0080 .Screen/x DEO2
.Screen/y DEI2 #0008 SUB2 .Screen/y DEO2
DEO
2024-08-25 18:58:25 -04:00
JMP2r
2024-08-25 20:23:07 -04:00
@<draw-background> ( -- )
#0000 .Screen/x DEO2
.Screen/y DEI2
( ) ;fill-icn .Screen/addr DEO2
[ LIT2 f2 -Screen/auto ] DEO
2024-08-25 21:22:50 -04:00
[ LIT2 01 -Screen/sprite ] DEOk DEOk
2024-08-25 20:23:07 -04:00
( | .. )
.Screen/x DEI2 #0080 ADD2 .Screen/x DEO2
.Screen/y DEI2 #0010 SUB2 .Screen/y DEO2
DEOk DEO
.Screen/y DEO2
JMP2r
@<draw-list> ( addr* length folder selection -- )
,&sel STR
2024-08-25 19:40:01 -04:00
,&folder STR
2024-08-25 18:58:25 -04:00
DUP ?{ POP2 POP JMP2r }
#0008 .Screen/x DEO2
#00 SWP2 ,&t STR2
2024-08-25 19:40:01 -04:00
&>l ( -- )
2024-08-25 21:22:50 -04:00
[ LITr 05 ]
2024-08-25 20:23:07 -04:00
( | selected )
2024-08-25 21:22:50 -04:00
DUP [ LIT &sel $1 ] NEQ ?{
POPr [ LITr 06 ] <draw-background> }
( | folder )
[ LIT2 00 &folder $1 ] EQU ?{
.Screen/y DEI2 [ LIT2 15 -Screen/auto ] DEO
.Screen/width DEI2 #0010 SUB2 .Screen/x DEO2
[ LIT2 00 "> ] #20 SUB #50 SFT2 ;font/glyphs ADD2 .Screen/addr DEO2
2024-08-25 21:34:47 -04:00
DUPr [ LITr -Screen/sprite ] DEOkr
DEOr
2024-08-25 21:22:50 -04:00
.Screen/y DEO2 }
2024-08-25 20:23:07 -04:00
( | normal )
2024-08-25 18:58:25 -04:00
#0008 .Screen/x DEO2
2024-08-25 21:22:50 -04:00
#00 OVR #40 SFT2 [ LIT2 &t $2 ] ADD2 STHr <draw-uf2>
2024-08-25 18:58:25 -04:00
.Screen/y DEI2k #0010 ADD2 ROT DEO2
2024-08-25 19:40:01 -04:00
INC GTHk ?&>l
2024-08-25 21:22:50 -04:00
POP2 JMP2r
2024-08-25 18:58:25 -04:00
2024-08-25 23:14:00 -04:00
@get-uf2-width ( text* -- width* )
[ LIT2r 0000 ]
&>while ( -- )
LDAk #20 SUB #0000 ROT ;font ADD2 LDA STH2
ADD2r INC2 LDAk ?&>while
POP2 STH2r JMP2r
2024-08-25 23:17:17 -04:00
@<draw-uf2-right> ( text* color -- )
STH
.Screen/x DEI2 OVR2 get-uf2-width SUB2 .Screen/x DEO2
STHr !<draw-uf2>
2024-08-25 23:14:00 -04:00
@<draw-uf2-center> ( text* color -- )
STH
.Screen/x DEI2 OVR2 get-uf2-width #01 SFT2 SUB2 .Screen/x DEO2
STHr
( >> )
@<draw-uf2> ( text* color -- )
2024-08-25 18:58:25 -04:00
,&color STR
2024-08-25 18:22:45 -04:00
[ LIT2 15 -Screen/auto ] DEO
2024-08-25 19:40:01 -04:00
&>w ( -- )
2024-08-25 18:58:25 -04:00
LDAk #1f GTH ?{ POP2 JMP2r }
2024-08-25 18:22:45 -04:00
LDAk #20 SUB #00 SWP
2024-08-25 18:58:25 -04:00
( ) DUP2 #50 SFT2 ;font/glyphs ADD2 .Screen/addr DEO2
( ) ;font ADD2 LDA #00 SWP .Screen/x DEI2 ADD2
( ) [ LIT &color 05 ] .Screen/sprite DEOk DEO
2024-08-25 18:22:45 -04:00
.Screen/x DEO2
2024-08-25 19:40:01 -04:00
INC2 !&>w
2024-08-25 18:22:45 -04:00
2024-08-25 18:58:25 -04:00
@<update-cursor> ( color addr* -- )
;fill-icn .Screen/addr DEO2
#40 <draw-cursor>
2024-08-25 19:45:44 -04:00
.Screen/addr DEO2
2024-08-25 18:58:25 -04:00
.Mouse/x DEI2 ,<draw-cursor>/x STR2
.Mouse/y DEI2 ,<draw-cursor>/y STR2
2024-08-25 19:45:44 -04:00
( >> )
2024-08-25 17:49:47 -04:00
2024-08-25 18:58:25 -04:00
@<draw-cursor> ( color -- )
2024-08-25 19:45:44 -04:00
[ LIT2 16 -Screen/auto ] DEO
2024-08-25 18:58:25 -04:00
[ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 &y $2 ] .Screen/y DEO2
2024-08-25 19:45:44 -04:00
.Screen/sprite DEOk DEO
2024-08-25 18:58:25 -04:00
JMP2r
2024-08-25 17:49:47 -04:00
2024-08-26 12:38:32 -04:00
(
@|helpers )
@find-next ( buf* c -- index* )
,&t STR
&>loop ( -- )
LDAk [ LIT &t $1 ] EQU ?{ INC2 !&>loop }
JMP2r
@parse-dec ( buf* -- end* res* )
[ LIT2r 000a ] [ LIT2r 0000 ]
&>loop ( -- )
LDAk [ LIT "0 ] SUB DUP #09 GTH ?{
OVR2r MUL2r #00 SWP STH2
ADD2r INC2 !&>loop }
POP STH2r POP2r JMP2r
2024-08-25 18:58:25 -04:00
(
@|stdlib )
2024-08-25 17:49:47 -04:00
2024-08-25 18:58:25 -04:00
@scap ( str* -- end* )
2024-08-25 19:40:01 -04:00
2024-08-25 18:58:25 -04:00
&w ( -- )
2024-08-25 19:40:01 -04:00
INC2 & LDAk ?&w
2024-08-25 18:58:25 -04:00
JMP2r
2024-08-25 17:49:47 -04:00
2024-08-25 18:58:25 -04:00
@scmp3 ( a* b* -- f )
STH2
LDAkr LDAk STHr NEQ ?{ INC2r INC2 }
LDA2r LDA2 STH2r EQU2 JMP2r
2024-08-25 17:49:47 -04:00
2024-08-25 18:58:25 -04:00
@lcap ( str* -- next-line* )
2024-08-25 19:40:01 -04:00
2024-08-25 18:58:25 -04:00
&w ( -- )
2024-08-25 19:40:01 -04:00
LDAk #0a EQU ?{ INC2 & LDAk ?&w }
2024-08-25 18:58:25 -04:00
JMP2r
2024-08-25 17:49:47 -04:00
2024-08-25 18:58:25 -04:00
@<lcpy> ( src* dst* -- )
STH2
&w ( -- )
2024-08-25 19:40:01 -04:00
LDAk #1f GTH ?{
POP2 #00 STH2r STA
JMP2r }
LDAk #00 STH2kr STA2
INC2r INC2 !&w
2024-08-25 17:49:47 -04:00
2024-08-25 18:58:25 -04:00
@<scpy> ( src* dst* -- )
STH2
&w ( -- )
2024-08-25 19:40:01 -04:00
LDAk #00 STH2kr STA2
INC2r INC2 LDAk ?&w
2024-08-25 18:58:25 -04:00
POP2 POP2r JMP2r
2024-08-25 17:49:47 -04:00
2024-08-25 18:58:25 -04:00
@<pstr> ( str* -- )
2024-08-25 21:46:26 -04:00
LDAk #18 DEO
INC2 & LDAk ?<pstr>
2024-08-25 17:49:47 -04:00
POP2 JMP2r
2024-08-25 21:54:16 -04:00
@<perr> ( str* -- )
LDAk #19 DEO
INC2 & LDAk ?<perr>
POP2 JMP2r
2024-08-25 19:45:44 -04:00
@<phex> ( short* -: )
SWP /b
&b ( byte -: )
DUP #04 SFT /c
&c ( byte -: )
2024-08-25 21:46:26 -04:00
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #19 DEO
2024-08-25 19:45:44 -04:00
JMP2r
2024-08-25 18:22:45 -04:00
(
2024-08-25 18:58:25 -04:00
@|theme )
2024-08-25 18:22:45 -04:00
2024-08-25 18:58:25 -04:00
@<load-theme> ( -- )
;&path .File/name DEO2
#0002 .File/length DEO2
[ LIT2 -System/debug -System/r ]
&l ( -- )
2024-08-25 19:40:01 -04:00
;&buf .File/read DEO2
[ LIT2 00 -File/success-lb ] DEI EQU ?{
[ LIT2r &buf $2 ] STHk DEO2r
INC INC NEQk ?&l }
2024-08-25 18:22:45 -04:00
POP2 JMP2r
2024-08-25 19:40:01 -04:00
2024-08-25 18:58:25 -04:00
&path ".theme $1
2024-08-25 18:22:45 -04:00
(
@|assets )
2024-08-25 21:34:47 -04:00
@dict
&home-path "./ $1
&mp3-ext "mp3 $1
&empty "(empty) $1
2024-08-25 21:46:26 -04:00
&mpg-cmd "mpg123 20 "-R $1
2024-08-25 21:40:33 -04:00
&load-cmd "load 20 $1
2024-08-25 18:58:25 -04:00
2024-08-25 23:14:00 -04:00
@placeholder
&artist "Blood 20 "Girl $1
&track "Always 20 "Wrong $1
&album "Unknown 20 "Album $1
2024-08-25 23:17:17 -04:00
&time-a "0:31 $1
&time-b "2:25 $1
2024-08-25 23:14:00 -04:00
2024-08-25 18:22:45 -04:00
~src/assets.tal
2024-08-25 17:49:47 -04:00