Guest User

Vgm2VortexTrackerTxtAy_02.sdlbas

a guest
Feb 23rd, 2016
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /usr/bin/sdlbrt
  2. finp$="Nemesis_msx_02_Challenger1985.vgm"
  3. fout$=finp$+"_vortextracker_pre.txt"
  4.  
  5. frmc=0
  6. frmi=735
  7. frmr=300
  8. trg=0
  9. ltxtm$="+-...-.-+-...-.-+-...-.-+-..-+-........-+"
  10. freq0=0
  11. freq1=0
  12. freq2=0
  13. vol0=0
  14. vol1=0
  15. vol2=0
  16. freqq=0
  17.  
  18. open finp$ for input as #1
  19. open fout$ for output as #2
  20.  
  21. '- read 256 dummy bytes from the header - i have to know how to deal with this better later
  22. for eee=0 to 0x7F:q0=readbyte(1):next  '- read offset byte first
  23.  
  24. txou1$=" #("+str$(0)+")"
  25.  
  26. while eof(1)=0
  27.  
  28. q0=readbyte(1)
  29.  
  30. if bitwiseand(q0,0x70)=0x70 then
  31.   frmc=frmc+bitwiseand(q0,0xF)+1
  32.   txou1$=" #("+str$(frmc)+")"
  33.   'print #2,txou1$
  34.   end if
  35.  
  36. if q0=0x61 then
  37.   q0=readbyte(1)
  38.   frmc=frmc+q0
  39.   q0=readbyte(1)
  40.   frmc=frmc+(q0*256)
  41.   txou1$=" #("+str$(frmc)+")"
  42.   'print #2,txou1$
  43.   end if
  44.  
  45. if q0=0x62 then
  46.   frmc=frmc+735
  47.   txou1$=" #("+str$(frmc)+")"
  48.   'print #2,txou1$
  49.   end if
  50.  
  51.  
  52. while frmr<frmc
  53.   if trg=0 then
  54.     print #2,"--frameout-unchanged--"
  55.   else
  56.     print #2,"--frameout--"
  57.     trg=0
  58.     end if
  59.   frmr=frmr+frmi
  60.   end while
  61.  
  62.  
  63.  
  64. if q0=0xA0 then
  65.   q0=readbyte(1)
  66.  
  67.   if q0=0 then
  68.     q0=readbyte(1)
  69.     freq0= bitwiseor ( (bitwiseand(freq0,0xF00)),(bitwiseand(q0,0x0FF)) )
  70.     ltxtm1$=ltxtm$
  71.     ltxtm2$=left$(ltxtm1$,2)+ ucase$( right$(hex$(0x1000+freq0),3) ) +right$(ltxtm1$,36)+txou1$
  72.     print #2,ltxtm2$
  73.     trg=1
  74.     end if
  75.  
  76.   if q0=1 then
  77.     q0=readbyte(1)
  78.     freq0= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq0,0x0FF)) )
  79.     ltxtm1$=ltxtm$
  80.     ltxtm2$=left$(ltxtm1$,2)+ ucase$( right$(hex$(0x1000+freq0),3) ) +right$(ltxtm1$,36)+txou1$
  81.     print #2,ltxtm2$
  82.     trg=1
  83.     end if
  84.  
  85.   if q0=2 then
  86.     q0=readbyte(1)
  87.     freq1= bitwiseor ( (bitwiseand(freq1,0xF00)),(bitwiseand(q0,0x0FF)) )
  88.     ltxtm1$=ltxtm$
  89.     ltxtm2$=left$(ltxtm1$,10)+ ucase$( right$(hex$(0x1000+freq1),3) ) +right$(ltxtm1$,28)+txou1$
  90.     print #2,ltxtm2$
  91.     trg=1
  92.     end if
  93.  
  94.   if q0=3 then
  95.     q0=readbyte(1)
  96.     freq1= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq1,0x0FF)) )
  97.     ltxtm1$=ltxtm$
  98.     ltxtm2$=left$(ltxtm1$,10)+ ucase$( right$(hex$(0x1000+freq1),3) ) +right$(ltxtm1$,28)+txou1$
  99.     print #2,ltxtm2$
  100.     trg=1
  101.     end if
  102.  
  103.   if q0=4 then
  104.     q0=readbyte(1)
  105.     freq2= bitwiseor ( (bitwiseand(freq2,0xF00)),(bitwiseand(q0,0x0FF)) )
  106.     ltxtm1$=ltxtm$
  107.     ltxtm2$=left$(ltxtm1$,18)+ ucase$( right$(hex$(0x1000+freq2),3) ) +right$(ltxtm1$,20)+txou1$
  108.     print #2,ltxtm2$
  109.  
  110.     trg=1
  111.     end if
  112.  
  113.   if q0=5 then
  114.     q0=readbyte(1)
  115.     freq2= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq2,0x0FF)) )
  116.     ltxtm1$=ltxtm$
  117.     ltxtm2$=left$(ltxtm1$,18)+ ucase$( right$(hex$(0x1000+freq2),3) ) +right$(ltxtm1$,20)+txou1$
  118.     print #2,ltxtm2$
  119.     trg=1
  120.     end if
  121.  
  122.   if q0=6 then
  123.     print #2,ltxtm$
  124.     end if
  125.  
  126.   if q0=7 then
  127.     q0=readbyte(1)
  128.     ltxtm1$=ltxtm$
  129.     ltxtm2$=left$(ltxtm1$,31)+  right$(bin$(512+q0),8)  +right$(ltxtm1$,2)+txou1$
  130.     print #2,ltxtm2$
  131.     trg=1
  132.     end if
  133.  
  134.   if q0=8 then
  135.     q0=readbyte(1)
  136.     vol0= bitwiseand(q0,0xF)
  137.     ltxtm1$=ltxtm$
  138.     ltxtm2$=left$(ltxtm1$,6)+ ucase$( right$(hex$(0x10+vol0),1) ) +right$(ltxtm1$,34)+txou1$
  139.     print #2,ltxtm2$
  140.     trg=1
  141.     end if
  142.  
  143.   if q0=9 then
  144.     q0=readbyte(1)
  145.     vol1= bitwiseand(q0,0xF)
  146.     ltxtm1$=ltxtm$
  147.     ltxtm2$=left$(ltxtm1$,14)+ ucase$( right$(hex$(0x10+vol1),1) ) +right$(ltxtm1$,26)+txou1$
  148.     print #2,ltxtm2$
  149.     trg=1
  150.     end if
  151.  
  152.   if q0=10 then
  153.     q0=readbyte(1)
  154.     vol2= bitwiseand(q0,0xF)
  155.     ltxtm1$=ltxtm$
  156.     ltxtm2$=left$(ltxtm1$,22)+ ucase$( right$(hex$(0x10+vol2),1) ) +right$(ltxtm1$,18)+txou1$
  157.     print #2,ltxtm2$
  158.     trg=1
  159.     end if
  160.  
  161.   end if
  162.  
  163.  
  164.  
  165. wend
  166.  
  167. close #1:close #2
  168.  
  169. 'setdisplay(320,240,32,1):paper(8^8-1):ink(0):pen(0):cls
  170. 'loadimage("pic1.png",1):pasteicon(0,0,1)
  171. 'grab(1,0,0,320,240):saveimage("pic1b.bmp",1)
  172. 'waitkey
  173.  
  174.  
  175. 'a-4 =0x0FE
Add Comment
Please, Sign In to add comment