(m291) Only draw spacer when needed

This commit is contained in:
Devine Lu Linvega 2024-08-27 15:46:02 -07:00
parent 85b07d0b30
commit 1edfc705cb
2 changed files with 4 additions and 134 deletions

View File

@ -97,7 +97,7 @@
&status-bar ( y* -> )
POP2 .Mouse/state DEI ?{ BRK }
.Mouse/x DEI2 .Screen/width DEI2 #0014 SUB2 GTH2 ?{ BRK }
.Mouse/x DEI2 .Screen/width DEI2 #0018 SUB2 GTH2 ?{ BRK }
<change-mode>
;on-mouse-locked .Mouse/vector DEO2
BRK
@ -381,7 +381,8 @@
.lines/folders LDZ .lines/tracks LDZ ADD JMP2r
@has-spacer ( -- f )
[ LIT2 00 -lines/folders ] LDZ NEQ [ LIT2 00 -lines/tracks ] LDZ NEQ AND JMP2r
[ LIT2 00 -lines/folders ] LDZ NEQ
( .. ) [ LIT2 00 -lines/tracks ] LDZ NEQ AND JMP2r
@is-folder ( line* -- line* f )
DUP2 lcap/ #0001 SUB2 LDA [ LIT "/ ] EQU JMP2r
@ -474,7 +475,7 @@
;dict/empty #0f !<draw-uf2> }
( | folders )
;mem/folders .lines/folders LDZ .selection LDZ <draw-folders>
[ LIT2 00 -lines/folders ] LDZ EQU ?{ ;dash-icn <draw-spacer> }
has-spacer #00 EQU ?{ ;dash-icn <draw-spacer> }
;mem/tracks .lines/tracks LDZ .selection LDZ .lines/folders LDZ SUB
( >> )

View File

@ -1,131 +0,0 @@
( mp3.tal )
( commands are ended by newlines: )
( )
( help show all these commands )
( load FILE load FILE and start playing )
( loadpaused FILE load FILE without playing )
( pause pause, or unpause, playback )
( stop stops playback, unloads file )
( seek # seeks to sample # )
( seek +N | seek -N seeks forward, or back, N samples )
( seek +Ns | seek -Ns seeks forward, or back, N seconds )
( jump # jumps to MPEG frame # )
( jump +N | jump -N jumps forward, or back, N frames )
( jump +Ns | jump -Ns jumps forward, or back, N seconds )
( volume P set volume to P percent, 0-100 )
( mute mute playback )
( unmute unmute playback )
( tag print all ID3 data; seeking back may remove tag data )
@Console [
|10 &vector $2
|12 &read $1
( 13 - 14 padding )
|15 &live $1
|15 &exit $1
|17 &type $1
|18 &write $1
|19 &error $1
( 1a - 1b padding )
|1c &addr $2
|1e &mode $1
|1f &exec $1
]
|0100
( 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 ( pos* buf* [buf*] )
.Console/read DEI STH2r STA ( pos* buf ; buf<-c )
INC2 SWP2 STA2 BRK ( ; pos<-buf+1 )
&newline ( )
#00 ;buffer/pos LDA2 STA on-line ( ; buf<-0, run on-line )
;buffer ;buffer/pos STA2 BRK ( )
( called when a newline is reached )
( buffer is guaranteed to be null-terminated )
( newline is implied but not included )
@on-line ( -> )
;buffer LDAk LIT "@ EQU ?{ POP2 JMP2r }
INC2k LDA LIT "F EQU ?on-frame
( INC2k LDA LIT "H EQU ?on-help )
( INC2k LDA LIT "I EQU ?on-id3 )
( INC2k LDA LIT "P EQU ?on-paused )
( INC2k LDA LIT "R EQU ?on-revision )
( INC2k LDA LIT "S EQU ?on-status )
( INC2k LDA LIT "T EQU ?on-tag )
!printerr
( e.g. "@F 184 8713 4.81 227.60" )
( seen when playing )
( the fields here are: )
( @F <curr-frame> <total-frames> <curr-secs> <total-secs> )
@on-frame ( buf* -> )
POP2 JMP2r
( e.g. "@H HELP/H: command listing (LONG/SHORT forms), command case insensitve" )
( seen in response to the "help" command )
@on-help ( buf* -> )
POP2r JMP2r
( e.g. "@I ID3v2.artist:Chipzel" )
( seen when loading a track )
@on-id3 ( buf* -> )
POP2 JMP2r
( e.g. "@P 0" or "@P 1" )
( seen when pausing or unpausing )
@on-paused ( buf* -> )
POP2 JMP2r
( e.g. "@R MPG123 (ThOr) v10" )
( seen on start up )
@on-revision ( buf* -> )
POP2 JMP2r
( e.g. "@S 1.0 3 44100 Joint-Stereo 0 1044 2 0 0 0 320 0 1" )
( seen when playback starts )
@on-status ( buf* -> )
POP2 JMP2r
( e.g. "@T ID3v2.TPE1:" )
( seen in response to the "tag" command for extended tag info )
@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 )