Guest User

tictrackerhex2trackertxt.sdlbas

a guest
Dec 2nd, 2017
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. finp$="cart_340_CopperBar_demo.tic_13_tunes_notes.hex"
  2. shell("xxd -r -p "+finp$+" > "+finp$+".bin")
  3.  
  4. gn$="C-C#D-D#E-F-F#G-G#A-A#B-"
  5.  
  6. open finp$+".bin" for input as #1
  7. open finp$+".txt" for output as #2
  8. while eof(1)=0
  9.   b0=readbyte(1)
  10.   b1=readbyte(1)
  11.   b2=readbyte(1)
  12.  
  13.   qv=15-(int(b0/16))
  14.   qn=(b0 mod 16)-4:if qn<0 then:q=0:end if
  15.   'qo=7-(int(b2/32))
  16.   qo=(int(b2/32))
  17.   qi=(b2 mod 32)+((int(b1/128))/4)
  18.   o$="--------"
  19.   o$=mid$(gn$,1+(qn*2),2)+hex$((qo+1) mod 16)+hex$(int(qi/16))+hex$(qi mod 16)+hex$(qv mod 16)+"--"
  20.   o$=ucase$(o$)
  21.   if b0+b1+b2=0 then:o$="--------":end if
  22.  
  23.   print #2,o$
  24.  
  25.   wend
  26. close #1
  27. close #2
Add Comment
Please, Sign In to add comment