Vgm2FamiTrackerTxtAy38910x3.sdlbasic 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. #! /usr/bin/sdlbrt
  2. finp$="tune.vgm"
  3. '- .vgm to FamiTracker .txt converter - AY-3-8910 (x3) version
  4. '- copyleft Paulo Silva, oct'20
  5. '-------------------------------
  6. '- bugs:
  7. '- - an acute sound might appear because an issue related to volume 0 that VortexTracker doesnt support, R-- note used instead (and the converter should store which note/frequency is for a probable volume changing, and set back the note/frequency value back)
  8. '- - doesn't read yet the author/title information
  9. '- - 'L' will be useful for the loop point location
  10. '- - probably will need a sample counter before converting
  11. '- - missing noise support
  12. '- - frequncy inaccuracy from the germanic notation formula probably fixed, needs more testing
  13. '-------------------------------
  14. ltxtm$="ROW .. : ... .. . ... : ... .. . ... : ... .. . ... : ... .. . ... : ... .. . ... : ... .. . ... : ... .. . ... : ... .. . ... : ... .. . ... : ... .. . ... : ... .. . ... : ... .. . ... : ... .. . ...":ltxcr$=ltxtm$
  15. freq0=0:freq1=0:freq2=0:vol0=0:vol1=0:vol2=0
  16. patsz=48:patc=0:patid=0:freqq=0
  17. hdram=0x40:vgmv=0:veof=0
  18. dim hdrv[256]
  19. if argc>2 then:finp$=argv(2):end if
  20. fout2$=finp$+"_famitracker.txt":fout3$=finp$+"_famitracker_debug.txt"
  21. frmc=0:frmr=300:trg=0
  22. frmi=735
  23. if argc>3 then:
  24. if argv(3)="1" or ucase$(argv(2))="-PAL" then
  25. frmi=882:end if:end if
  26. debug=0
  27. if argc>4 then:
  28. if argv(4)="1" or ucase$(argv(2))="-DEBUG" then
  29. debug=1:end if:end if
  30. '- fix: 0x0FE=440hz=A-4
  31. function nttfrq$(freqb)
  32. e$= "C-1C#1D-1D#1E-1F-1F#1G-1G#1A-1A#1B-1"
  33. e$=e$+"C-2C#2D-2D#2E-2F-2F#2G-2G#2A-2A#2B-2"
  34. e$=e$+"C-3C#3D-3D#3E-3F-3F#3G-3G#3A-3A#3B-3"
  35. e$=e$+"C-4C#4D-4D#4E-4F-4F#4G-4G#4A-4A#4B-4"
  36. e$=e$+"C-5C#5D-5D#5E-5F-5F#5G-5G#5A-5A#5B-5"
  37. e$=e$+"C-6C#6D-6D#6E-6F-6F#6G-6G#6A-6A#6B-6"
  38. e$=e$+"C-7C#7D-7D#7E-7F-7F#7G-7G#7A-7A#7B-7"
  39. e$=e$+"C-8C#8D-8D#8E-8F-8F#8G-8G#8A-8A#8B-8..."
  40. tmq=141-(int((log(freqb*.99)/log(2))*12))
  41. if tmq<1 then:tmq=1:end if
  42. if tmq>84 then:tmq=84:end if
  43. return mid$(e$,(tmq*3)-2,3)
  44. end function
  45. open finp$ for input as #1
  46. for i=0 to 255
  47. hdrv[i]=readbyte(1)
  48. next
  49. close #1
  50. hdram=0x040
  51. vgmv=hdrv[8]+hdrv[9]*256
  52. if vgmv>=0x0150 then:hdram=0x080:end if
  53. if vgmv>=0x0170 then:hdram=0x100:end if
  54. '- wrong information???
  55. ttsam=hdrv[0x18]+hdrv[0x19]*256+hdrv[0x1A]*65536+hdrv[0x1B]*16777216
  56. hsam$="PlayOrder=L0"
  57. for i=1 to (ttsam/(frmi*patsz))-1
  58. hsam$=hsam$+","+str$(i)
  59. next
  60. open finp$ for input as #1
  61. open fout2$ for output as #2
  62. open fout3$ for output as #3
  63. print #2,"# FamiTracker text format":print #2,""
  64. print #2,"# Module information"
  65. print #2,"TITLE \"\""
  66. print #2,"AUTHOR \"\""
  67. print #2,"COPYRIGHT \"\"":print #2,""
  68. print #2,"# Module comment"
  69. print #2,"COMMENT \"\"":print #2,""
  70. print #2,"# Global settings"
  71. print #2,"MACHINE 0"
  72. print #2,"FRAMERATE 0"
  73. print #2,"EXPANSION 16"
  74. print #2,"VIBRATO 1"
  75. print #2,"SPLIT 32":print #2,""
  76. print #2,"# Namco 163 global settings"
  77. print #2,"N163CHANNELS 6":print #2,""
  78. print #2,"# Macros":print #2,""
  79. print #2,"# DPCM samples":print #2,""
  80. print #2,"# Detune settings":print #2,""
  81. print #2,"# Grooves":print #2,""
  82. print #2,"# Tracks using default groove"
  83. print #2,"# Instruments"
  84. print #2,"INST2A03 0 -1 -1 -1 -1 -1 \"instrument01\""
  85. print #2,"INSTN163 1 -1 -1 -1 -1 -1 32 0 1 \"instrument02\""
  86. print #2,"N163WAVE 1 0 : 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0":print #2,""
  87. print #2,"# Tracks":print #2,""
  88. print #2,"TRACK "+str$(patsz)+" 1 128 \"test\""
  89. print #2,"COLUMNS : 1 1 1 1 1 1 1 1 1 1 1 1 1":print #2,""
  90. print #2,"Pattern 00"
  91. '- the amount of header bytes depends on vgm format version
  92. for eee=0 to hdram-1:q0=readbyte(1):next '- read offset byte first
  93. txou1$=" #("+str$(0)+")"
  94. while veof=0:
  95. q0=readbyte(1)
  96. '- vgm eof command
  97. if q0=0x66 then:
  98. veof=1
  99. print #3,"--vgm-eof--"
  100. print #2,""
  101. print #2,"# End of export"
  102. end if
  103. '- delay 1 byte (1..16 samples)
  104. if bitwiseand(q0,0x70)=0x70 then
  105. frmc=frmc+bitwiseand(q0,0xF)+1
  106. txou1$=" #("+str$(frmc)+")"
  107. 'print #3,txou1$
  108. end if
  109. '- delay 3 bytes (0..65535 samples)
  110. if q0=0x61 then
  111. q0=readbyte(1)
  112. frmc=frmc+q0
  113. q0=readbyte(1)
  114. frmc=frmc+(q0*256)
  115. txou1$=" #("+str$(frmc)+")"
  116. 'print #3,txou1$
  117. end if
  118. '- 1 ntsc frame delay, 735 samples
  119. if q0=0x62 then
  120. frmc=frmc+735
  121. txou1$=" #("+str$(frmc)+")"
  122. 'print #3,txou1$
  123. end if
  124. '- 1 pal frame delay, 882 samples
  125. if q0=0x63 then
  126. frmc=frmc+882
  127. txou1$=" #("+str$(frmc)+")"
  128. 'print #3,txou1$
  129. end if
  130. '- updates frameout pulses
  131. while frmr<frmc
  132. '- writes 1F in the first line of the first pattern
  133. 'if (patc<1 and patid=0) then
  134. 'ltxcr$=replace$(12,ltxcr$,"1F")
  135. 'ltxcr$=replace$(26,ltxcr$,"1F")
  136. 'ltxcr$=replace$(40,ltxcr$,"1F")
  137. 'end if
  138. '- creates a new pattern
  139. if patc>(patsz-1) then:
  140. print #2," "
  141. patid=patid+1:patc=0
  142. 'txou9$="Pattern "+str$(patid)+"]"
  143. txou9$="Pattern "+right$("00000"+ucase$(hex$(patid)),2)
  144. print #2,txou9$
  145. end if
  146. '- writes a pattern line in each frame
  147. if trg=0 then
  148. print #3,"--frameout-unchanged--"
  149. 'print #2,ltxtm$
  150. ltxcr$=ltxtm$
  151. ltxcr$=replace$(4,ltxcr$, right$("00000"+ucase$(hex$(patc)),2) ) '?????? <-----
  152. print #2,ltxcr$
  153. else
  154. print #3,"--frameout--"
  155. ltxcr$=replace$(4,ltxcr$, right$("00000"+ucase$(hex$(patc)),2) ) '?????? <-----
  156. print #2,ltxcr$
  157. ltxcr$=ltxtm$
  158. trg=0
  159. end if
  160. frmr=frmr+frmi
  161. patc=patc+1
  162. end while
  163. '- token 0xA0 gets registers and values to AY-3-8910 output
  164. if q0=0xA0 then
  165. q0=readbyte(1)
  166. '- channel 0, fine
  167. if q0=0x00 then
  168. q0=readbyte(1)
  169. freq0a= bitwiseor((bitwiseand(freq0,0xF00)),(bitwiseand(q0,0x0FF)))
  170. ltxtm1$=ltxtm$
  171. ltxtm2$=replace$(9,ltxtm1$,nttfrq$(freq0a))
  172. ltxcr$=replace$(9,ltxcr$,nttfrq$(freq0a))
  173. ltxcr$=replace$(13,ltxcr$,"00")
  174. print #3,ltxtm2$
  175. trg=1
  176. end if
  177. '- channel 0, coarse
  178. if q0=0x01 then
  179. q0=readbyte(1)
  180. freq0a= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq0,0x0FF)) )
  181. ltxtm1$=ltxtm$
  182. ltxtm2$=replace$(9,ltxtm1$,nttfrq$(freq0a))
  183. ltxcr$=replace$(9,ltxcr$,nttfrq$(freq0a))
  184. ltxcr$=replace$(13,ltxcr$,"00")
  185. print #3,ltxtm2$
  186. trg=1
  187. end if
  188. '- channel 1, fine
  189. if q0=0x02 then
  190. q0=readbyte(1)
  191. freq1a= bitwiseor ( (bitwiseand(freq1,0xF00)),(bitwiseand(q0,0x0FF)) )
  192. ltxtm1$=ltxtm$
  193. ltxtm2$=replace$(24,ltxtm1$,nttfrq$(freq1a))
  194. ltxcr$=replace$(24,ltxcr$,nttfrq$(freq1a))
  195. ltxcr$=replace$(28,ltxcr$,"00")
  196. print #3,ltxtm2$
  197. trg=1
  198. end if
  199. '- channel 1, coarse
  200. if q0=0x03 then
  201. q0=readbyte(1)
  202. freq1a= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq1,0x0FF)) )
  203. ltxtm1$=ltxtm$
  204. ltxtm2$=replace$(24,ltxtm1$,nttfrq$(freq1a))
  205. ltxcr$=replace$(24,ltxcr$,nttfrq$(freq1a))
  206. ltxcr$=replace$(28,ltxcr$,"00")
  207. print #3,ltxtm2$
  208. trg=1
  209. end if
  210. '- channel 2, fine
  211. if q0=0x04 then
  212. q0=readbyte(1)
  213. freq2a= bitwiseor ( (bitwiseand(freq2,0xF00)),(bitwiseand(q0,0x0FF)) )
  214. ltxtm1$=ltxtm$
  215. ltxtm2$=replace$(39,ltxtm1$,nttfrq$(freq2a))
  216. ltxcr$=replace$(39,ltxcr$,nttfrq$(freq2a))
  217. ltxcr$=replace$(43,ltxcr$,"00")
  218. print #3,ltxtm2$
  219. trg=1
  220. end if
  221. '- channel 2, coarse
  222. if q0=0x05 then
  223. q0=readbyte(1)
  224. freq2a= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq2,0x0FF)) )
  225. ltxtm1$=ltxtm$
  226. ltxtm2$=replace$(39,ltxtm1$,nttfrq$(freq2a))
  227. ltxcr$=replace$(39,ltxcr$,nttfrq$(freq2a))
  228. ltxcr$=replace$(43,ltxcr$,"00")
  229. print #3,ltxtm2$
  230. trg=1
  231. end if
  232. '- channel 1, volume
  233. if q0=0x08 then
  234. q0=readbyte(1)
  235. vol0a= bitwiseand(q0,0xF)
  236. ltxtm1$=ltxtm$
  237. ltxtm2$=replace$(16,ltxtm1$,ucase$(right$(hex$(0x10+vol0a),1)))
  238. ltxcr$=replace$(16,ltxcr$,ucase$(right$(hex$(0x10+vol0a),1)))
  239. print #3,ltxtm2$
  240. trg=1
  241. end if
  242. '- channel 2, volume
  243. if q0=0x09 then
  244. q0=readbyte(1)
  245. vol1a= bitwiseand(q0,0xF)
  246. ltxtm1$=ltxtm$
  247. ltxtm2$=replace$(31,ltxtm1$,ucase$(right$(hex$(0x10+vol1a),1)))
  248. ltxcr$=replace$(31,ltxcr$,ucase$(right$(hex$(0x10+vol1a),1)))
  249. print #3,ltxtm2$
  250. trg=1
  251. end if
  252. '- channel 3, volume
  253. if q0=0x0A then
  254. q0=readbyte(1)
  255. vol2a= bitwiseand(q0,0xF)
  256. ltxtm1$=ltxtm$
  257. ltxtm2$=replace$(46,ltxtm1$,ucase$(right$(hex$(0x10+vol2a),1)))
  258. ltxcr$=replace$(46,ltxcr$,ucase$(right$(hex$(0x10+vol2a),1)))
  259. print #3,ltxtm2$
  260. trg=1
  261. end if
  262. '- channel 0, fine
  263. if q0=0x80 then
  264. q0=readbyte(1)
  265. freq0b= bitwiseor((bitwiseand(freq0,0xF00)),(bitwiseand(q0,0x0FF)))
  266. ltxtm1$=ltxtm$
  267. ltxtm2$=replace$(9+75,ltxtm1$,nttfrq$(freq0b))
  268. ltxcr$=replace$(9+75,ltxcr$,nttfrq$(freq0b))
  269. ltxcr$=replace$(13+75,ltxcr$,"01")
  270. print #3,ltxtm2$
  271. trg=1
  272. end if
  273. '- channel 0, coarse
  274. if q0=0x81 then
  275. q0=readbyte(1)
  276. freq0b= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq0,0x0FF)) )
  277. ltxtm1$=ltxtm$
  278. ltxtm2$=replace$(9+75,ltxtm1$,nttfrq$(freq0b))
  279. ltxcr$=replace$(9+75,ltxcr$,nttfrq$(freq0b))
  280. ltxcr$=replace$(13+75,ltxcr$,"01")
  281. print #3,ltxtm2$
  282. trg=1
  283. end if
  284. '- channel 1, fine
  285. if q0=0x82 then
  286. q0=readbyte(1)
  287. freq1b= bitwiseor ( (bitwiseand(freq1,0xF00)),(bitwiseand(q0,0x0FF)) )
  288. ltxtm1$=ltxtm$
  289. ltxtm2$=replace$(24+75,ltxtm1$,nttfrq$(freq1b))
  290. ltxcr$=replace$(24+75,ltxcr$,nttfrq$(freq1b))
  291. ltxcr$=replace$(28+75,ltxcr$,"01")
  292. print #3,ltxtm2$
  293. trg=1
  294. end if
  295. '- channel 1, coarse
  296. if q0=0x83 then
  297. q0=readbyte(1)
  298. freq1b= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq1,0x0FF)) )
  299. ltxtm1$=ltxtm$
  300. ltxtm2$=replace$(24+75,ltxtm1$,nttfrq$(freq1b))
  301. ltxcr$=replace$(24+75,ltxcr$,nttfrq$(freq1b))
  302. ltxcr$=replace$(28+75,ltxcr$,"01")
  303. print #3,ltxtm2$
  304. trg=1
  305. end if
  306. '- channel 2, fine
  307. if q0=0x84 then
  308. q0=readbyte(1)
  309. freq2b= bitwiseor ( (bitwiseand(freq2,0xF00)),(bitwiseand(q0,0x0FF)) )
  310. ltxtm1$=ltxtm$
  311. ltxtm2$=replace$(39+75,ltxtm1$,nttfrq$(freq2b))
  312. ltxcr$=replace$(39+75,ltxcr$,nttfrq$(freq2b))
  313. ltxcr$=replace$(43+75,ltxcr$,"01")
  314. print #3,ltxtm2$
  315. trg=1
  316. end if
  317. '- channel 2, coarse
  318. if q0=0x85 then
  319. q0=readbyte(1)
  320. freq2b= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq2,0x0FF)) )
  321. ltxtm1$=ltxtm$
  322. ltxtm2$=replace$(39+75,ltxtm1$,nttfrq$(freq2b))
  323. ltxcr$=replace$(39+75,ltxcr$,nttfrq$(freq2b))
  324. ltxcr$=replace$(43+75,ltxcr$,"01")
  325. print #3,ltxtm2$
  326. trg=1
  327. end if
  328. '- channel 1, volume
  329. if q0=0x88 then
  330. q0=readbyte(1)
  331. vol0b= bitwiseand(q0,0xF)
  332. ltxtm1$=ltxtm$
  333. ltxtm2$=replace$(16+75,ltxtm1$,ucase$(right$(hex$(0x10+vol0b),1)))
  334. ltxcr$=replace$(16+75,ltxcr$,ucase$(right$(hex$(0x10+vol0b),1)))
  335. print #3,ltxtm2$
  336. trg=1
  337. end if
  338. '- channel 2, volume
  339. if q0=0x89 then
  340. q0=readbyte(1)
  341. vol1b= bitwiseand(q0,0xF)
  342. ltxtm1$=ltxtm$
  343. ltxtm2$=replace$(31+75,ltxtm1$,ucase$(right$(hex$(0x10+vol1b),1)))
  344. ltxcr$=replace$(31+75,ltxcr$,ucase$(right$(hex$(0x10+vol1b),1)))
  345. print #3,ltxtm2$
  346. trg=1
  347. end if
  348. '- channel 3, volume
  349. if q0=0x8A then
  350. q0=readbyte(1)
  351. vol2b= bitwiseand(q0,0xF)
  352. ltxtm1$=ltxtm$
  353. ltxtm2$=replace$(46+75,ltxtm1$,ucase$(right$(hex$(0x10+vol2b),1)))
  354. ltxcr$=replace$(46+75,ltxcr$,ucase$(right$(hex$(0x10+vol2b),1)))
  355. print #3,ltxtm2$
  356. trg=1
  357. end if
  358. '?????
  359. if q0=6 then
  360. print #3,ltxtm$
  361. end if
  362. '?????
  363. 'if q0=7 then
  364. ' q0=readbyte(1)
  365. ' ltxtm1$=ltxtm$
  366. ' ltxtm2$=left$(ltxtm1$,31)+ right$(bin$(512+q0),8) +right$(ltxtm1$,2)+txou1$
  367. ' print #3,ltxtm2$
  368. ' trg=1
  369. ' end if
  370. end if
  371. '- token 0x55 gets registers and values to AY-3-8910 output
  372. if q0=0x55 then
  373. q0=readbyte(1)
  374. '- channel 0, fine
  375. if q0=0 then
  376. q0=readbyte(1)
  377. freq0c= bitwiseor((bitwiseand(freq0,0xF00)),(bitwiseand(q0,0x0FF)))
  378. ltxtm1$=ltxtm$
  379. ltxtm2$=replace$(9+120,ltxtm1$,nttfrq$(freq0c))
  380. ltxcr$=replace$(9+120,ltxcr$,nttfrq$(freq0c))
  381. ltxcr$=replace$(13+120,ltxcr$,"01")
  382. print #3,ltxtm2$
  383. trg=1
  384. end if
  385. '- channel 0, coarse
  386. if q0=1 then
  387. q0=readbyte(1)
  388. freq0c= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq0,0x0FF)) )
  389. ltxtm1$=ltxtm$
  390. ltxtm2$=replace$(9+120,ltxtm1$,nttfrq$(freq0c))
  391. ltxcr$=replace$(9+120,ltxcr$,nttfrq$(freq0c))
  392. ltxcr$=replace$(13+120,ltxcr$,"01")
  393. print #3,ltxtm2$
  394. trg=1
  395. end if
  396. '- channel 1, fine
  397. if q0=2 then
  398. q0=readbyte(1)
  399. freq1c= bitwiseor ( (bitwiseand(freq1,0xF00)),(bitwiseand(q0,0x0FF)) )
  400. ltxtm1$=ltxtm$
  401. ltxtm2$=replace$(24+120,ltxtm1$,nttfrq$(freq1c))
  402. ltxcr$=replace$(24+120,ltxcr$,nttfrq$(freq1c))
  403. ltxcr$=replace$(28+120,ltxcr$,"01")
  404. print #3,ltxtm2$
  405. trg=1
  406. end if
  407. '- channel 1, coarse
  408. if q0=3 then
  409. q0=readbyte(1)
  410. freq1c= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq1,0x0FF)) )
  411. ltxtm1$=ltxtm$
  412. ltxtm2$=replace$(24+120,ltxtm1$,nttfrq$(freq1c))
  413. ltxcr$=replace$(24+120,ltxcr$,nttfrq$(freq1c))
  414. ltxcr$=replace$(28+120,ltxcr$,"01")
  415. print #3,ltxtm2$
  416. trg=1
  417. end if
  418. '- channel 2, fine
  419. if q0=4 then
  420. q0=readbyte(1)
  421. freq2c= bitwiseor ( (bitwiseand(freq2,0xF00)),(bitwiseand(q0,0x0FF)) )
  422. ltxtm1$=ltxtm$
  423. ltxtm2$=replace$(39+120,ltxtm1$,nttfrq$(freq2c))
  424. ltxcr$=replace$(39+120,ltxcr$,nttfrq$(freq2c))
  425. ltxcr$=replace$(43+120,ltxcr$,"01")
  426. print #3,ltxtm2$
  427. trg=1
  428. end if
  429. '- channel 2, coarse
  430. if q0=5 then
  431. q0=readbyte(1)
  432. freq2c= bitwiseor ( (bitwiseand(q0*256,0xF00)),(bitwiseand(freq2,0x0FF)) )
  433. ltxtm1$=ltxtm$
  434. ltxtm2$=replace$(39+120,ltxtm1$,nttfrq$(freq2c))
  435. ltxcr$=replace$(39+120,ltxcr$,nttfrq$(freq2c))
  436. ltxcr$=replace$(43+120,ltxcr$,"01")
  437. print #3,ltxtm2$
  438. trg=1
  439. end if
  440. '- channel 1, volume
  441. if q0=8 then
  442. q0=readbyte(1)
  443. vol0c= bitwiseand(q0,0xF)
  444. ltxtm1$=ltxtm$
  445. ltxtm2$=replace$(16+120,ltxtm1$,ucase$(right$(hex$(0x10+vol0c),1)))
  446. ltxcr$=replace$(16+120,ltxcr$,ucase$(right$(hex$(0x10+vol0c),1)))
  447. print #3,ltxtm2$
  448. trg=1
  449. end if
  450. '- channel 2, volume
  451. if q0=9 then
  452. q0=readbyte(1)
  453. vol1c= bitwiseand(q0,0xF)
  454. ltxtm1$=ltxtm$
  455. ltxtm2$=replace$(31+120,ltxtm1$,ucase$(right$(hex$(0x10+vol1c),1)))
  456. ltxcr$=replace$(31+120,ltxcr$,ucase$(right$(hex$(0x10+vol1c),1)))
  457. print #3,ltxtm2$
  458. trg=1
  459. end if
  460. '- channel 3, volume
  461. if q0=10 then
  462. q0=readbyte(1)
  463. vol2c= bitwiseand(q0,0xF)
  464. ltxtm1$=ltxtm$
  465. ltxtm2$=replace$(46+120,ltxtm1$,ucase$(right$(hex$(0x10+vol2c),1)))
  466. ltxcr$=replace$(46+120,ltxcr$,ucase$(right$(hex$(0x10+vol2c),1)))
  467. print #3,ltxtm2$
  468. trg=1
  469. end if
  470. '?????
  471. if q0=6 then
  472. print #3,ltxtm$
  473. end if
  474. '?????
  475. 'if q0=7 then
  476. ' q0=readbyte(1)
  477. ' ltxtm1$=ltxtm$
  478. ' ltxtm2$=left$(ltxtm1$,31)+ right$(bin$(512+q0),8) +right$(ltxtm1$,2)+txou1$
  479. ' print #3,ltxtm2$
  480. ' trg=1
  481. ' end if
  482. end if
  483. if eof(1)<>0 then
  484. veof=1
  485. print #2,""
  486. print #2,"# End of export"
  487. end if
  488. wend
  489. for eeq=0 to patid
  490. txou$="ORDER "+right$(hex$(0x100+eeq),2)+" :"
  491. for eer=0 to 12
  492. txou$=txou$+" "+right$(hex$(0x100+eeq),2)
  493. next
  494. print #2,txou$
  495. next
  496. print #2,""
  497. 'print #2,"ORDER 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00"
  498. 'print #2,"ORDER 01 : 01 01 01 01 01 01 01 01 01 01 01 01 01"
  499. 'print #2,"ORDER 02 : 02 02 02 02 02 02 02 02 02 02 02 02 02"
  500. 'print #2,"ORDER 03 : 03 03 03 03 03 03 03 03 03 03 03 03 03"
  501. 'print #2,"ORDER 04 : 04 04 04 04 04 04 04 04 04 04 04 04 04"
  502. 'print #2,"ORDER 05 : 05 05 05 05 05 05 05 05 05 05 05 05 05"
  503. 'print #2,"ORDER 06 : 06 06 06 06 06 06 06 06 06 06 06 06 06"
  504. 'print #2,"ORDER 07 : 07 07 07 07 07 07 07 07 07 07 07 07 07"
  505. 'print #2,"ORDER 08 : 08 08 08 08 08 08 08 08 08 08 08 08 08"
  506. 'print #2,"ORDER 09 : 09 09 09 09 09 09 09 09 09 09 09 09 09"
  507. 'print #2,"ORDER 0A : 0A 0A 0A 0A 0A 0A 0A 0A 0A 0A 0A 0A 0A"
  508. 'print #2,"ORDER 0B : 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B 0B"
  509. 'print #2,"ORDER 0C : 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C"
  510. 'print #2,"ORDER 0D : 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D 0D"
  511. 'print #2,"ORDER 0E : 0E 0E 0E 0E 0E 0E 0E 0E 0E 0E 0E 0E 0E"
  512. 'print #2,"ORDER 0F : 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F 0F"
  513. 'print #2,""
  514. close #1:close #2:close #3
  515. if debug=0 then:
  516. shell("rm "+fout3$)
  517. end if
  518. 'print #2,"[Module]"
  519. 'print #2,"VortexTrackerII=1"
  520. 'print #2,"Version=3.6"
  521. 'print #2,"Title="
  522. 'print #2,"Author="
  523. 'print #2,"NoteTable=2"
  524. 'print #2,"Speed=1"
  525. 'print #2,hsam$
  526. 'print #2," "
  527. 'print #2,"[Ornament1]":print #2,"L0":print #2," "
  528. 'print #2,"[Sample1]":print #2,"Tne +000_ +00_ F_ L":print #2," "