home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1987 August / 1987-08.d64 / dyna-translator (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  110 lines

  1. 10 rem copyright 1987 compute! publications, inc. - all rights reserved
  2. 20 ln=8000
  3. 30 goto100
  4. 40 pokes+1,70:pokes+5,7:pokes+4,17:gosub60:return
  5. 50 pokes+1,6:pokes+5,9:pokes+4,33:gosub60:return
  6. 60 forj=1to25:next:forj=stos+5:pokej,0:next:return
  7. 70 getx$:ifx$=""then70
  8. 80 return
  9. 90 t$=str$(t):t$=right$(t$,len(t$)-1):return
  10. 100 poke53281,0:poke53280,0:printchr$(14)"
  11. 110 [153]"loadlist  lenopyright 1987 len(NULL)(NULL)(NULL)(NULL)(NULL)val! (NULL)ub., right$nc."
  12. 120 [153][163]9)"atnll (NULL)ights (NULL)eserved"
  13. 130 [153]"cont(NULL)hat is the octave?":s[178]54272:[151]s[170]24,15:z$[178]""
  14. 140 [153]"left$it","print#0 thru 7cont","to indicate":[153],,"octave number."
  15. 150 [153],"print#(NULL)val(NULL)(NULL)(NULL)(NULL)cont","to indicate a rest.":[153],"print#(NULL)cont","to quit."
  16. 160 [153]z$"(NULL)iddle len begins octave 4, which runs    upward to include ";
  17. 170 [153]"the peek above middle len. (NULL)he octave above is 5 and the octave "
  18. 180 [153]"below middle len is 3, etc.cont
  19. 190 gosub70:c$=x$:ifc$<>"q"then280
  20. 200 print"[147][197]nter [152][217][154] if you really want to quit."
  21. 210 gosub70:ifx$<>"y"thenprint"[147]":goto130
  22. 220 print"[147][212]he entry stage is complete."
  23. 230 print"[200]it [152][195][154] to cycle the music over and over.
  24. 240 [153]"atnny other key to play the music once    each time it is called."
  25. 250 [141]70:l$[178]"0":h$[178]"0":u$[178]"0"
  26. 260 [139]x$[178]"c"[167]l$[178]"1"
  27. 270 [141]40:[137]830
  28. 280 c[178][197](c$):[139]c$[178][199](13)[167]:c$[178]"rest":l[178]0:h[178]0:[141]40:[137]410
  29. 290 [139]c$[179]"0"[176]c$[177]"7"[167][141]50:[137]190
  30. 300 [141]40:[153]"load"z$"on(NULL)ctave is"c
  31. 310 [153]"contvalnter the letter name of the note
  32. 320 print"followed by an '[152]s[154]' for a sharp or an '[152]f[154]'for a flat.
  33. 330 [153]"(NULL)eep all entries lower case.
  34. 340 input"[215]hat is the note";n$
  35. 350 forj=0to16:reada$,n:ifn$=a$then390
  36. 360 next:restore:gosub50
  37. 370 print"[208]lease enter:","[152]c,cs,df,d,ds,ef,e,f",,,"fs,g,gs,af,a,bf,or b[154]"
  38. 380 goto340
  39. 390 gosub40:x=asc(left$(n$,1)):x=x+128:w$=chr$(x):n$=w$+mid$(n$,2,1)
  40. 400 q=440*1.05946309^(n-10)*2^(c-4):v=q/.06096:h=int(v/256):l=int(v-(h*256))
  41. 410 print"[147]"z$"[214]alid entries are: [152]1,2,4,8,16,32,or 64[154]"
  42. 420 print"[152]1[154]  for a whole note or rest."
  43. 430 print"[152]4[154]  for a quarter note or rest."
  44. 440 print"[152]32[154] for a 32nd note or rest, etc."
  45. 450 print"[208]lace a period after the number to      dot it.  [196]otted notes";
  46. 460 print" are held half     again as long as undotted notes.[154]"
  47. 470 printz$"[197]nter [152][196][154] to bypass the above process, so you calculate the";
  48. 480 print" [152]d[154]uration and place it directly in the created data statement."
  49. 490 print"             [208]lease enter the note or rest value."
  50. 500 input u$:u=val(u$)
  51. 510 ifu$><"d"then570
  52. 520 print"[147][197]nter your calculated duration."
  53. 530 inputdr$
  54. 540 dr=val(dr$)
  55. 550 ifdr<0ordr>255thengosub50:goto520
  56. 560 goto620
  57. 570 forj=0to6:if2^j=uthen600
  58. 580 next
  59. 590 gosub50:goto490:rem reject
  60. 600 u=128/u:rem accept
  61. 610 ifright$(u$,1)="."thenu=u*1.5
  62. 620 gosub40:print"[147][200]ere is your note:"
  63. 630 print"[207]ctave "c$"[154][206]ote "n$"[154][214]alue ";
  64. 640 ifdrthenprint"[154][157][157][157][157][157][157][196]uration"dr:goto670
  65. 650 ifu$="1"thenprint"1":goto670
  66. 660 print"1/"u$
  67. 670 print"[154][200]it","[152][210][197][212][213][210][206][154]","to add the data line",,"to the program.
  68. 680 [153],"print#valcont","to erase this data.
  69. 690 print"[152]","[210][154]","to add a remark to",,,"the data line.
  70. 700 [141]70:d$[178]x$
  71. 710 [139]d$[178]"r"[176]d$[178][199](13)[167]740
  72. 720 [139]d$[178]"e"[167][141]40:[153]"load"z$:[140]:[137]130
  73. 730 [141]50:[153]"valnter print#(NULL)val(NULL)(NULL)(NULL)(NULL), val, or (NULL)cont":[137]700
  74. 740 [141]40:[141]40:t[178]l:[141]90:l$[178]t$
  75. 750 t[178]h:[141]90:h$[178]t$
  76. 760 [139]dr[167]u[178]dr
  77. 770 t[178]u:[141]90:u$[178]t$
  78. 780 [139]d$[179][177]"r"[167]830
  79. 790 [153]"load"z$"(NULL)aximum remark length 50 characters.
  80. 800 input"[215]hat is your remark";r$
  81. 810 iflen(r$)>49thengosub50:goto800
  82. 820 gosub40:r$=":rem "+r$
  83. 830 print"[147]"ln"data"l$","h$","u$;r$
  84. 840 print"[144]ln="ln+1;
  85. 850 ifc$="q"then print":goto880":goto870
  86. 860 print":goto130"
  87. 870 poke631,13:poke632,13:poke198,2:end
  88. 880 s=54272:print"[154][214]alue to multiply each note duration by  1[157][157][157]";
  89. 890 inputm
  90. 900 print"[215]ant music poked to [210][193][205]?"
  91. 910 gosub70:ifx$="y"thengosub960
  92. 920 print"[215]ant music file saved?":gosub70:ifx$="y"thengosub1020
  93. 930 end
  94. 940 datac,1,cs,2,df,2,d,3,ds,4,ef,4,e,5,es,6,f,6,fs,7,g,8
  95. 950 datags,9,af,9,a,10,as,11,bf,11,b,12
  96. 960 input"[154][193]ddress to poke music  40960[157][157][157][157][157][157][157]";b$:b=val(b$)
  97. 970 ifb<820orb>65535thengosub50:goto960
  98. 980 print"[154][196]ata is being poked":print"starting at line"b:j=b:gosub1090
  99. 990 gosub1010:pokej,l:pokej+1,h:pokej+2,u:j=j+3:ifu>0then990
  100. 1000 print"[197]nding address is"j:print"music is in memory.":restore:return
  101. 1010 readl,h,u:u=u*m:return
  102. 1020 input"[206]ame of saved file";nf$
  103. 1030 print"[147][193]ddress you want this file to load at   later  40960[157][157][157][157][157][157][157]";
  104. 1040 input ad$:ad=val(ad$):ifad<819orad>65536thengosub50:goto1040
  105. 1050 hb=int(ad/256):lb=ad-256*hb:open2,8,2,"0:"+nf$+",p,w"
  106. 1060 print#2,chr$(lb);chr$(hb);:gosub1090
  107. 1070 gosub1010:print#2,chr$(l);chr$(h);chr$(u);:ifu>0then1070
  108. 1080 close2:print"[211]ave complete.":return
  109. 1090 fori=1to34:readu$:next:return
  110.