Guest User

Vgm2VortexTrackerTxtSn_02.sdlbas

a guest
Feb 23rd, 2016
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /usr/bin/sdlbrt
  2. finp$="AntarcticAdventure_ColecoVision_02_TheSkatersWaltz.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 0x3F: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,0xF0)=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=0x50 then
  65.   q0=readbyte(1)
  66.  
  67.   if bitwiseand (q0,128)=128 then
  68.  
  69.     if bitwiseand (q0,128)=0x90  then '- volume ch0
  70.       'freqq=0
  71.       vol0=15-bitwiseand(q0,0xF)
  72.       ltxtm1$=ltxtm$
  73.       ltxtm2$=left$(ltxtm1$,6)+ ucase$( right$(hex$(0x10+vol0),1) ) +right$(ltxtm1$,32)+txou1$
  74.       print #2,ltxtm2$
  75.       trg=1
  76.       end if
  77.  
  78.     if bitwiseand (q0,0xF0)=0xB0  then '- volume ch1
  79.       'freqq=1
  80.       vol1=15-bitwiseand(q0,0xF)
  81.       ltxtm1$=ltxtm$
  82.       ltxtm2$=left$(ltxtm1$,14)+ ucase$( right$(hex$(0x10+vol1),1) ) +right$(ltxtm1$,26)+txou1$
  83.       print #2,ltxtm2$
  84.       trg=1
  85.       end if
  86.  
  87.     if bitwiseand (q0,0xF0)=0xD0  then '- volume ch2
  88.       'freqq=2
  89.       vol2=15-bitwiseand(q0,0xF)
  90.       ltxtm1$=ltxtm$
  91.       ltxtm2$=left$(ltxtm1$,22)+ ucase$( right$(hex$(0x10+vol2),1) ) +right$(ltxtm1$,18)+txou1$
  92.       print #2,ltxtm2$
  93.       trg=1
  94.       end if
  95.  
  96.     if bitwiseand (q0,0xF0)=0xF0  then '- volume ch3
  97.       end if
  98.  
  99.     if bitwiseand (q0,0xF0)=0x80  then '- tone ch0
  100.       freqq=0
  101.       freq0= bitwiseor ( (bitwiseand(freq0,0xFF0)),(bitwiseand(q0,0x00F)) )
  102.       ltxtm1$=ltxtm$
  103.       ltxtm2$=left$(ltxtm1$,2)+ ucase$( right$(hex$(0x1000+freq0),3) ) +right$(ltxtm1$,36)+txou1$
  104.       print #2,ltxtm2$
  105.       trg=1
  106.       end if
  107.  
  108.     if bitwiseand (q0,0xF0)=0xA0  then '- tone ch1
  109.       freqq=1
  110.       freq1= bitwiseor ( (bitwiseand(freq1,0xFF0)),(bitwiseand(q0,0x00F)) )
  111.       ltxtm1$=ltxtm$
  112.       ltxtm2$=left$(ltxtm1$,10)+ ucase$( right$(hex$(0x1000+freq1),3) ) +right$(ltxtm1$,28)+txou1$
  113.       print #2,ltxtm2$
  114.       trg=1
  115.       end if
  116.  
  117.     if bitwiseand (q0,0xF0)=0xC0  then '- tone ch2
  118.       freqq=2
  119.       freq2= bitwiseor ( (bitwiseand(freq2,0xFF0)),(bitwiseand(q0,0x00F)) )
  120.       ltxtm1$=ltxtm$
  121.       ltxtm2$=left$(ltxtm1$,18)+ ucase$( right$(hex$(0x1000+freq2),3) ) +right$(ltxtm1$,20)+txou1$
  122.       print #2,ltxtm2$
  123.       trg=1
  124.       end if
  125.  
  126.     if bitwiseand (q0,0xF0)=0xE0  then '- freq noise
  127.       end if
  128.  
  129.     end if
  130.  
  131.   if bitwiseand (q0,128)=0 then
  132.     if freqq=0 then
  133.       freq0= bitwiseor ( (bitwiseand(q0,0x3F))*16,(bitwiseand(freq0,0x00F)) )
  134.       ltxtm1$=ltxtm$
  135.       ltxtm2$=left$(ltxtm1$,2)+ ucase$( right$(hex$(0x1000+freq0),3) ) +right$(ltxtm1$,36)+txou1$
  136.       print #2,ltxtm2$
  137.       trg=1
  138.       end if
  139.  
  140.     if freqq=1 then
  141.       freq1= bitwiseor ( (bitwiseand(q0,0x3F))*16,(bitwiseand(freq1,0x00F)) )
  142.       ltxtm1$=ltxtm$
  143.       ltxtm2$=left$(ltxtm1$,10)+ ucase$( right$(hex$(0x1000+freq1),3) ) +right$(ltxtm1$,28)+txou1$
  144.       print #2,ltxtm2$
  145.       trg=1
  146.       end if
  147.  
  148.     if freqq=2 then
  149.       freq2= bitwiseor ( (bitwiseand(q0,0x3F))*16,(bitwiseand(freq2,0x00F)) )
  150.       ltxtm1$=ltxtm$
  151.       ltxtm2$=left$(ltxtm1$,18)+ ucase$( right$(hex$(0x1000+freq2),3) ) +right$(ltxtm1$,20)+txou1$
  152.       print #2,ltxtm2$
  153.       trg=1
  154.       end if
  155.  
  156.     end if
  157.  
  158.   end if
  159.  
  160.  
  161. '---------------------------------------
  162. ''- start remark
  163. '
  164. 'if q0=0xA0 then
  165. '  q0=readbyte(1)
  166. '
  167. '  if q0=0 then
  168. '    q0=readbyte(1)
  169. '    freq0= bitwiseor ( (bitwiseand(freq0,0xF00)),(bitwiseand(q0,0x0FF)) )
  170. '    ltxtm1$=ltxtm$
  171. '    ltxtm2$=left$(ltxtm1$,2)+ ucase$( right$(hex$(0x1000+freq0),3) ) +right$(ltxtm1$,36)+txou1$
  172. '    print #2,ltxtm2$
  173. '    end if
  174. '
  175. '  if q0=1 then
  176. '    q0=readbyte(1)
  177. '    freq0= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq0,0x0FF)) )
  178. '    ltxtm1$=ltxtm$
  179. '    ltxtm2$=left$(ltxtm1$,2)+ ucase$( right$(hex$(0x1000+freq0),3) ) +right$(ltxtm1$,36)+txou1$
  180. '    print #2,ltxtm2$
  181. '    end if
  182. '
  183. '  if q0=2 then
  184. '    q0=readbyte(1)
  185. '    freq1= bitwiseor ( (bitwiseand(freq1,0xF00)),(bitwiseand(q0,0x0FF)) )
  186. '    ltxtm1$=ltxtm$
  187. '    ltxtm2$=left$(ltxtm1$,10)+ ucase$( right$(hex$(0x1000+freq1),3) ) +right$(ltxtm1$,28)+txou1$
  188. '    print #2,ltxtm2$
  189. '    end if
  190. '
  191. '  if q0=3 then
  192. '    q0=readbyte(1)
  193. '    freq1= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq1,0x0FF)) )
  194. '    ltxtm1$=ltxtm$
  195. '    ltxtm2$=left$(ltxtm1$,10)+ ucase$( right$(hex$(0x1000+freq1),3) ) +right$(ltxtm1$,28)+txou1$
  196. '    print #2,ltxtm2$
  197. '    end if
  198. '
  199. '  if q0=4 then
  200. '    q0=readbyte(1)
  201. '    freq2= bitwiseor ( (bitwiseand(freq2,0xF00)),(bitwiseand(q0,0x0FF)) )
  202. '    ltxtm1$=ltxtm$
  203. '    ltxtm2$=left$(ltxtm1$,18)+ ucase$( right$(hex$(0x1000+freq2),3) ) +right$(ltxtm1$,20)+txou1$
  204. '    print #2,ltxtm2$
  205. '    end if
  206. '
  207. '  if q0=5 then
  208. '    q0=readbyte(1)
  209. '    freq2= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq2,0x0FF)) )
  210. '    ltxtm1$=ltxtm$
  211. '    ltxtm2$=left$(ltxtm1$,18)+ ucase$( right$(hex$(0x1000+freq2),3) ) +right$(ltxtm1$,20)+txou1$
  212. '    print #2,ltxtm2$
  213. '    end if
  214. '
  215. '  if q0=6 then
  216. '    print #2,ltxtm$
  217. '    end if
  218. '
  219. '  if q0=7 then
  220. '    q0=readbyte(1)
  221. '    ltxtm1$=ltxtm$
  222. '    ltxtm2$=left$(ltxtm1$,31)+  right$(bin$(512+q0),8)  +right$(ltxtm1$,2)+txou1$
  223. '    print #2,ltxtm2$
  224. '    end if
  225. '
  226. '  if q0=8 then
  227. '    q0=readbyte(1)
  228. '    vol0= bitwiseand(q0,0xF)
  229. '    ltxtm1$=ltxtm$
  230. '    ltxtm2$=left$(ltxtm1$,6)+ ucase$( right$(hex$(0x10+vol0),1) ) +right$(ltxtm1$,34)+txou1$
  231. '    print #2,ltxtm2$
  232. '    end if
  233. '
  234. '  if q0=9 then
  235. '    q0=readbyte(1)
  236. '    vol1= bitwiseand(q0,0xF)
  237. '    ltxtm1$=ltxtm$
  238. '    ltxtm2$=left$(ltxtm1$,14)+ ucase$( right$(hex$(0x10+vol1),1) ) +right$(ltxtm1$,26)+txou1$
  239. '    print #2,ltxtm2$
  240. '    end if
  241. '
  242. '  if q0=10 then
  243. '    q0=readbyte(1)
  244. '    vol2= bitwiseand(q0,0xF)
  245. '    ltxtm1$=ltxtm$
  246. '    ltxtm2$=left$(ltxtm1$,22)+ ucase$( right$(hex$(0x10+vol2),1) ) +right$(ltxtm1$,18)+txou1$
  247. '    print #2,ltxtm2$
  248. '    end if
  249. '
  250. '  end if
  251. '
  252. ''- end remark
  253. ''---------------------------------------
  254. '
  255. '
  256.  
  257. wend
  258.  
  259. print #2,"--frameout--"
  260.  
  261.  
  262. close #1:close #2
  263.  
  264. 'setdisplay(320,240,32,1):paper(8^8-1):ink(0):pen(0):cls
  265. 'loadimage("pic1.png",1):pasteicon(0,0,1)
  266. 'grab(1,0,0,320,240):saveimage("pic1b.bmp",1)
  267. 'waitkey
  268.  
  269.  
  270. 'a-4 =0x0FE
Add Comment
Please, Sign In to add comment