home *** CD-ROM | disk | FTP | other *** search
- 100 print chr$(147):print " sidplayer utility duration converter"
- 110 print " by craig chamberlain":print
- 120 dn=8:sa=780:sx=781:sy=782:sp=783:dim vl(2),va(2)
- 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 mv=4436:fm=4548:ex=4602:sh=4858:uc=5160:uo=5161:er=5162
- 160 la=fndp(49)+500:mt=fndp(51)-500
- 300 f$="":input " load filename";f$:if f$="" or len(f$)>12 goto 300
- 310 print:gosub 600:poke sa,0:poke sx,fnl(la):poke sy,fnh(la)
- 320 sys 65493:if peek(sp)and1 goto 700
- 330 for k=0 to 2:vl(k)=fndp(la+2*k):next:ea=fndp(sx)
- 340 va(0)=la+6:va(1)=va(0)+vl(0):va(2)=va(1)+vl(1)
- 400 print " 1 expand":print " 2 contract":print " 3 save":print
- 402 print " which option? ";
- 404 wait 198,15:get g$:if g$="1" then cn=1:print "expand":print:goto 410
- 406 if g$="2" then cn=2:print "contract":print:goto 410
- 408 if g$="3" then print "save":print:goto 500
- 409 goto 404
- 410 print " which voice? ";
- 412 wait 198,15:get g$:if g$<"1" or g$>"3" goto 412
- 414 vn=asc(g$)-49:print g$:print
- 420 sm=-1:input " starting measure";sm:if sm>999 goto 420
- 422 print:if sm<0 then as=va(vn):goto 430
- 424 f=va(vn):t=va(vn)+vl(vn):m=sm:gosub 650
- 426 if a=t then print " error: not found":print:goto 420
- 428 as=a
- 430 em=1000:input " ending measure";em:if em<0 goto 430
- 432 print:if em>999 then ae=va(vn)+vl(vn):goto 440
- 434 f=as:t=va(vn)+vl(vn):m=em:gosub 650
- 436 if a=t then print " error: not found":print:goto 430
- 438 ae=a
- 440 print " 1 utl durations":print " 2 utv durations":print
- 442 print " which type? ";
- 444 wait 198,15:get g$:if g$<"1" or g$>"2" goto 444
- 446 un=asc(g$)-48:print g$:print
- 450 s=as:l=ea-as:d=mt-l:gosub 675
- 460 poke 251,fnl(d):poke 252,fnh(d)
- 462 z=d+ae-as:x=fnl(z):y=fnh(z)
- 464 poke 253,fnl(as):poke 254,fnh(as)
- 470 poke uo,4:poke uc,22:if un=2 then poke uo,36:poke uc,246
- 471 if cn=2 goto 475
- 472 poke sx,x:poke sy,y:sys ex
- 473 if peek(er) then print " error: illegal duration":end
- 474 ax=fndp(253):goto 480
- 475 poke sx,x:poke sy,y:sys sh
- 479 ax=fndp(253)
- 480 l=ea-ae:s=mt-l:d=ax:gosub 675
- 490 vl(vn)=vl(vn)+(ax-as)-(ae-as)
- 492 va(1)=va(0)+vl(0):va(2)=va(1)+vl(1)
- 494 ea=ea+(ax-as)-(ae-as)
- 496 goto 400
- 500 for k=0 to 2:poke la+2*k,fnl(vl(k)):poke la+2*k+1,fnh(vl(k)):next
- 510 f$="":input " save filename";f$:if f$="" or len(f$)>12 goto 510
- 520 print:gosub 600:poke sa,251:poke 251,fnl(la):poke 252,fnh(la)
- 530 poke sx,fnl(ea):poke sy,fnh(ea):sys 65496:if peek(sp)and1 goto 700
- 540 print " saved" ea-la "bytes":end
- 600 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
- 650 poke 251,fnl(f):poke 252,fnh(f)
- 652 poke 253,fnl(t):poke 254,fnh(t)
- 654 poke sx,fnl(m):poke sy,fnh(m)
- 656 sys fm:a=fndp(251):return
- 675 poke 251,fnl(s):poke 252,fnh(s)
- 676 poke 253,fnl(d):poke 254,fnh(d)
- 677 poke sx,fnl(l):poke sy,fnh(l):sys mv:return
- 700 if peek(sa)=4 then print " error: file not found":end
- 710 print " error":end
-