Vgm2FamiTrackerTxtAy38910K051649.sdlbas 17 KB

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