1( mp3.tal )
2
3( commands are ended by newlines: )
4( )
5( help show all these commands )
6( load FILE load FILE and start playing )
7( loadpaused FILE load FILE without playing )
8( pause pause, or unpause, playback )
9( stop stops playback, unloads file )
10( seek # seeks to sample # )
11( seek +N | seek -N seeks forward, or back, N samples )
12( seek +Ns | seek -Ns seeks forward, or back, N seconds )
13( jump # jumps to MPEG frame # )
14( jump +N | jump -N jumps forward, or back, N frames )
15( jump +Ns | jump -Ns jumps forward, or back, N seconds )
16( volume P set volume to P percent, 0-100 )
17( mute mute playback )
18( unmute unmute playback )
19( tag print all ID3 data; seeking back may remove tag data )
20
21@Console [
22 |10 &vector $2
23 |12 &read $1
24 ( 13 - 14 padding )
25 |15 &live $1
26 |15 &exit $1
27 |17 &type $1
28 |18 &write $1
29 |19 &error $1
30 ( 1a - 1b padding )
31 |1c &addr $2
32 |1e &mode $1
33 |1f &exec $1
34]
35
36|0100
37 ( initialize buffer )
38 ;buffer ;buffer/pos STA2
39
40 ( run mpg123 )
41 ;on-console .Console/vector DEO2
42 ;program .Console/addr DEO2 ( cmd addr )
43 #03 .Console/mode DEO ( cmd mode )
44 #01 .Console/exec DEO ( exec )
45
46 ;cmd1 print
47 ;cmd2 print
48
49 BRK
50
51@printerr ( s* -> )
52 LDAk ?{ #0a .Console/error DEO POP2 JMP2r }
53 LDAk .Console/error DEO INC2 !printerr
54
55@print ( s* -> )
56 LDAk ?{ POP2 JMP2r }
57 LDAk .Console/write DEO INC2 !print
58
59@on-console ( -> brk )
60 .Console/type DEI #01 EQU ?{ BRK } ( )
61 .Console/read DEI #0a EQU ?&newline ( )
62 ;buffer/pos LDA2k STH2k ( pos* buf* [buf*] )
63 .Console/read DEI STH2r STA ( pos* buf ; buf<-c )
64 INC2 SWP2 STA2 BRK ( ; pos<-buf+1 )
65 &newline ( )
66 #00 ;buffer/pos LDA2 STA on-line ( ; buf<-0, run on-line )
67 ;buffer ;buffer/pos STA2 BRK ( )
68
69
70( called when a newline is reached )
71( buffer is guaranteed to be null-terminated )
72( newline is implied but not included )
73@on-line ( -> )
74 ;buffer LDAk LIT "@ EQU ?{ POP2 JMP2r }
75 INC2k LDA LIT "F EQU ?on-frame
76 ( INC2k LDA LIT "H EQU ?on-help )
77 ( INC2k LDA LIT "I EQU ?on-id3 )
78 ( INC2k LDA LIT "P EQU ?on-paused )
79 ( INC2k LDA LIT "R EQU ?on-revision )
80 ( INC2k LDA LIT "S EQU ?on-status )
81 ( INC2k LDA LIT "T EQU ?on-tag )
82 !printerr
83
84( e.g. "@F 184 8713 4.81 227.60" )
85( seen when playing )
86( the fields here are: )
87( @F <curr-frame> <total-frames> <curr-secs> <total-secs> )
88@on-frame ( buf* -> )
89 POP2 JMP2r
90
91( e.g. "@H HELP/H: command listing (LONG/SHORT forms), command case insensitve" )
92( seen in response to the "help" command )
93@on-help ( buf* -> )
94 POP2r JMP2r
95
96( e.g. "@I ID3v2.artist:Chipzel" )
97( seen when loading a track )
98@on-id3 ( buf* -> )
99 POP2 JMP2r
100
101( e.g. "@P 0" or "@P 1" )
102( seen when pausing or unpausing )
103@on-paused ( buf* -> )
104 POP2 JMP2r
105
106( e.g. "@R MPG123 (ThOr) v10" )
107( seen on start up )
108@on-revision ( buf* -> )
109 POP2 JMP2r
110
111( e.g. "@S 1.0 3 44100 Joint-Stereo 0 1044 2 0 0 0 320 0 1" )
112( seen when playback starts )
113@on-status ( buf* -> )
114 POP2 JMP2r
115
116( e.g. "@T ID3v2.TPE1:" )
117( seen in response to the "tag" command for extended tag info )
118@on-tag ( buf* -> )
119 POP2 JMP2r
120
121@program
122 "mpg123 20 "-R 00
123
124@cmd1
125 "loadpaused 20 "always_wrong.mp3 0a 00
126
127@cmd2
128 "pause 0a 00
129
130
131@buffer $200 &pos $2 ( input buffer )