Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/sdlbrt
- finp$="AntarcticAdventure_ColecoVision_02_TheSkatersWaltz.vgm"
- fout$=finp$+"_vortextracker_pre.txt"
- frmc=0
- frmi=735
- frmr=300
- trg=0
- ltxtm$="+-...-.-+-...-.-+-...-.-+-..-+-........-+"
- freq0=0
- freq1=0
- freq2=0
- vol0=0
- vol1=0
- vol2=0
- freqq=0
- open finp$ for input as #1
- open fout$ for output as #2
- '- read 256 dummy bytes from the header - i have to know how to deal with this better later
- for eee=0 to 0x3F:q0=readbyte(1):next '- read offset byte first
- txou1$=" #("+str$(0)+")"
- while eof(1)=0
- q0=readbyte(1)
- if bitwiseand(q0,0xF0)=0x70 then
- frmc=frmc+bitwiseand(q0,0xF)+1
- txou1$=" #("+str$(frmc)+")"
- 'print #2,txou1$
- end if
- if q0=0x61 then
- q0=readbyte(1)
- frmc=frmc+q0
- q0=readbyte(1)
- frmc=frmc+(q0*256)
- txou1$=" #("+str$(frmc)+")"
- 'print #2,txou1$
- end if
- if q0=0x62 then
- frmc=frmc+735
- txou1$=" #("+str$(frmc)+")"
- 'print #2,txou1$
- end if
- while frmr<frmc
- if trg=0 then
- print #2,"--frameout-unchanged--"
- else
- print #2,"--frameout--"
- trg=0
- end if
- frmr=frmr+frmi
- end while
- if q0=0x50 then
- q0=readbyte(1)
- if bitwiseand (q0,128)=128 then
- if bitwiseand (q0,128)=0x90 then '- volume ch0
- 'freqq=0
- vol0=15-bitwiseand(q0,0xF)
- ltxtm1$=ltxtm$
- ltxtm2$=left$(ltxtm1$,6)+ ucase$( right$(hex$(0x10+vol0),1) ) +right$(ltxtm1$,32)+txou1$
- print #2,ltxtm2$
- trg=1
- end if
- if bitwiseand (q0,0xF0)=0xB0 then '- volume ch1
- 'freqq=1
- vol1=15-bitwiseand(q0,0xF)
- ltxtm1$=ltxtm$
- ltxtm2$=left$(ltxtm1$,14)+ ucase$( right$(hex$(0x10+vol1),1) ) +right$(ltxtm1$,26)+txou1$
- print #2,ltxtm2$
- trg=1
- end if
- if bitwiseand (q0,0xF0)=0xD0 then '- volume ch2
- 'freqq=2
- vol2=15-bitwiseand(q0,0xF)
- ltxtm1$=ltxtm$
- ltxtm2$=left$(ltxtm1$,22)+ ucase$( right$(hex$(0x10+vol2),1) ) +right$(ltxtm1$,18)+txou1$
- print #2,ltxtm2$
- trg=1
- end if
- if bitwiseand (q0,0xF0)=0xF0 then '- volume ch3
- end if
- if bitwiseand (q0,0xF0)=0x80 then '- tone ch0
- freqq=0
- freq0= bitwiseor ( (bitwiseand(freq0,0xFF0)),(bitwiseand(q0,0x00F)) )
- ltxtm1$=ltxtm$
- ltxtm2$=left$(ltxtm1$,2)+ ucase$( right$(hex$(0x1000+freq0),3) ) +right$(ltxtm1$,36)+txou1$
- print #2,ltxtm2$
- trg=1
- end if
- if bitwiseand (q0,0xF0)=0xA0 then '- tone ch1
- freqq=1
- freq1= bitwiseor ( (bitwiseand(freq1,0xFF0)),(bitwiseand(q0,0x00F)) )
- ltxtm1$=ltxtm$
- ltxtm2$=left$(ltxtm1$,10)+ ucase$( right$(hex$(0x1000+freq1),3) ) +right$(ltxtm1$,28)+txou1$
- print #2,ltxtm2$
- trg=1
- end if
- if bitwiseand (q0,0xF0)=0xC0 then '- tone ch2
- freqq=2
- freq2= bitwiseor ( (bitwiseand(freq2,0xFF0)),(bitwiseand(q0,0x00F)) )
- ltxtm1$=ltxtm$
- ltxtm2$=left$(ltxtm1$,18)+ ucase$( right$(hex$(0x1000+freq2),3) ) +right$(ltxtm1$,20)+txou1$
- print #2,ltxtm2$
- trg=1
- end if
- if bitwiseand (q0,0xF0)=0xE0 then '- freq noise
- end if
- end if
- if bitwiseand (q0,128)=0 then
- if freqq=0 then
- freq0= bitwiseor ( (bitwiseand(q0,0x3F))*16,(bitwiseand(freq0,0x00F)) )
- ltxtm1$=ltxtm$
- ltxtm2$=left$(ltxtm1$,2)+ ucase$( right$(hex$(0x1000+freq0),3) ) +right$(ltxtm1$,36)+txou1$
- print #2,ltxtm2$
- trg=1
- end if
- if freqq=1 then
- freq1= bitwiseor ( (bitwiseand(q0,0x3F))*16,(bitwiseand(freq1,0x00F)) )
- ltxtm1$=ltxtm$
- ltxtm2$=left$(ltxtm1$,10)+ ucase$( right$(hex$(0x1000+freq1),3) ) +right$(ltxtm1$,28)+txou1$
- print #2,ltxtm2$
- trg=1
- end if
- if freqq=2 then
- freq2= bitwiseor ( (bitwiseand(q0,0x3F))*16,(bitwiseand(freq2,0x00F)) )
- ltxtm1$=ltxtm$
- ltxtm2$=left$(ltxtm1$,18)+ ucase$( right$(hex$(0x1000+freq2),3) ) +right$(ltxtm1$,20)+txou1$
- print #2,ltxtm2$
- trg=1
- end if
- end if
- end if
- '---------------------------------------
- ''- start remark
- '
- 'if q0=0xA0 then
- ' q0=readbyte(1)
- '
- ' if q0=0 then
- ' q0=readbyte(1)
- ' freq0= bitwiseor ( (bitwiseand(freq0,0xF00)),(bitwiseand(q0,0x0FF)) )
- ' ltxtm1$=ltxtm$
- ' ltxtm2$=left$(ltxtm1$,2)+ ucase$( right$(hex$(0x1000+freq0),3) ) +right$(ltxtm1$,36)+txou1$
- ' print #2,ltxtm2$
- ' end if
- '
- ' if q0=1 then
- ' q0=readbyte(1)
- ' freq0= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq0,0x0FF)) )
- ' ltxtm1$=ltxtm$
- ' ltxtm2$=left$(ltxtm1$,2)+ ucase$( right$(hex$(0x1000+freq0),3) ) +right$(ltxtm1$,36)+txou1$
- ' print #2,ltxtm2$
- ' end if
- '
- ' if q0=2 then
- ' q0=readbyte(1)
- ' freq1= bitwiseor ( (bitwiseand(freq1,0xF00)),(bitwiseand(q0,0x0FF)) )
- ' ltxtm1$=ltxtm$
- ' ltxtm2$=left$(ltxtm1$,10)+ ucase$( right$(hex$(0x1000+freq1),3) ) +right$(ltxtm1$,28)+txou1$
- ' print #2,ltxtm2$
- ' end if
- '
- ' if q0=3 then
- ' q0=readbyte(1)
- ' freq1= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq1,0x0FF)) )
- ' ltxtm1$=ltxtm$
- ' ltxtm2$=left$(ltxtm1$,10)+ ucase$( right$(hex$(0x1000+freq1),3) ) +right$(ltxtm1$,28)+txou1$
- ' print #2,ltxtm2$
- ' end if
- '
- ' if q0=4 then
- ' q0=readbyte(1)
- ' freq2= bitwiseor ( (bitwiseand(freq2,0xF00)),(bitwiseand(q0,0x0FF)) )
- ' ltxtm1$=ltxtm$
- ' ltxtm2$=left$(ltxtm1$,18)+ ucase$( right$(hex$(0x1000+freq2),3) ) +right$(ltxtm1$,20)+txou1$
- ' print #2,ltxtm2$
- ' end if
- '
- ' if q0=5 then
- ' q0=readbyte(1)
- ' freq2= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq2,0x0FF)) )
- ' ltxtm1$=ltxtm$
- ' ltxtm2$=left$(ltxtm1$,18)+ ucase$( right$(hex$(0x1000+freq2),3) ) +right$(ltxtm1$,20)+txou1$
- ' print #2,ltxtm2$
- ' end if
- '
- ' if q0=6 then
- ' print #2,ltxtm$
- ' end if
- '
- ' if q0=7 then
- ' q0=readbyte(1)
- ' ltxtm1$=ltxtm$
- ' ltxtm2$=left$(ltxtm1$,31)+ right$(bin$(512+q0),8) +right$(ltxtm1$,2)+txou1$
- ' print #2,ltxtm2$
- ' end if
- '
- ' if q0=8 then
- ' q0=readbyte(1)
- ' vol0= bitwiseand(q0,0xF)
- ' ltxtm1$=ltxtm$
- ' ltxtm2$=left$(ltxtm1$,6)+ ucase$( right$(hex$(0x10+vol0),1) ) +right$(ltxtm1$,34)+txou1$
- ' print #2,ltxtm2$
- ' end if
- '
- ' if q0=9 then
- ' q0=readbyte(1)
- ' vol1= bitwiseand(q0,0xF)
- ' ltxtm1$=ltxtm$
- ' ltxtm2$=left$(ltxtm1$,14)+ ucase$( right$(hex$(0x10+vol1),1) ) +right$(ltxtm1$,26)+txou1$
- ' print #2,ltxtm2$
- ' end if
- '
- ' if q0=10 then
- ' q0=readbyte(1)
- ' vol2= bitwiseand(q0,0xF)
- ' ltxtm1$=ltxtm$
- ' ltxtm2$=left$(ltxtm1$,22)+ ucase$( right$(hex$(0x10+vol2),1) ) +right$(ltxtm1$,18)+txou1$
- ' print #2,ltxtm2$
- ' end if
- '
- ' end if
- '
- ''- end remark
- ''---------------------------------------
- '
- '
- wend
- print #2,"--frameout--"
- close #1:close #2
- 'setdisplay(320,240,32,1):paper(8^8-1):ink(0):pen(0):cls
- 'loadimage("pic1.png",1):pasteicon(0,0,1)
- 'grab(1,0,0,320,240):saveimage("pic1b.bmp",1)
- 'waitkey
- 'a-4 =0x0FE
Add Comment
Please, Sign In to add comment