Guest User

tictrackerbin2trackertxt.sdlbas

a guest
Dec 2nd, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. finp$="cart_340_CopperBar_demo.tic"
  2.  
  3. 'shell("xxd -r -p "+finp$+" > "+finp$+".bin")
  4.  
  5. open finp$ for input as #1
  6. open finp$+".bin" for output as #2
  7. while eof(1)=0:
  8.   qs=readbyte(1)
  9.   s0=readbyte(1)
  10.   s1=readbyte(1)
  11.   s2=readbyte(1)
  12.   st=(s2*65536)+(s1*256)+s0
  13.   for qq=0 to st-1
  14.     rb=readbyte(1)
  15.     if qs=13 then
  16.       writebyte(2,rb)
  17.       end if
  18.     next
  19.   wend
  20. close #1
  21. close #2
  22.  
  23. gn$="C-C#D-D#E-F-F#G-G#A-A#B-"
  24.  
  25. open finp$+".bin" for input as #1
  26. open finp$+".txt" for output as #2
  27. while eof(1)=0
  28.   b0=readbyte(1)
  29.   b1=readbyte(1)
  30.   b2=readbyte(1)
  31.  
  32.   qv=15-(int(b0/16))
  33.   qn=(b0 mod 16)-4:if qn<0 then:q=0:end if
  34.   'qo=7-(int(b2/32))
  35.   qo=(int(b2/32))
  36.   qi=(b2 mod 32)+((int(b1/128))/4)
  37.   o$="--------"
  38.   o$=mid$(gn$,1+(qn*2),2)+hex$((qo+1) mod 16)+hex$(int(qi/16))+hex$(qi mod 16)+hex$(qv mod 16)+"--"
  39.   o$=ucase$(o$)
  40.   if b0+b1+b2=0 then:o$="--------":end if
  41.  
  42.   print #2,o$
  43.  
  44.   wend
  45. close #1
  46. close #2
Add Comment
Please, Sign In to add comment