( 54K . id3csv ) |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 &read $5 &type $1 &write $1 &error $1 |a0 @File/vector $2 &success $1 &success-lb $1 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |000 @src/buf $40 |100 @on-reset ( -> ) [ LIT2 03 -Console/type ] DEI AND ?{ ;dict/usage str/ ! } ;src/on-console .Console/vector DEO2 BRK @ ( -- ) #800f DEO BRK ( @|Src ) @src/on-console ( -> ) [ LIT2 02 -Console/type ] DEI LTH ?{ .Console/read DEI / BRK } #0000 .Console/vector DEO2 ;&buf id3/ ! @src/ ( c -- ) [ LIT2 00 &ptr -&buf ] INCk ,&ptr STR STZ2 JMP2r ( @|Id3 ) @id3/ ( name* -- ) .File/name DEO2 ;&hdr #000a file/ [ LIT2 0a -File/success-lb ] DEI NEQ ?/ ;&hdr LDA2 [ LIT2 "ID ] NEQ2 ?/ #02 /get-byte LIT "3 NEQ ?/ #03 /get-byte DUP ;&ver STA #02 GTH ?{ !/ } ;dict/head str/ / !csv/ @id3/ ( -- ) ;dict/invalid !str/ @id3/ ( -- ) &>fr ;&hdr #000a file/ [ LIT2 0a -File/success-lb ] DEI EQU ?{ JMP2r } ;&hdr LDA DUP #30 LTH SWP #5a GTH ORA ?{ / !/>fr } JMP2r @id3/ ( -- ) /get-size /get-field STH /get-big STHkr #ff EQU ORA ?{ NIP2 ;&body OVR2 file/ STHr !/ } POPr !file/ @id3/ ( len* field -- ) #00 ;fields/buf ADD2 STH2 ;&body ADD2 ;&body INC2 &>c GTH2k ?{ POP2 POP2 #00 STH2r STA JMP2r } LDAk DUP #20 LTH SWP #fd GTH ORA ?{ LDAk STH2kr STA INC2r } INC2 !/>c @id3/get-byte ( i -- b ) #00 SWP ;&hdr ADD2 LDA JMP2r @id3/get-size ( -- hi* lo* ) [ LIT &ver $1 ] #04 EQU ?{ ( a ) #04 /get-byte ( b ) #05 /get-byte ( c ) #06 /get-byte ( d ) #07 !/get-byte } ( | synchsafe ) ( a ) #0004 /get-byte #50 SFT2 ( b ) #0005 /get-byte #02 SFT2 ORA2 ( c ) #0005 /get-byte #03 AND #e0 SFT2 ( d ) #0006 /get-byte #70 SFT2 ORA2 ( e ) #0007 /get-byte ORA2 JMP2r @id3/get-big ( hi* lo* -- hi* lo* flag ) DUP2 #00ff GTH2 STH OVR2 ORA STHr ORA JMP2r @id3/get-field ( -- field ) ;dict/ids &>f LDAk ?{ POP2 #ff JMP2r } DUP2 ;&hdr str/eq4 ?{ #0005 ADD2 !/>f } #0004 ADD2 LDA JMP2r ( @|Csv ) @csv/ ( -- ) #00 &>f DUP #00 ;fields/buf ADD2 / INC DUP #06 EQU ?{ [ LIT2 ", 18 ] DEO !/>f } POP #0a18 DEO JMP2r @csv/ ( str* -- ) &>c LDAk DUP ?{ POP POP2 JMP2r } DUP #22 NEQ ?{ } #18 DEO INC2 !/>c ( @|stdlib ) @file/ ( dst* len* -- ) .File/length DEO2 .File/read DEO2 JMP2r @file/ ( len* -- ) #0001 .File/length DEO2 &>s ORAk ?{ POP2 JMP2r } ;&b .File/read DEO2 #0001 SUB2 !/>s &b $1 @file/ ( hi* lo* -- ) / &>h ORAk ?{ POP2 JMP2r } #ffff / #0001 / #0001 SUB2 !/>h @str/ ( str* -- ) LDAk DUP ?{ POP POP2 JMP2r } #18 DEO INC2 !/ @str/ ( str* -- ) LDAk DUP ?{ POP POP2 JMP2r } #19 DEO INC2 !/ @str/eq4 ( a* b* -- flag ) OVR2 LDA2 OVR2 LDA2 EQU2 ?{ POP2 POP2 #00 JMP2r } INC2 INC2 LDA2 SWP2 INC2 INC2 LDA2 EQU2 JMP2r ( @|Assets ) @dict/head "title,artist,album,year,track,genre 0a 00 &ids "TIT2 00 "TPE1 01 "TALB 02 "TYER 03 "TDRC 03 "TRCK 04 "TCON 05 00 &usage "Usage: 20 "mp3csv 20 "file.mp3 0a 00 &invalid "Not 20 "ID3v2.3/2.4 20 "file. 0a 00 @id3/hdr $a &body $100 @fields/buf $600