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

82 lines
1.3 KiB
Tal
Raw Normal View History

2024-08-25 17:49:47 -04:00
( mp3.tal )
@Console [
|10 &vector $2 |12
&read $1 |15 &live
$1 |15 &exit $1
|17 &type $1 |18
&write $1 |19 &error
$1 |1c &addr $2
|1e &mode $1 |1f
&exec $1 ]
|100
@on-reset ( -> )
( | 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
@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
@on-console ( -> brk )
.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 ( -> )
;buffer LDAk LIT "@ EQU ?{ POP2 JMP2r }
INC2k LDA LIT "F EQU ?on-frame
!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
@program "mpg123 20 "-R 00
@cmd1 "loadpaused 20 "always_wrong.mp3 0a 00
@cmd2 "pause 0a 00
@buffer $200 &pos $2
( input buffer )