home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 98 / 098.d81 / projector (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  11KB  |  407 lines

  1. 10 rem the projector
  2. 20 rem (c) 1992
  3. 30 gosub 8800
  4. 160 poke 56,144:clr:dimc$(15):poke53280,0:poke53281,0:poke650,128
  5. 190 j$(0)="shown":j$(1)="hidden"
  6. 200 c$(0)="[194]lack":c$(1)="[215]hite":c$(2)="[210]ed":c$(3)="[195]yan":c$(4)="[208]urple"
  7. 210 c$(5)="[199]reen":c$(6)="[194]lue":c$(7)="[217]ellow":c$(8)="[207]range":c$(9)="[194]rown"
  8. 215 c$(10)="[204]ight [210]ed":c$(11)="[196]ark [199]ray":c$(12)="[205]edium [199]ray"
  9. 217 c$(13)="[204]ight [199]reen":c$(14)="[204]ight [194]lue":c$(15)="[204]ight [199]ray"
  10. 220 gosub5000:rem constants
  11. 300 mt=36864:gosub5400:rem choose
  12. 310 if pc=. then 300
  13. 320 gosub9000:rem config'n
  14. 330 gosub 700:rem draw
  15. 340 gosub10000: rem menu
  16. 350 :
  17. 360 if a=6 then 330
  18. 400 print:poke212,0:sysmt+9,208:on a gosub500,600,14000,9000,5400,330,9900
  19. 410 sysmt+9,208:if ud>. then gosub 1300
  20. 420 goto 340
  21. 490 :
  22. 500 sys hi,0:waitkb,7:get a$:return:rem   view screen
  23. 540 :
  24. 600 sys hi,0:sys du,0,0:return:rem dump to printer
  25. 690 :
  26. 700 gosub 2600
  27. 710 ifddthen 900
  28. 720 sysmt+9,208:poke787,1:ms$="[195]reating data for "+n$:gosub15000
  29. 730 onpcgosub3000,3100,3200,3300,3400,3500,3600,3700,3800,3900,4000,4100
  30. 735 ifpc>12thenonpc-12gosub4200,4300,10,10,10,10,10
  31. 740 ifkthen 800
  32. 745 :
  33. 750 forx=mto0step-1
  34. 755 fory=0ton
  35. 760 z(x,y)=fnz(x)
  36. 770 nexty:print"[146]"x"[157]  ";:nextx:goto1000
  37. 780 :
  38. 800 forx=mto0step-1
  39. 810 fory=0ton
  40. 820 r=fnr(x):s=fns(y)
  41. 830 z(x,y)=fnz(x)
  42. 840 nexty:print"[146]"x"[157] ";:nextx:goto 1000
  43. 850 :
  44. 890 rem read empirical data
  45. 900 ms$="[210]eading data...":poke787,1:gosub15000
  46. 910 on pc gosub7000,7500:readn$,m,n,sp
  47. 920 fory=0ton
  48. 930 forx=0tom
  49. 940 read z(x,y)
  50. 950 nextx:print"[146]"n-y"[157]  ";:nexty
  51. 960 :
  52. 1000 rem vertical scaling
  53. 1010 sysmt+9,208:ms$="[195]hecking data...":poke787,1:gosub15000:
  54. 1020 :
  55. 1030 vscalar=9e9
  56. 1040 fory=0ton
  57. 1050 :
  58. 1060 a=0:forx=0tom
  59. 1070 ifz(x,y)>athena=z(x,y)
  60. 1080 next:rem high pt on line
  61. 1090 :
  62. 1100 ifathentmp=(199-yv(y))/a:if vs>tm then vs=tm
  63. 1120 next:rem best scale
  64. 1130 :
  65. 1200 rem calculate rise
  66. 1210 ms$="[211]caling data...":poke787,1:gosub15000
  67. 1220 :
  68. 1230 fory=0ton
  69. 1240 tm=yv(y)
  70. 1250 forx=0tom
  71. 1260 r(x,y)=z(x,y)*vs+tm
  72. 1270 nextx,y
  73. 1280 :
  74. 1300 rem set up screen
  75. 1320 syshi,0,gb,gc
  76. 1330 sysdm,1
  77. 1340 :
  78. 1380 rem plot horizontal lines
  79. 1400 sys mo,10,r(0,0)
  80. 1410 :
  81. 1420 fory=0ton
  82. 1430 tm=yh(y)
  83. 1440 :
  84. 1450 forx=1tom
  85. 1460 sysdr,tm+xh(x),r(x,y)
  86. 1470 nextx
  87. 1480 :
  88. 1490 if y=n then 1580
  89. 1500 rem plot verticals
  90. 1520 sysd1,yh(y+1)+xh(m),r(m,y+1)
  91. 1530 sysdr,yh(y)+xh(m),r(m,y)
  92. 1535 :
  93. 1536 if v then forx=0to0:goto 1550
  94. 1540 forx=m-1to0step-1
  95. 1550 sysmo,tm+xh(x),r(x,y)
  96. 1560 sysdr,yh(y+1)+xh(x),r(x,y+1)
  97. 1570 nextx
  98. 1575 :
  99. 1580 nexty
  100. 1590 :
  101. 1600 rem draw box
  102. 1620 ifpeek(653)then1800
  103. 1625 sysmo,10,r(0,0)
  104. 1630 sysd1,10,10
  105. 1640 sysd1,xh(m),10
  106. 1650 sysd1,xh(m),r(m,0)
  107. 1660 sysmo,xh(m),10
  108. 1670 sysd1,xh(m)+yh(n),yv(n)
  109. 1680 sysd1,xh(m)+yh(n),r(m,n)
  110. 1690 :
  111. 1700 rem title
  112. 1720 sysco,tc:syspr,1,24,n$
  113. 1740 :
  114. 1800 t$=n$:rem wait for human
  115. 1810 for i=1 to 2e3
  116. 1820 geta$:if a$="" then next
  117. 1840 ud=.:return
  118. 1845 :
  119. 2300 if dd thenms$="[195]an't change size of data":gosub15000:return
  120. 2310 ms$="[204][201][206][197][211] [193][195][210][207][211][211]":min=2:max=yz+1:cu=n+1:gosub8100
  121. 2340 x=cu:n=int(x)-1:return
  122. 2350 :
  123. 2400 if dd thenms$="[195]an't change size of data":gosub15000:return
  124. 2405 ms$="[208][207][201][206][212][211] [208][197][210] [204][201][206][197]":min=2:max=xz+1:cu=m+1:gosub8100:x=cu
  125. 2430 m=int(x)-1:return
  126. 2500 rem projection
  127. 2510 :
  128. 2520 rem default angle
  129. 2530 ms$="[196][197][199][210][197][197][211] (0-90)":min=0:max=90:cu=th:gosub8100:th=cu
  130. 2560 return
  131. 2570 :
  132. 2600 a=th*(NULL)/180
  133. 2610 tmp=120*cos(a)
  134. 2620 xgrid=int((309-tm)/m)
  135. 2630 ygrid=int(sp*sin(a)/n)
  136. 2640 ystp=int(tm/n)
  137. 2650 :
  138. 2700 rem offsets
  139. 2710 :
  140. 2720 forx=0tom
  141. 2730 xhriz(x)=10+x*xg
  142. 2740 next
  143. 2750 :
  144. 2760 fory=0ton
  145. 2770 yhriz(y)=y*ys
  146. 2780 yvert(y)=10+y*yg
  147. 2790 next
  148. 2800 return
  149. 2810 :
  150. 3000 g=m/2:h=n/2:k=1
  151. 3010 deffnr(x)=sqr((x-g)*(x-g)+(y-h)*(y-h))+1:deffns(y)=.
  152. 3020 deffnz(x)=(cos(r)+1)/r+1
  153. 3030 data"[211]plash":return
  154. 3040 :
  155. 3100 g=560:h=m/2:i=n/2:j=h*i/40
  156. 3110 deffnz(x)=g-exp(sqr(abs((x-h)*(y-i)/j)))
  157. 3120 data"[211]hell roof":return
  158. 3130 :
  159. 3200 g=10:h=1.5:i=4
  160. 3210 deffnz(x)=g+sin(sqr(x*x+h*y*y))+y/i
  161. 3220 data"[199]ravity waves":return
  162. 3230 :
  163. 3300 g=m*m*m/360:h=1200/n:i=3000/n/n:j=2000/n/n/n
  164. 3310 deffnz(x)=x*x-x*x*x/g+h*y-i*y*y+y*y*y*j+500
  165. 3320 data"[195]ontours":return
  166. 3330 :
  167. 3400 g=n/2:h=m/4:i=.75*m:j=.6*n
  168. 3410 deffnz(x)=y+(g-y)*((x>h)and(x<i))*((y>3)and(y<j))
  169. 3420 data"[208]lateau":return
  170. 3430 :
  171. 3500 g=m*n:j=2
  172. 3510 deffnz(x)=g-n*x-m*y+j*x*y
  173. 3520 data"[200]yperboloid":return
  174. 3530 :
  175. 3600 g=5
  176. 3610 deffnz(x)=sin(x*y/m)+g
  177. 3620 data"[201]nverse waves 1":return
  178. 3630 :
  179. 3700 g=m/2:h=n/2:i=4:j=1
  180. 3710 deffnz(x)=sin((x-g)*(y-h)/h)+y/i+j
  181. 3720 data"[201]nverse waves 2":return
  182. 3730 :
  183. 3800 g=m/2:h=n/2:k=m-1
  184. 3810 deffnr(x)=m-abs(x-g):deffns(y)=k-abs(y-h)
  185. 3820 deffnz(x)=r-(r<s)*(s-r)
  186. 3830 data"[200]ouse roof":return
  187. 3840 :
  188. 3900 g=m/4:h=2:i=n/4:k=.4
  189. 3910 deffnr(x)=x/g-h:deffns(y)=y/i-h
  190. 3920 deffnz(x)=sin(r*r*h+s*s)*exp(-r*r-s*s)+k
  191. 3930 data"[211]tetson":return
  192. 3940 :
  193. 4000 g=6:h=2:i=.1:k=-1.2
  194. 4010 deffnr(x)=y/n-x/m:deffns(y)=r+r
  195. 4020 deffnz(x)=(i+exp(s+r))*cos(g*r*r-g*s+k)+h
  196. 4030 data"[195]ascade":return
  197. 4040 :
  198. 4100 g=int(m/3):h=m-g:i=n/2:j=3:k=.05:f=.6
  199. 4104 deffnr(x)=(x-g)*(x-g)+(y-i)*(y-i)
  200. 4106 deffns(y)=(x-h)*(x-h)+(y-i)*(y-i)
  201. 4120 deffnz(x)=cos(sqr(r))*(exp(-r/j)+k)+cos(sqr(s))*(exp(-s/j)+k)+f
  202. 4130 data"[212]win peaks":return
  203. 4140 :
  204. 4200 g=m/2:h=n/2:i=sqr(m*n)/3:j=5:k=1
  205. 4210 deffnr(x)=abs(sqr((x-g)*(x-g)+(y-h)*(y-h))-i)+k:deffns(y)=.
  206. 4220 deffnz(x)=k/r+j
  207. 4230 data"[195]rater":return
  208. 4240 :
  209. 4300 g=1
  210. 4310 k=1:deffnr(x)=x:deffns(y)=y
  211. 4320 deffnz(x)=r+s
  212. 4330 data "[213]ser [198]unction":rem title
  213. 4340 return
  214. 4350 :
  215. 4980 datax
  216. 4990 :
  217. 5000 hi=49152:d1=49155:mo=49161
  218. 5010 dm=49167:co=49173:te=49179
  219. 5020 pr=49182:hd=49191:du=49194
  220. 5030 rv$(0)="[146][154]":rv$(1)="[158]
  221. 5040 :
  222. 5050 kb[178]198:m[178]20:n[178]16:th[178]60:dr[178]hd:sp[178]96
  223. 5060 [134] a,b,c,d,e,f,g,h,j,k,r,s,x,y,pc,a$,t$,v,hl,dd,vs,tm,xg,yg,ys,th,ud
  224. 5065 xz[178]49:yz[178]39:gc[178]13:gb[178]0:tc[178]8:ft[178]15
  225. 5070 [134] n$(20):[129] i[178]1 [164] 20:[135]n$
  226. 5080 n$(i)[178]n$:[130]:pt[178]14
  227. 5100 [134] z(xz,yz),r(xz,yz)
  228. 5110 [134] xh(xz),yh(yz),yv(yz)
  229. 5200 [142]
  230. 5397 :
  231. 5398 [143] choices
  232. 5399 :
  233. 5400 [141] 8800:[158]mt[170]3,1,38,4,24,127,14
  234. 5405 [158]mt[170]3,9,29,6,23,255,6:[158]mt[170]3,10,30,5,22,160,3:[153]"open";
  235. 5410 [129] i[178]1 [164] 14
  236. 5430 [158]mt[170]18,5[170]i,n$(i):[130]
  237. 5460 [158]mt[170]18,5[170]i,"(NULL)ead data"
  238. 5470 [158]mt[170]18,6[170]i,"(NULL)eturn (NULL)o (NULL)(NULL)atnstr$(NULL)(NULL)atn(NULL)"
  239. 5540 [158]mt,6,10,30,16,3[170]128,129,0:[161]a$:a[178][198](a$)[171]48
  240. 5550 [139]a[178]16[167][141]9900:[137]5540
  241. 5560 [151]199,0:[139]a[178]15[167]6000
  242. 5570 [139]a[178]14[167][141]13000:[151]199,0:[139]a$[178]"e"[167]5700
  243. 5580 k[178]0:dd[178]0
  244. 5590 pc[178]a:n$[178]"'"[170]n$(a)[170]"'":[158]mt[170]24,n$:[143]  print"   "a$". "n$;
  245. 5600 sp[178]96:[142]
  246. 5610 :
  247. 5700 [153]"load(NULL)he (NULL)rojector can display your own":[153]"mathematical functions.  str$efine
  248. 5705 print"the equation in line 4320, ie:
  249. 5710 [153]" 4320 str$valascasc(NULL)(NULL)((NULL))=..... (NULL), (NULL) +chr$
  250. 5715 print"[193]dd constant [199] as needed, so there are
  251. 5720 [153]"no negative results.  valnter the title
  252. 5725 print"as [196][193][212][193] in line 4330, then return.
  253. 5730 [153]"(NULL)ee the other formulas for examples.
  254. 5735 print"[204]ine 4300 [205][213][211][212] be present, and may
  255. 5740 [153]"define chr$, left$, right$, & mid$ as constants, if
  256. 5745 print"wanted. [204]ine 4310 may define [198][206][210]([216]) and
  257. 5750 [153]"asc(NULL)(NULL)((NULL)) as intermediate steps if wanted.
  258. 5755 print"[201]f they are used, then you must set
  259. 5760 [153]"(NULL)=1; otherwise, set (NULL)=0.
  260. 5775 print"[208]ress e to enter equation now, [210][197][212][213][210][206]
  261. 5780 [153]"to bypass:";:[146] kb,7:[161]a$:[139] a$[179][177]"e"[167][142]
  262. 5790 [153]:[153]"(NULL)rogram halted":[155] 4300[171]4340
  263. 6000 [143] data reader
  264. 6010 :
  265. 6020 [158]mt[170]6,208:[158]mt[170]3,8,19,8,12,255,6:[158]mt[170]3,9,20,7,11,160,7
  266. 6030 [158]mt[170]15,10,8,"sys(NULL)ainfall
  267. 6040 sysmt+15,10,9,"[217]our data
  268. 6070 [158]mt[170]15,10,10,"ascorg