converter_b_ay38910x2_1a.sdlbas 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. function lstinf$(a$,b$,c$)
  2. adra=1:adrb=1:blngt=len(b$):d$=""
  3. while adrb<=blngt
  4. if mid$ (a$,adra,1)=mid$ (b$,adrb,1) then:adrb+=1:end if
  5. adra=adra+1
  6. end while
  7. while mid$(a$,adra,1)<>left$(c$,1)
  8. d$=d$+mid$(a$,adra,1):adra=adra+1
  9. end while
  10. lstinf$=d$
  11. end function
  12. function vldc(a$)
  13. t0$="!"+a$+".0.0.0."
  14. t1$=lstinf$(t0$,"!",".")
  15. t2$=lstinf$(t0$,".",".")
  16. t3=10^(len(t2$))
  17. vldc=val(t1$)+(val(t2$)/t3)
  18. end function
  19. dim chfq[16],chvl[16]
  20. finp$="_.csv"
  21. if argc>2 then:finp$=argv(2):end if
  22. print"56676D20 FFFFFF0F 510100000000000000000000C00E0000513105001501"
  23. print"000069EC04003C0000000000000000000000000000004C00000000000000"
  24. print"000000000000000000000000000000000000000000000000000000000000"
  25. print"00000000000000000000000000000000000000000000000000004C4F1B40"
  26. print"0001000070000000"
  27. print"A00000"
  28. print"A00100"
  29. print"A00200"
  30. print"A00300"
  31. print"A00400"
  32. print"A00500"
  33. print"A00800"
  34. print"A00900"
  35. print"A00A00"
  36. print"A007B8"
  37. print"A08000"
  38. print"A08100"
  39. print"A08200"
  40. print"A08300"
  41. print"A08400"
  42. print"A08500"
  43. print"A08800"
  44. print"A08900"
  45. print"A08A00"
  46. print"A087B8"
  47. lct=0
  48. open finp$ for input as #1
  49. while eof(1)=0
  50. file input #1,txrd$
  51. setcaption("b:"+str$(lct)):lct+=1
  52. if mid$(txrd$,1,1)="[" then:
  53. if mid$(txrd$,2,1)="f" then:
  54. chid=val(mid$(txrd$,3,2))
  55. chid=chid mod 6 'ay38910x2 has 6 channels
  56. chfqv=vldc(lstinf$(txrd$,":","]"))
  57. chfqv2=int(26.6984611843*2^(8-chfqv))
  58. if chfqv2>2047 then:chfqv2=2047:end if
  59. if chfqv2<0 then:chfqv2=0:end if
  60. chchrfq$=right$("000"+hex$(chfqv2),3)
  61. if chid<3 then:
  62. txrgo$="A0"+right$("00"+hex$(1+2*(chid mod 3)),2)+"0"+mid$(chchrfq$,1,1)
  63. txrgo$+=" A0"+right$("00"+hex$(0+2*(chid mod 3)),2)+mid$(chchrfq$,2,2)
  64. else:
  65. txrgo$="A0"+right$("00"+hex$(129+2*(chid mod 3)),2)+"0"+mid$(chchrfq$,1,1)
  66. txrgo$+=" A0"+right$("00"+hex$(128+2*(chid mod 3)),2)+mid$(chchrfq$,2,2)
  67. end if
  68. print ucase$(txrgo$)
  69. end if
  70. if mid$(txrd$,2,1)="v" then:
  71. chid=val(mid$(txrd$,3,2))
  72. chid=chid mod 6 'ay38910x2 has 6 channels
  73. chvlv=vldc(lstinf$(txrd$,":","]"))*0x10
  74. chchrvl$=right$("00"+hex$(chvlv),2)
  75. if chid<3 then:
  76. txrgo$="A0"+right$("00"+hex$(8+(chid mod 3)),2)+chchrvl$
  77. else:
  78. txrgo$="A0"+right$("00"+hex$(128+8+(chid mod 3)),2)+chchrvl$
  79. end if
  80. print ucase$(txrgo$)
  81. end if
  82. if mid$(txrd$,2,3)="wvb" then:
  83. wvblv=vldc(lstinf$(txrd$,":","]"))
  84. wvblv2=wvblv*44100
  85. wvblv3a=wvblv2 mod 65536
  86. wvblv3b=int(wvblv2/65536)
  87. wvblv3as$=ucase$(right$("0000"+hex$(wvblv3a),4))
  88. for ii=1 to wvblv3b:print"61FFFF":next
  89. print "61"+mid$(wvblv3as$,3,2)+mid$(wvblv3as$,1,2)
  90. end if
  91. end if
  92. wend
  93. print:print "66":print
  94. close #1