home *** CD-ROM | disk | FTP | other *** search
/ CBM Funet Archive / cbm-funet-archive-2003.iso / cbm / c64 / utilities / Ballistic.prg (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1994-09-21  |  8.4 KB  |  331 lines

  1. 10 print"[147]":poke 53280,peek(53281)
  2. 20 input"[147]transfer data               (y/n) ";i$
  3. 30 ifi$="y"then2640
  4. 40 u$=chr$(14):d$=chr$(15)
  5. 50 t8$=chr$(16)+"08"
  6. 60 t1$=chr$(16)+"10"
  7. 70 t2$=chr$(16)+"20"
  8. 80 t3$=chr$(16)+"30"
  9. 90 t4$=chr$(16)+"40"
  10. 100 t5$=chr$(16)+"50"
  11. 110 t6$=chr$(16)+"60"
  12. 120 t7$=chr$(16)+"70"
  13. 130 t9$=chr$(16)+"46"
  14. 140 dimt(11,4)
  15. 150 sp$(1)=" ":sp$(2)="  ":sp$(3)="   ":sp$(4)="    "
  16. 160 f2=0:c1=1:a4=1:v=5:r3=500
  17. 170 print "[147]"
  18. 180 input"calculate ballistic coeff. (y/n) ";i$
  19. 190 f=0
  20. 200 ifleft$(i$,1)="y"thenf=1
  21. 210 input"ingall's or british tables (i/b) ";i$
  22. 220 f1=0
  23. 230 ifleft$(i$,1)="i"thenf1=1
  24. 240 t3=59+f1:p1=29.53+.47*f1
  25. 250 input"wind speed              (mph) ";w1
  26. 260 input"cross wind angle        (deg) ";a1
  27. 270 w2=w1*cos(a1*1.74533e-02)*88/60
  28. 280 ifi$="w"then670
  29. 290 c1$="":input"cartridge";c$
  30. 300 iflen(c$)<38thenf3=0:goto390
  31. 310 form2=1tolen(c$)/2-1
  32. 320 ifmid$(c$,m2,1)<>" "then340
  33. 330 f3=1:m1=m2
  34. 340 ifmid$(c$,len(c$)-m2,1)<>" "then360
  35. 350 f3=2:m1=len(c$)-m2
  36. 360 next
  37. 370 c1$=right$(c$,len(c$)-m1)
  38. 380 c$=left$(c$,m1-1)
  39. 390 input"weight               (grains) ";w
  40. 400 w=w/7000
  41. 410 input"caliber                       ";d
  42. 420 iff=1then490
  43. 430 input"ballistic coefficient         ";c
  44. 440 ifc<>0then460
  45. 450 input"form factor                   ";i
  46. 460 ifc=0thenc=w/d/d/i
  47. 470 ifi=0theni=w/d/d/c
  48. 480 c1=c
  49. 490 input"non-standard conditions (y/n) ";i$:f2=0
  50. 500 ifleft$(i$,1)<>"y"then670
  51. 510 f2=1
  52. 520 input"temperature          (deg. f) ";t3
  53. 530 input"pressure             (in. hg) ";p1
  54. 540 input"altitude               (feet) ";a2
  55. 550 t4=59-(.003566)*a2+f1
  56. 560 p2=29.53-(8.581e-04)*a2+(8.602e-09)*a2*a2+.47*f1
  57. 570 a3=1+(3.073e-05)*a2+(6.731e-10)*a2*a2
  58. 580 a4=a3*(2-p1/p2)*(t3+459.4)/(t4+459.4)
  59. 590 c=c1*a4
  60. 600 iff=1then630
  61. 610 print"     (modified c =  ";int(1000*c)/1000;")"
  62. 620 goto660
  63. 630 t3=59+f1
  64. 640 p1=29.53+.47*f1
  65. 650 a2=0
  66. 660 i=w/d/d/c
  67. 670 iff=1then710
  68. 680 input"range                 (yards) ";r3
  69. 690 input"number of intervals    (1-10) ";u
  70. 700 r3=r3/500
  71. 710 input"muzzle velocity         (fps) ";v1
  72. 720 v2=v1+v:r2=0
  73. 730 input"calculate free recoil   (y/n) ";i1$
  74. 740 ifleft$(i1$,1)<>"y"then790
  75. 750 input"powder weight        (grains) ";w9
  76. 760 w9=w9/7000
  77. 770 input"gun weight              (lbs) ";w8
  78. 780 r9=(w*v1+4700*w9)^2/64.345/w8
  79. 790 iff=0then850 
  80. 800 input"range                   (yds) ";r1
  81. 810 r1=r1*3
  82. 820 input"final velocity          (fps) ";v4
  83. 830 i=1:c=1
  84. 840 goto1260
  85. 850 f9=1:close4:print"output to printer,"
  86. 860 input"     disk, or screen  (p/d/s) ";i$:ifi$="s"thenf9=0:goto910 
  87. 870 ifi$="p"thenopen4,4:goto910 
  88. 880 ifi$<>"d"then850
  89. 890 z$="0:":input"filename ";f$:iff$="temp"thenz$="@0:"
  90. 900 f$=z$+f$+",s,w":open15,8,15:open4,8,4,f$:gosub2690
  91. 910 ta=int((80-2*len(c$))/2)
  92. 920 ta$=right$(str$(ta),len(str$(ta))-1)
  93. 930 ifta<10thenta$="0"+ta$
  94. 940 iff9=0thengosub2750:goto1260
  95. 950 print#4,chr$(14)chr$(16)ta$c$chr$(15)
  96. 960 ta=int((80-2*len(c1$))/2)
  97. 970 ta$=right$(str$(ta),len(str$(ta))-1)
  98. 980 ifta<10thenta$="0"+ta$
  99. 990 iff3>0thenprint#4,chr$(14)chr$(16)ta$c1$chr$(15)
  100. 1000 print#4," "
  101. 1010 print#4," "
  102. 1020 print#4," "
  103. 1030 print#4,t8$"bullet weight"u$t9$;int(w*70000+.5)/10;d$t6$"grains"
  104. 1040 print#4,t8$"caliber"u$t9$;d;d$
  105. 1050 print#4,t8$"ballistic coeff."u$t9$;int(c*1000+.5)/1000;d$
  106. 1060 print#4,t8$"form factor"u$t9$;int(i*1000.5)/1000;d$
  107. 1070 iff1=1thenprint#4,t8$"('ingals' ";
  108. 1080 iff1<>1thenprint#4,t8$"('british 1909' ";
  109. 1090 print#4,"ballistic tables used)"
  110. 1100 print#4,t8$"wind"u$t9$;w1;d$t6$"miles per hour"
  111. 1110 print#4,t8$"at angle of"u$t9$;a1;d$t6$"from broadside"
  112. 1120 print#4,t8$"for crosswind"u$t9$;int(w2*10+.5)/10;d$t6$"feet per second"
  113. 1130 iff2=1thenprint#4,t8$"(non-standard atmospheric conditions)"
  114. 1140 print#4,t8$"temperature"u$t9$;t3;d$t6$"degrees fahrenheit"
  115. 1150 print#4,t8$"atmos. press."u$t9$;int(100*p1+.5)/100;d$t6$"inches of mercury"
  116. 1160 print#4,t8$"altitude"u$t9$;a2;d$t6$"ft above sea level"
  117. 1170 print#4," "
  118. 1180 ifi1$<>"y"then1200
  119. 1190 print#4,t8$"free recoil in";w8;" lb gun"u$t9$;int(r9*100+.5)/100;d$t6$"ft. lbs
  120. 1200 [152]4," ":[152]4," "
  121. 1210 s$[178]"   range     vel.     energy    max ht.    drop      drift     time"
  122. 1220 [152]4,t8$s$
  123. 1230 s$[178]"    yds.     f/s      ft-lbs      in.       in.       in.      sec."
  124. 1240 [152]4,t8$s$
  125. 1250 [152]4," "
  126. 1260 k[178]2[172]c[172]v
  127. 1270 v2[178]v2[171]2[172]v
  128. 1280 [139]f1[178]1[167][141]2460
  129. 1290 [139]f1[179][177]1[167][141]2310
  130. 1300 s1[178]s
  131. 1310 s[178]s[170]k[173](a[172]v2[174](m[171]1))
  132. 1320 t1[178]t
  133. 1330 t[178]t[170]k[173](a[172]v2[174]m)
  134. 1340 [139]f[178]1[167][139]v2[179]v4[167]1370
  135. 1350 [139]f[179][177]1[167][139]s[177][178]r2[167]1510
  136. 1360 [137]1270
  137. 1370 s[178]s1[170](s[171]s1)[172](v2[170]v[171]v4)[173](2[172]v)
  138. 1380 c[178](r1[173]s)[173]a4
  139. 1390 i[178]w[173]d[173]d[173]c
  140. 1400 [139]f[179][177]1[167]1450
  141. 1410 [153]
  142. 1420 [153]"ballistic coeff.  = ";[181](1000[172]c)[173]1000
  143. 1430 [153]"form factor       = ";[181](1000[172]i)[173]1000
  144. 1440 c1[178]c:f[178]0:[137]2150
  145. 1450 [152]4," "
  146. 1460 [152]4,t8$"ballistic coeff.  = "u$t4$;[181](1000[172]c)[173]1000;d$
  147. 1470 [152]4,t8$"form factor       = "u$t4$;[181](1000[172]i)[173]1000;d$
  148. 1480 c1[178]c
  149. 1490 f[178]0
  150. 1500 [137]2150
  151. 1510 ov3[178]v3
  152. 1520 v3[178](v2[170]v)[171]2[172]v[172](r2[171]s1)[173](s[171]s1)
  153. 1530 [139]ov3[178]0[167]1580
  154. 1540 [139](ov3[171]v3)[173]ov3[177].01[167]1580
  155. 1550 [153]"      ** possible drift error **"
  156. 1560 [153]"interval velocity difference = ";[181](10000[172](ov3[171]v3)[173]ov3)[173]100;"%"
  157. 1570 [133]"continue                (y/n) ";i$:[139]i$[178]"n"[167]2170
  158. 1580 e[178]v3[172]v3[172]w[173]64.345
  159. 1590 t2[178]t1[170](t[171]t1)[172](r2[171]s1)[173](s[171]s1)
  160. 1600 t((r2[173](1500[173]u[172]r3)[170]1.5),1)[178]r2[173]3
  161. 1610 d1[178](110.3[170]82.7[172]v3[173]v1)[172]t2[172]t2
  162. 1620 t((r2[173](1500[173]u[172]r3)[170]1.5),2)[178]d1
  163. 1630 w3[178]12[172]w2[172](t2[171]r2[173]v1)
  164. 1640 [139]w3[177][178]0[167]1670
  165. 1650 [153]"          ** drift error **"
  166. 1660 [133]"continue                (y/n) ";i$:[139]i$[178]"n"[167]2170
  167. 1670 [139]f9[178]0[167][141]2860:[137]1710
  168. 1680 [152]4,t1$;[181](r2[173]3[170].5);t2$;[181](v3[170].5);t3$;[181](e[170].5);
  169. 1690 [152]4,t4$;[181](4800[172]t2[172]t2[170].5)[173]100;t5$;[181](100[172]d1[170].5)[173]100;
  170. 1700 [152]4,t6$;[181](100[172]w3[170].5)[173]100;t7$;[181](1000[172]t2[170].5)[173]1000
  171. 1710 r2[178]r2[170]1500[173]u[172]r3
  172. 1720 [139]f[178]0[167][139]r2[177]1500[172]r3[167]1740
  173. 1730 [137]1270
  174. 1740 [139]f9[179][177]0[167][152]4," "
  175. 1750 [133]"sight on at  ";r4
  176. 1760 [133]"sight heightclose";h
  177. 1770 [139]f9[178]0[167][141]2980:[137]2150
  178. 1780 [152]4," "
  179. 1790 [152]4,t8$"sight on at"u$;r4;d$"yards"
  180. 1800 [152]4,t8$"sight height ="u$;h;d$"inches above bore"
  181. 1810 [152]4," "
  182. 1820 t(1,4)[178]9999
  183. 1830 [129]x[178]1[164]u[170]1
  184. 1840 t(x,3)[178]t((r4[173](500[173]u[172]r3)[170]1.5),2)[172]t(x,1)[173]r4[171]t(x,2)[171]h[172](r4[171]t(x,1))[173]r4
  185. 1850 [139]x[178]1[167]1870
  186. 1860 t(x,4)[178]t(x,3)[173](1.0472[172]t(x,1)[173]100)
  187. 1870 [130]
  188. 1880 [152]4,t8$"range ";
  189. 1890 [129]x[178]1[164]u[170]1
  190. 1900 [139]t(x,i)[177][178]1000[167]1940
  191. 1910 [139]t(x,1)[179]100[167]1960
  192. 1920 [152]4,t(x,1);" ";
  193. 1930 [137]1970
  194. 1940 [152]4,t(x,1);
  195. 1950 [137]1970
  196. 1960 [152]4," ";t(x,1);" ";
  197. 1970 [130]
  198. 1980 [152]4:[152]4,t8$"traj. ";
  199. 1990 [129]x[178]1[164]u[170]1
  200. 2000 m[178][181](10[172]t(x,3))[173]10:m$[178][196](m)
  201. 2010 [139][182](m)[177]99.9[167]m$[178]" ***"
  202. 2020 [139]m[177]0[167]m$[178]"+"[170][201](m$,[195](m$)[171]1)
  203. 2030 [152]4,m$;sp$(6[171][195](m$));
  204. 2040 [130]
  205. 2050 [152]4:[152]4,t8$"m.o.a.";
  206. 2060 [129]x[178]1[164]u[170]1
  207. 2070 m[178][181](10[172]t(x,4))[173]10:m$[178][196](m)
  208. 2080 [139]m[177]0[167]m$[178]"+"[170][201](m$,[195](m$)[171]1)
  209. 2090 [139][182](m)[177]99.9[167]m$[178]" ***"
  210. 2100 [152]4,m$;sp$(6[171][195](m$));
  211. 2110 [130]
  212. 2120 [152]4," "
  213. 2130 [152]4," "
  214. 2140 [139]f9[178]0[167][141]2980
  215. 2150 s[178]0
  216. 2160 t[178]0
  217. 2170 [153]"andandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandandand";
  218. 2180 [153]" waitwind  waitatmosphere  waitrestart program  waitquit ";
  219. 2190 [153]"  waitsights  waitclose  waittransfer  waitnew range  ";
  220. 2200 [153]" waitusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusrusr";
  221. 2210 [161] i$:[139]i$[178]""[167]2210 
  222. 2220 [139]i$[178]"w"[167]250
  223. 2230 [139]i$[178]"a"[167]520
  224. 2240 [139]i$[178]"r"[167][156]:[137]40 
  225. 2250 [139]i$[178]"s"[167]1750
  226. 2260 [139]i$[178]"q"[167]2630
  227. 2270 [139]i$[178]"c"[167][152]4,"####":[160]4:[160]15:[137]2170
  228. 2280 [139]i$[178]"t"[167]2640
  229. 2290 [139]i$[178]"n"[167]v3[178]0:[137]670
  230. 2300 [137]2210
  231. 2310 [139]v2[177]2600[167]2450
  232. 2320 [139]v2[177]2000[167]2440
  233. 2330 [139]v2[177]1460[167]2430
  234. 2340 [139]v2[177]1190[167]2420
  235. 2350 [139]v2[177]1040[167]2410
  236. 2360 [139]v2[177]840[167]2400
  237. 2370 [139]v2[177]0[167]2390
  238. 2380 [128]
  239. 2390 a[178]7.4422e[171]4:m[178]1.6:[142]
  240. 2400 a[178]5.9939e[171]8:m[178]3:[142]
  241. 2410 a[178]2.3385e[171]18:m[178]6.45:[142]
  242. 2420 a[178]9.5408e[171]8:m[178]3:[142]
  243. 2430 a[178]5.9814e[171]4:m[178]1.8:[142]
  244. 2440 a[178]5.8495e[171]3:m[178]1.5:[142]
  245. 2450 a[178]1.5366e[171]3:m[178]1.67:[142]
  246. 2460 [139]v2[177]3600[167]2620
  247. 2470 [139]v2[177]2600[167]2610
  248. 2480 [139]v2[177]1800[167]2600
  249. 2490 [139]v2[177]1370[167]2590
  250. 2500 [139]v2[177]1230[167]2580
  251. 2510 [139]v2[177]970[167]2570
  252. 2520 [139]v2[177]790[167]2560
  253. 2530 [139]v2[177]0[167]2550
  254. 2540 [128]
  255. 2550 a[178]4.67617e[171]5:m[178]2:[142]
  256. 2560 a[178]5.9353e[171]8:m[178]3:[142]
  257. 2570 a[178]6.33681e[171]14:m[178]5:[142]
  258. 2580 a[178]9.56978e[171]8:m[178]3:[142]
  259. 2590 a[178]1.31601e[171]4:m[178]2:[142]
  260. 2600 a[178]1.24795e[171]3:m[178]1.7:[142]
  261. 2610 a[178]4.06488e[171]3:m[178]1.55:[142]
  262. 2620 a[178]4.05e[171]3:m[178]1.551:[142]
  263. 2630 [160]5:[160]4:[153]"load":[128]
  264. 2640 [160]15:[160]4:[160]5:[159]4,4
  265. 2650 [133]"filename ";f$:f$[178]"0:"[170]f$[170]",s,r":[159]15,8,15:[159]5,8,5,f$:[141]2690
  266. 2660 [132]5,i$
  267. 2670 [139]i$[178]"####"[167][152]4:[160]4:[160]5:[160]15:[137]2170
  268. 2680 [152]4,i$:[137]2660
  269. 2690 [132]15,aa,bb$,cc,dd
  270. 2700 [139]aa[179]20[167] [142]
  271. 2710 [153]"            ** disk error **"
  272. 2720 ee$[178][196](aa)[170]"   "[170]bb$[170]"  "[170][196](cc)[170]" "[170][196](dd)
  273. 2730 [153]"";[163](40[171][195](ee$))[173]2);ee$;""
  274. 2740 [160]15:[160]4:[160]5:[137]2170
  275. 2750 [153]"    crosswind";[181](w2[172]10[170].5)[173]10;"feet per second"
  276. 2760 [139]f2[178]1[167][153]"(non-standard atmospheric conditions)"
  277. 2770 [139]i1$[179][177]"y"[167]2800
  278. 2780 [153]"       free recoil in";w8;" lb gun"
  279. 2790 [153]"             ";[181](r9[172]10[170].5)[173]10;"ft. lbs"
  280. 2800 [153]
  281. 2810 s$[178]"range(NULL)vel(NULL)energy(NULL)mx ht(NULL)drop(NULL)drift(NULL)time"
  282. 2820 [153]s$
  283. 2830 s$[178]" yds.(NULL)f/s(NULL)ft-lbs(NULL) in. (NULL) in.(NULL) in. (NULL)sec."
  284. 2840 [153]s$
  285. 2850 [153]:[142]
  286. 2860 [153][181](r2[173]3[170].5);
  287. 2870 [153][163]5);[181](v3[170].5);
  288. 2880 [153][163]11);[181](e[170].5);
  289. 2890 [139]48[172]t2[172]t2[179]10[167][153][163]17);[181](480[172]t2[172]t2[170].5)[173]10;:[137]2910
  290. 2900 [153][163]17);[181](48[172]t2[172]t2[170].5);
  291. 2910 [139]d1[177]10[167][153][163]22);[181](d1[170].5);:[137]2930
  292. 2920 [153][163]22);[181](10[172]d1[170].5)[173]10;
  293. 2930 [139]w3[177]10[167][153][163]28);[181](w3[170].5);:[137]2950
  294. 2940 [153][163]28);[181](10[172]w3[170].5)[173]10;
  295. 2950 [139]t2[177]1[167][153][163]35);[181](10[172]t2[170].5)[173]10;:[137]2970
  296. 2960 [153][163]34);[181](100[172]t2[170].5)[173]100
  297. 2970 [142]
  298. 2980 [153]
  299. 2990 t(1,4)[178]9999
  300. 3000 [129]x[178]1[164]u[170]1
  301. 3010 t(x,3)[178]t((r4[173](500[173]u[172]r3)[170]1.5),2)[172]t(x,1)[173]r4[171]t(x,2)[171]h[172](r4[171]t(x,1))[173]r4
  302. 3020 [139]x[178]1[167]3040
  303. 3030 t(x,4)[178]t(x,3)[173](1.0472[172]t(x,1)[173]100)
  304. 3040 [130]
  305. 3050 [153]"r ";
  306. 3060 [129]x[178]1[164]u[170]1
  307. 3070 [139]t(x,i)[177][178]1000[167]3110
  308. 3080 [139]t(x,1)[179]100[167]3130
  309. 3090 [153]t(x,1);" ";
  310. 3100 [137]3140
  311. 3110 [153]t(x,1);
  312. 3120 [137]3140
  313. 3130 [153]" ";t(x,1);" ";
  314. 3140 [130]
  315. 3150 [153]:[153]"t ";
  316. 3160 [129]x[178]1[164]u[170]1
  317. 3170 m[178][181](10[172]t(x,3))[173]10:m$[178][196](m)
  318. 3180 [139][182](m)[177]99.9[167]m$[178]" ***"
  319. 3190 [139]m[177]0[167]m$[178]"+"[170][201](m$,[195](m$)[171]1)
  320. 3200 [153]m$;sp$(6[171][195](m$));
  321. 3210 [130]
  322. 3220 [153]:[153]"m ";
  323. 3230 [129]x[178]1[164]u[170]1
  324. 3240 m[178][181](10[172]t(x,4))[173]10:m$[178][196](m)
  325. 3250 [139]m[177]0[167]m$[178]"+"[170][201](m$,[195](m$)[171]1)
  326. 3260 [139][182](m)[177]99.9[167]m$[178]" ***"
  327. 3270 [153]m$;sp$(6[171][195](m$));
  328. 3280 [130]
  329. 3290 [153]:[153]
  330. 3300 [142]
  331.