home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 67 / 067.d81 / oscilloscope.ba (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  11KB  |  271 lines

  1. 30 ft$="oscilloscope.o":gosub50:ft$="oscilloscope.fnt":gosub50:goto100
  2. 50 open15,8,15,"r0:"+ft$+"="+ft$:input#15,e,e$:close15:ife=63goto90
  3. 70 print"[198]ix your disk, then press space bar."
  4. 80 poke198,0:wait198,1:poke198,0:goto50
  5. 90 poke147,0:sys57812ft$,8,1:sys62631:return
  6. 100 poke55,255:poke56,55:clr:t=0:a=0:ss=0:i=0:n3=0
  7. 111 ke$="frsphw[133][134][135][136][137][138][139][140]dtzc\qx":deffnsr(sf)=776.47/sf-3.456
  8. 140 at$="[151]@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ":deffnsg(sf)=int(sf/174.1+1)
  9. 150 er$="                                      "
  10. 180 in=49152:cl=in+3:co=in+6:sa=in+9:di=in+12:re=in+15:dc=in+40:sr=dc+1:ds=dc+2
  11. 260 nd=peek(in+18)+256*peek(in+19)+512:xh=peek(in+20)+256*peek(in+21)
  12. 290 es=dc+3:ss=dc+4:ht=in+24:pokeht,85:cm=in+26:bm=cm+3:sm=cm+6:ba=cm+9
  13. 320 print"[147]":poke53280,06:poke53281,00:printchr$(14)chr$(8):gosub323:goto330
  14. 323 c1$="[144]":c2$=c1$:c3$=c1$:c4$=c1$:c5$=c1$:c6$=c1$:pokedc,80:return
  15. 330 pokedc,5*16+0:sysco:syscl:sysin:gosub1390:sp=11:pokeds,255/sp:pokees,72
  16. 380 fori=0to8:readr$(i):next
  17. 390 data"triangle[155]  [184][185] mcmlxxxix  [170][171][172][173][174][175][176][177][178][179][180][181][182][183]",sawtooth
  18. 400 datapulse------,noise (random pulses at set frequency)
  19. 410 datasynchronized-triangle,synchronized-sawtooth,synchronized-pulse
  20. 420 dataring-modulation (triangle * square)
  21. 430 dataring-modulation-synchronized triangle:fori=0to8:readwf(i):next
  22. 450 data16,32,64,128,18,34,66,20,22:s=54272:fori=0to24:pokes+i,0:next
  23. 470 pokes+24,09+16:pokes+19,16*0+0:pokes+20,16*15+12:pokes+22,64
  24. 510 f=440:wf=16:pw=50:sf=110:f2=445
  25. 530 gosub800:gosub960:gosub890:gosub1040
  26. 570 rem"[211][212][193][210][212] [205][193][201][206][160][204][207][207][208]
  27. 580 [139]qx[178]1[137]620
  28. 581 [151]198,0:fx[178][184](0):[139]n3[178]0[167][141]1940:n3[178]1
  29. 600 [139]wf[179][177]1[167][141]1410:[137]620
  30. 610 [141]1860:[137]640
  31. 620 [151]s[170]18,wf[170]1:[158]sa:[151]s[170]18,wf:[137]670
  32. 640 [151]s[170]18,17:[158]di
  33. 670 [161]a$:[139][197](a$)[177]0[175]wf[179][177]1[167]qx[178]0:[137]2950
  34. 675 [129]i[178]1[164]21:[139]a$[178][202](ke$,i,1)[167]ke[178]i:i[178]21:[130]:[137]688
  35. 680 [130]:[137]580
  36. 681 "(NULL)atnright$(NULL) (NULL)(NULL)(NULL)(NULL) ^^^ if no key hit
  37. 688 ifwf=1thenke=-7:goto1110
  38. 689 ifa$<>"t"thenqx=0
  39. 690 ifke<7thenonkegoto760,860,940,1030,1070,1080
  40. 700 ke=ke-14:ifke<1goto1110:_fnctnkey
  41. 710 onkegoto730,1150,1170,1180,1210,1220,580
  42. 720 goto580
  43. 730 en$="waveform display speed":nu=2:gosub2740:sp=en
  44. 740 ifsp=0thensp=1
  45. 750 pokeds,255/sp:goto580
  46. 760 en$="voice 3 frequency":nu=4:gosub2740:f=en:ifzz=1thengosub960
  47. 780 gosub800:goto580
  48. 790 :
  49. 800 iff=<0thenf=1
  50. 810 iff>3995thenf=3995
  51. 820 k=f/.06097:fh=int(k/256):fl=int(k-256*fh)
  52. 840 pokes+14,fl:pokes+15,fh:return
  53. 841 :
  54. 860 en$="voice 2 ring frequency":nu=4:gosub2740:f2=en:gosub890:goto580
  55. 880 :
  56. 890 iff2=<0thenf2=1
  57. 900 iff2>3995thenf2=3995
  58. 910 g2=f2/.06097:gh=int(g2/256):gl=g2-256*gh
  59. 930 pokes+7,gl:pokes+8,gh:return:___
  60. 940 en$="sweep frequency":nu=4:gosub2740:sf=en:zz=0:gosub960:goto580
  61. 960 ifzz=1thensf=f/4
  62. 970 ifsf<3thensf=3
  63. 980 ifsf>1044thensf=1044
  64. 990 sg=fnsg(sf):pokesr,fnsr(sf/sg):pokess,sg:pokees,42*sg:return:___
  65. 1030 en$="pulse width (%)":nu=2:gosub2740:pw=en:gosub1040:goto580
  66. 1040 hi=int(.1599*pw):lo=40.95*pw-256*hi
  67. 1060 pokes+16,lo:pokes+17,hi:return:___
  68. 1070 gosub2060:goto580:___
  69. 1080 wf=1:sf=123:gosub990:pokes+24,14+16:pokes+23,4:pokexh,195:goto580
  70. 1110 ke=ke+7:ifg<0org>7goto580
  71. 1120 ifwf=1thenpokexh,196:pokes+23,0:pokes+24,9
  72. 1130 wf=wf(ke):rs=0:ifke>3thenrs=1
  73. 1140 n3=0:goto580:___
  74. 1150 ifpeek(xh)<>195thenpoke198,0:fo=f:gosub2640:f=fo:gosub800
  75. 1160 goto670:___
  76. 1170 zz=1-zz:gosub960:goto580:___
  77. 1180 cc=1-cc:ifcc=0thengosub323:goto1200
  78. 1190 c1$="[154]":c2$="[158]":c3$="[153]":c4$="":c5$="[159]":c6$="[156]":pokedc,16:gosub2890
  79. 1200 sysco:gosub1940:goto580:___
  80. 1210 ifa$="\"thenwf=22:rs=1:pokexh,196:pokes+23,0:goto580
  81. 1220 print"[147][158][200]ave you tried ring-modulated tune with voice 3 at 5 hz?"
  82. 1230 print" [196]o you [210][197][193][204][204][217] want to quit? ([217] or [206])":poke198,0
  83. 1240 getyn$:ifyn$=""then1240
  84. 1250 ifyn$<>"y"thenn3=0:goto580
  85. 1260 sysre:poke53280,0:poke53281,0:pokes+18,16
  86. 1280 poke55,0:poke56,160:print"[147]             [154][199]ood-bye !"
  87. 1300 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
  88. 1310 ifer=63goto1340
  89. 1320 print"[159][204]oad[211]tar disk not in drive.":print"[150][198]ix, then press space bar."
  90. 1330 poke198,0:wait198,1:poke198,0:goto1300
  91. 1340 print"[147][144]load"chr$(34)"hello connect"chr$(34)",8":print"run"
  92. 1360 poke631,13:poke632,13:poke633,13:poke198,3:end:"[204][207][193][196][211][212][193][210]___
  93. 1380 [158]cl:[141]1390:fr[178][184](fr):[142]
  94. 1390 [151]214,3:[153]:[153]at$:[151]214,17:[153]:[153]at$:[142]
  95. 1410 r$[178]"stop    wait":[151]198,0
  96. 1430 pr[178][181](f):l3[178]4:r3[178]1:c3[178]12:[141]1770:[153]"stophz"
  97. 1440 pr[178][181](sf):l3[178]4:r3[178]1:c3[178]31:[141]1770:[153]"stophz":r$[178]"stop      wait"
  98. 1460 [151]214,1:[153]:[139]rs[178]0[137]1500
  99. 1480 [153]c2$"(NULL)2 ring-sync freq ";
  100. 1490 pr[178][181](f2):l3[178]4:r3[178]2:c3[178]18:[141]1770:[153]"stophz"
  101. 1500 [153]"                   ":[151]214,2:[153]:[151]211,0:[153]c3$;
  102. 1530 [129]i[178]0[164]8:[139]wf[178]wf(i)[167]ix[178]i:i[178]8
  103. 1540 [130]:[153]"print"r$(ix);:[139]wf[179][177]64[175]wf[179][177]66[137]1590
  104. 1560 [151]214,2:[153]:[151]211,19:[153]c5$"pulse width="
  105. 1580 pr[178]pw:l3[178]2:r3[178]3:c3[178]30:[141]1770:[153]"stop%"
  106. 1590 [151]214,1:[153]:[151]211,34:[153]"stop ";:[139]zz[178]0[167][153]"wait(NULL)ascasc";
  107. 1620 [139]zz[178]1[167][153]" waitdef(NULL)(NULL)";
  108. 1630 [153]"stop wait":[151]214,22:[153]:[139]wf[179][177]66[137]1700
  109. 1660 [153]c2$"(NULL)ing-sync frequency, (NULL)oice 2: (NULL)ress (NULL)stop"u$;
  110. 1670 [139]wf[179][177]66[167][153]"on":[137]1760
  111. 1680 [153]:[153]c5$"(NULL)et (NULL)ulse-width: (NULL)ress  list(NULL)defon":[137]1760
  112. 1700 [153]c6$"str$isplay speed: liststr$def":pr[178]sp:l3[178]2:r3[178]23:c3[178]17:[141]1770
  113. 1720 [153]"print valxamples: stophit 1-7stop";:[139]wf[178]64[137]1680
  114. 1740 [139]wf[178]18[176]wf[178]20[176]wf[178]22[176]wf[178]34[167][153]:[137]1660
  115. 1750 [153]:[153]"list    (NULL)ress (NULL)(NULL)atnlenvalclosepeekatn(NULL) to hold waveformon"
  116. 1760 [142]:___([139])
  117. 1770 m3[178]c3[170]l3[170]2:r4[178]r3[171]1:[139]l3[178]2[167]r$[178]"stop    wait":[137]1810
  118. 1790 [139]l3[178]3[167]r$[178]"stop     wait":[137]1810
  119. 1800 r$[178]"stop      wait"
  120. 1810 [151]214,r4:[153]:[151]211,c3:[153]r$:[151]214,r4:[153]:[151]211,m3[171][195]([196](pr))
  121. 1840 [153]"def"[202]([196](pr),2,4)"";:[142]:___
  122. 1860 [153]"load";:[141]1390
  123. 1870 [153]"sys(NULL)his is a simulated sine-wave demonstra-tion.  (NULL)he sound you left$valatn(NULL)";
  124. 1880 [153]" is a filtered triangle waveform--an approximation to a";
  125. 1890 [153]"sine wave (filtering cannot be shown)."
  126. 1900 [151]214,18:[153]:[153]"onatn sine wave is a 'pure' wave."
  127. 1910 [153]"right$t is free of harmonics."
  128. 1920 [153]"open  (NULL)ress asc1 for unfiltered triangle.":[142]:___
  129. 1930 " ascright$(NULL)valstr$close(NULL)atn(NULL)val(NULL)close(NULL)(NULL)peek"
  130. 1940 [153]"loadlist ** (NULL)atn(NULL)(NULL)(NULL)right$(NULL)chr$ * (NULL)(NULL)(NULL)(NULL)atnchr$val (NULL)(NULL)lenright$(NULL)(NULL)(NULL)(NULL)len(NULL)(NULL)val ** "
  131. 1950 [153]c1$"(NULL)3 ascrequency ";:[153][163]20)c4$" (NULL)weep freq"
  132. 1970 [153][163]28)"atnuto:";:[141]1390
  133. 1990 [151]214,17:[153]:[153]c3$"(NULL)aveform:listasc1-8,\  ";
  134. 2000 [153]c4$"stop(NULL)une:list(NULL)stop  (NULL)inewave: list(NULL)stop"
  135. 2010 [153]c1$"(NULL)o set frequency of (NULL)oice 3: (NULL)ress listasc"
  136. 2020 [153]c4$"(NULL)et sweep rate: (NULL)ress list(NULL)     stoplenolors: listlen"
  137. 2030 [153]c4$"atnuto-sweep on/off: list(NULL)sys  left$elp: listleft$  stop(NULL)uit: list(NULL)":[142]
  138. 2050 :
  139. 2060 [141]2070:[137]2120
  140. 2070 [151]cm,15:[151]bm,27:[151]sm,23:[151]ba,199:[141]2200:[142]
  141. 2120 [141]2360:[141]2190:[141]2500:[141]2190:[141]2220
  142. 2140 [161]a$:[139]a$[178]""[137]2140
  143. 2150 [153]"load":[151]cm,0:[151]bm,59:[151]sm,121:[151]ba,198
  144. 2170 [141]1940:[141]1390:[142]:"val(NULL)str$left$val(NULL)(NULL)
  145. 2190 getw$:ifw$=""goto2190
  146. 2200 print"":print"                                        [146][144]";:return:__
  147. 2210