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

141 lines
2.7 KiB
Tal
Raw Normal View History

2024-08-25 17:49:47 -04:00
( mp3.tal )
2024-08-25 18:22:45 -04:00
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|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
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
2024-08-25 17:49:47 -04:00
|100
@on-reset ( -> )
2024-08-25 18:22:45 -04:00
( | theme )
#d2d2 DUP2 .System/r DEO2
DUP2 .System/g DEO2
.System/b DEO2
<draw-directory>
BRK
2024-08-25 17:49:47 -04:00
( | initialize buffer )
;buffer ;buffer/pos STA2
( | run mpg123 )
;on-console .Console/vector DEO2
;program .Console/addr DEO2
( cmd addr ) #03 .Console/mode DEO
( cmd mode ) #01 .Console/exec DEO
( exec ) ;cmd1 print ;cmd2 print BRK
2024-08-25 18:22:45 -04:00
@<draw-directory> ( -- )
( here ) { ". $1 }
STH2r .File/name DEO2
#2000 .File/length DEO2
;dir .File/read DEO2
;dir <pstr>
#0010 DUP2 .Screen/x DEO2
.Screen/y DEO2
;dir <draw-uf2-line>
JMP2r
@<draw-uf2-line> ( addr* -- )
[ LIT2 15 -Screen/auto ] DEO
&>while ( -- )
LDAk #20 SUB #00 SWP
( addr ) DUP2 #50 SFT2 ;font/glyphs ADD2 .Screen/addr DEO2
( move ) ;font ADD2 LDA #00 SWP .Screen/x DEI2 ADD2
( draw ) [ LIT2 01 -Screen/sprite ] DEOk DEO
.Screen/x DEO2
INC2 LDAk #0a NEQ ?&>while
JMP2r
@<draw-uf2> ( text* -- )
[ LIT2 15 -Screen/auto ] DEO
&>while ( -- )
LDAk #20 SUB #00 SWP
( addr ) DUP2 #50 SFT2 ;font/glyphs ADD2 .Screen/addr DEO2
( move ) ;font ADD2 LDA #00 SWP .Screen/x DEI2 ADD2
( draw ) [ LIT2 01 -Screen/sprite ] DEOk DEO
.Screen/x DEO2
INC2 LDAk ?&>while
POP2 JMP2r
2024-08-25 17:49:47 -04:00
@printerr ( s* -> )
LDAk ?{
#0a .Console/error DEO
POP2 JMP2r }
LDAk .Console/error DEO
INC2 !printerr
@print ( s* -> )
LDAk ?{ POP2 JMP2r }
LDAk .Console/write DEO
INC2 !print
2024-08-25 18:22:45 -04:00
@on-console ( -> )
2024-08-25 17:49:47 -04:00
.Console/type DEI #01 EQU ?{ BRK }
.Console/read DEI #0a EQU ?&newline
;buffer/pos LDA2k STH2k .Console/read DEI STH2r STA
INC2 SWP2 STA2
BRK
&newline #00 ;buffer/pos LDA2 STA
on-line ;buffer ;buffer/pos STA2
BRK
@on-line ( -> )
2024-08-25 18:22:45 -04:00
;buffer LDAk [ LIT "@ ] EQU ?{ POP2 JMP2r }
INC2k LDA [ LIT "F ] EQU ?on-frame
2024-08-25 17:49:47 -04:00
!printerr
@on-frame ( buf* -> )
POP2 JMP2r
@on-help ( buf* -> )
POP2r JMP2r
@on-id3 ( buf* -> )
POP2 JMP2r
@on-paused ( buf* -> )
POP2 JMP2r
@on-revision ( buf* -> )
POP2 JMP2r
@on-status ( buf* -> )
POP2 JMP2r
@on-tag ( buf* -> )
POP2 JMP2r
2024-08-25 18:22:45 -04:00
(
@|stdlib )
@<phex> ( short* -: )
SWP /b
&b ( byte -: )
DUP #04 SFT /c
&c ( byte -: )
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO
JMP2r
@<pstr> ( str* -: )
LDAk #18 DEO
INC2 & LDAk ?<pstr>
POP2 JMP2r
(
@|assets )
2024-08-25 17:49:47 -04:00
@program "mpg123 20 "-R 00
@cmd1 "loadpaused 20 "always_wrong.mp3 0a 00
@cmd2 "pause 0a 00
2024-08-25 18:22:45 -04:00
~src/assets.tal
2024-08-25 17:49:47 -04:00