home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette: SID64
/
SID64.D64
/
merge.64
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
2KB
|
47 lines
100 print chr$(147):print " sidplayer music file merge utility"
110 print " by craig chamberlain":print
120 dn=8:sa=780:sx=781:sy=782:sp=783:ta=0:tb=0:dim la(3),lb(3)
130 def fnh(n)=int(n/256):def fnl(n)=n-256*int(n/256)
140 def fndp(n)=peek(n)+256*peek(n+1)
150 for k=49152 to 49313:read n:poke k,n:next:mb=49152:bg=49263
160 s=0:d=0:l=0:ba=fndp(49)+100:mt=fndp(51)-100
300 f$="":input " load filename";f$:if f$="" or len(f$)>12 goto 300
310 gosub 600:poke sa,0:poke sx,fnl(ba):poke sy,fnh(ba)
320 sys 65493:if peek(sp)and1 goto 700
330 for v=1 to 3:la(v)=fndp(ba+2*v-2):ta=ta+la(v):next:a=fndp(sx)
400 f$="":input " append filename";f$:if len(f$)>12 goto 400
410 print:if f$="" goto 500
420 f$=f$+".mus":open 1,dn,0,f$:get#1,l$,h$
430 for v=1 to 3:get#1,l$,h$:lb(v)=asc(l$+chr$(0))+256*asc(h$+chr$(0))
435 ta=ta+lb(v)-2:next
440 if ta>mt-ba then print " error: not enough memory":close 1:end
450 a=ba+6:s=a+la(1):l=la(2)+la(3)-2:d=mt-l:gosub 630:a=a+la(1)-2:s=a:l=lb(1)
460 gosub 660:a=a+l:l=la(2)-2:s=mt-la(3)-l:d=a:gosub 630:a=a+l:s=a:l=lb(2)
470 gosub 660:a=a+l:l=la(3)-2:s=mt-l:d=a:gosub 630:a=a+l:s=a:l=lb(3):gosub 660
480 a=a+l:if st goto 520
490 k=fre(0):get#1,f$:if f$<>"" then poke a,asc(f$):a=a+1:goto 490
495 close 1:poke a,0:a=a+1:for v=1 to 3:la(v)=la(v)+lb(v)-2:next:goto 400
500 for v=1 to 3:poke ba+2*v-2,fnl(la(v)):poke ba+2*v-1,fnh(la(v)):next
510 f$="":input " save filename";f$:if f$="" or len(f$)>12 goto 510
520 gosub 600:poke sa,251:poke 251,fnl(ba):poke 252,fnh(ba)
530 poke sx,fnl(a):poke sy,fnh(a):sys 65496:if peek(sp)and1 goto 700
540 print " saved" a-ba "bytes":end
600 print:poke sa,1:poke sx,dn:poke sy,0:sys 65466:f$=f$+".mus"
610 for k=1 to len(f$):poke 584+k,asc(mid$(f$,k)):next
620 poke sa,len(f$):poke sx,73:poke sy,2:sys 65469:return
630 poke 251,fnl(s):poke 252,fnh(s):poke 253,fnl(d):poke 254,fnh(d)
640 poke sx,fnl(l):poke sy,fnh(l):sys mb:return
660 poke 251,fnl(s):poke 252,fnh(s):poke 253,fnl(l):poke 254,fnh(l)
670 sys bg:if peek(sp)and1 then close 1:goto 700
680 return
700 print " error":end
800 data 142,109,192,140,110,192,165,253,56,229,251,170,165,254,229,252,236,109
801 data 192,237,110,192,144,35,160,0,174,110,192,240,14,177,251,145,253,200
802 data 208,249,230,252,230,254,202,208,242,174,109,192,240,8,177,251,145,253
803 data 200,202,208,248,96,173,110,192,168,101,252,133,252,152,24,101,254,133
804 data 254,172,109,192,240,9,136,177,251,145,253,192,0,208,247,174,110,192
805 data 240,16,198,252,198,254,136,177,251,145,253,192,0,208,247,202,208,240
806 data 96,0,0,162,1,32,198,255,176,43,165,251,168,101,253,133,253,165,252,101
807 data 254,133,254,169,0,133,251,32,207,255,176,21,145,251,200,208,2,230,252
808 data 196,253,208,240,165,252,197,254,208,234,32,204,255,24,96