home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1992 January / 1992-01.d64 / calc.machine (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  16KB  |  542 lines

  1. 0 clr
  2. 10 rem copyright 1992 - compute publications intl ltd - all rights reserved
  3. 100 dims1$(30),c1$(20),rm(25),rm$(25),u$(35),u(20),m1$(24)
  4. 105 p=950:t=6:l1=8:md=3:gd=1
  5. 110 data32,155,183,134,251,32,155,183,138,168,166,251,24,76,240,255
  6. 120 data"scientific",2,"conversion",13,"calender ",24,"info",34
  7. 130 data"calculator",2,"& reverse.",13,"memo pad.",24,"v4.1",34
  8. 140 data"sine    ","cos.    ","tan.    ","arc-sine","arc-cos."
  9. 145 data"arc-tan.","x^2     ","x^y     ","perm...n","comb...n"
  10. 150 data"1/x     ","x!      ","sqr     ","x^(1/y) ","m o d e "
  11. 155 data"log.    ","anti-log","ln.     ","anti-ln.","l.c.m.  ","g.c.f.  "
  12. 157 data"factor  ","memory +","memory -","m.recal ","m.clear "
  13. 158 data"add (+) ","subtract","multiply","divide  "
  14. 160 data"cm.  in.","km. mile","m.  yrd.","m2  yrd2","m2   sft"
  15. 165 data"m3   cft","mrla sft","hctr acr","lit  gal","lit  pnt"
  16. 170 data"kg.  lb.","grm  oz.","seer kg.","mtn  ltn","wth  btu"
  17. 175 data"kw.  hp.","dec  bsn","dec  dms","dec romn","[188]c    [188]f"
  18. 180 data1000,m,1000,m,1000,m,900,cm,500,d,400,cd,100,c,100,c,100,c,90,xc,50,l
  19. 182 data40,xl,10,x,10,x,10,x,9,ix,5,v,4,iv,1,i,1,i,1,i
  20. 190 fori=0to15:readb:pokep+i,b:next
  21. 191 poke53281,0:poke53280,0:printchr$(8)"[147]":gosub380
  22. 192 sysp,22,20:print" please wait ":gosub1700
  23. 193 fori=1to8:readm$(i),m(i):next
  24. 195 fori=1to30:reads1$(i):next
  25. 197 fori=1to20:readc1$(i):next
  26. 198 fori=1to21:readrm(i),rm$(i):next
  27. 200 datainch,mile,yard,square yard,square ft.,cubic ft.,square ft.,acre
  28. 202 datagallon,pint,pound,ounce,kilogram,long ton,b.t.u.,horse power
  29. 204 datacentimeter,kilometer,meter,square meter,square meter,cubic meter,merla
  30. 206 datahectare,liter,liter,kilogram,gram,seer,metric ton,watt hour,kilowatt
  31. 208 data2.54,1.60934,.9144,.8361,.0929,.02832,.00444444
  32. 210 data.40469,4.54609,.56826,.45359,28.35,1.072,1.016,.293,.7457
  33. 212 fori=1to32:readu$(i):next
  34. 214 fori=1to16:readu(i):next
  35. 216 data january,31,febuary,28,march,31,april,30,may,31,june,30,july,31
  36. 217 data august,31,september,30,october,31,november,30,december,31
  37. 218 fori=1to24:readm1$(i):next
  38. 224 r1$="[150]":r2$="":r3$="":r5$="[154]":r6$="[158]":r7$="[156]":r8$=""
  39. 226 md$(1)=" radian ":md$(2)=" grade  ":md$(3)=" degree "
  40. 228 sysp,22,20:print"             "
  41. 230 geta$:ifa$=""thengosub520
  42. 240 ift=3thenr4$=r1$:goto310
  43. 250 ifa$=chr$(13)then550
  44. 260 ifa$="_"thenrun
  45. 270 ifa$=""thenc1=c1+1
  46. 280 ifa$="[157]"thenc1=c1-1
  47. 290 ifc1<1thenc1=4
  48. 300 ifc1>4thenc1=1
  49. 310 gosub340
  50. 320 r4$=r2$:t=9-t:ift=6then250
  51. 330 goto230
  52. 340 ifc1=4andt=3thenr4$=r3$
  53. 350 sysp,2,m(c1):printr4$;m$(c1)
  54. 360 sysp,3,m(c1):printr4$;m$(c1+4)
  55. 370 return
  56. 380 print"[213][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178][178]";
  57. 385 print"[178][178][178][178][178][178][178][178][178][178][178][178][178][178][201][171][219][177][177][177][177][177][177][177][177]";
  58. 390 print"[177][177][219][177][177][177][177][177][177][177][177][177][177][219][177][177][177][177][177][177][177][177][177][219][177]";
  59. 395 print"[177][177][177][219][179][171][179][150]scientific[221][150]convers";
  60. 400 print"ion[221][150]calendar [221]info[171][179][171][179][150]cal";
  61. 405 print"culator[221][150]& reverse.[221][150]memo p";
  62. 410 print"ad.[221]v4.1[171][179][171][219][178][178][178][178][178][178][178][178][178][178][219][178][178]";
  63. 415 print"[178][178][178][178][178][178][178][178][219][178][178][178][178][178][178][178][178][178][219][178][178][178][178][219][179]";
  64. 420 print"[202][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177][177]";
  65. 425 print"[177][177][177][177][177][177][177][177][177][177][177][177][177][177][203]"
  66. 480 sysp,21,2:print"[213][192][192][192][192][192][192][192][192][201]"
  67. 490 sysp,22,2:print"[221]        [221]"
  68. 500 sysp,23,2:print"[202][192][192][192][192][192][192][192][192][203]"
  69. 510 sysp,24,2:print"crsr[146] hi-light  return[146] select  _[146] reset";:return
  70. 520 tm$=left$(ti$,2)+":"+mid$(ti$,3,2)+":"+right$(ti$,2)
  71. 530 sysp,22,3:printtm$
  72. 540 return
  73. 550 onc1gosub570,6000,8000,1700
  74. 560 t=6:gosub380:goto230
  75. 570 x2=21:t=5:lr=3:cb=1:cn=0
  76. 575 sysp,4,2:print"[154][176][192][192][192][192][192][192][192][192][178][192][192][192][192][192][192][192][192][178][192][192][174]"
  77. 580 sysp,5,2:print"[221]sin.    [221]log.    [221][159]f1[154][221]"
  78. 590 sysp,6,2:print"[221]cos.    [221]anti-log[221]  [221]"
  79. 600 sysp,7,2:print"[221]tan.    [221]ln.     [221]f [221]"
  80. 610 sysp,8,2:print"[221]arc-sin.[221]anti-ln.[221]o [221]"
  81. 620 sysp,9,2:print"[221]arc-cos.[221]l.c.m.  [221]r [221]"
  82. 630 sysp,10,2:print"[221]arc-tan.[221]g.c.f.  [221]  [221]"
  83. 640 sysp,11,2:print"[221]x^2     [221]factor  [221]m [221]"
  84. 650 sysp,12,2:print"[221]x^y     [221]memory +[221]a [221]"
  85. 660 sysp,13,2:print"[221]perm...n[221]memory -[221]i [221]"
  86. 670 sysp,14,2:print"[221]comb...n[221]m.recal [221]n [221]"
  87. 672 sysp,15,2:print"[221]1/x     [221]m.clear [221]  [221]"
  88. 674 sysp,16,2:print"[221]x!      [221]add (+) [221]m [221]"
  89. 676 sysp,17,2:print"[221]sqr     [221]subtract[221]e [221]"
  90. 678 sysp,18,2:print"[221]x^(1/y) [221]multiply[221]n [221]"
  91. 679 sysp,19,2:print"[221][158]m o d e [154][221]divide  [221]u [221]"
  92. 680 sysp,20,2:print"[173][192][192][192][192][192][192][192][192][177][192][192][192][192][192][192][192][192][177][192][192][189]":pc=0
  93. 690 geta$:ifa$=""thengosub520
  94. 700 ift=2thenr4$=r5$:goto770
  95. 710 ifa$=chr$(13)then815
  96. 715 ifa$="[133]"thenreturn
  97. 720 ifa$="_"thenrun
  98. 730 ifa$=""thencb=cb+1:gosub2050
  99. 740 ifa$="[145]"thencb=cb-1:gosub2050
  100. 742 ifa$=""ora$="[157]"thenlr=15-lr:gosub2050
  101. 750 ifcb<1thencb=15:lr=15-lr
  102. 760 ifcb>15thencb=1:lr=15-lr
  103. 770 gosub795
  104. 780 r4$=r2$:t=7-t:ift=5then710
  105. 790 goto690
  106. 795 c3=cb:iflr=12thenc3=cb+15
  107. 800 sysp,cb+4,lr:printr4$;s1$(c3)
  108. 810 return
  109. 815 x=lr:y=cb+5
  110. 820 onc3gosub 850,900,950,1000,1050,1100,1150,1200,1250,1300,1350,1400,1450,1500
  111. 825 ifc3<14then845
  112. 830 onc3-14gosub1550,1600,1650,2500,2600,2700,2800,2900,3000,3100,3200,3300,3400
  113. 835 ifc3<27then845
  114. 840 onc3-27gosub3500,3600,3700
  115. 845 goto575
  116. 850 gosub2200
  117. 860 an=sin(in*(NULL)/d1)
  118. 870 goto5000
  119. 900 gosub2200
  120. 910 an=cos(in*(NULL)/d1)
  121. 920 goto5000
  122. 950 gosub2200
  123. 960 an=tan(in*(NULL)/d1)
  124. 970 goto5000
  125. 1000 gosub2200
  126. 1020 an=atn(in/sqr(-in*in+1))*(d1/(NULL))
  127. 1045 goto5000
  128. 1050 gosub2200
  129. 1060 ifmd=1thend1=(NULL)
  130. 1070 an=(-atn(in/sqr(-in*in+1))+(NULL)/2)*(d1/(NULL))
  131. 1095 goto5000
  132. 1100 gosub2200
  133. 1120 an=atn(in)*(d1/(NULL))
  134. 1145 goto5000
  135. 1150 gosub2200:an=in^2
  136. 1195 goto5000
  137. 1200 gosub1860:print"value of x= ";:gosub1910:i1=val(s$)
  138. 1210 x=x+2:y=y+2:gosub1860:print"value of y= ";:gosub1910:i2=val(s$)
  139. 1220 an=i1^i2
  140. 1245 goto5000
  141. 1250 gosub1860:print"[159]value of n= ";:gosub1910:i1=val(s$)
  142. 1252 x=x+2:y=y+2:gosub1860:print"[159]value of r= ";:gosub1910:i2=val(s$)
  143. 1260 pc=1:in=i1:gosub1410:nf=an:in=i2:gosub1410:rf=an
  144. 1270 in=i1-i2:gosub1410:ff=an
  145. 1280 np=nf/ff:nc=np/rf
  146. 1290 an=np:ifcb=10thenan=nc
  147. 1295 goto5000
  148. 1300 goto1250
  149. 1350 gosub2200
  150. 1360 an=1/in
  151. 1395 goto5000
  152. 1400 gosub2200
  153. 1410 an=1:fori=1toin:an=an*i:next
  154. 1415 ifpc=1thenreturn
  155. 1445 goto5000
  156. 1450 gosub2200
  157. 1460 an=sqr(in)
  158. 1495 goto5000
  159. 1500 x=10:y=18:gosub1860:print"[129]value of x= ";:gosub1910:i1=val(s$)
  160. 1510 x=x+2:y=y+2:gosub1860:print"[129]value of y= ";:gosub1910:i2=val(s$)
  161. 1520 an=i1^(1/i2)
  162. 1545 goto5000
  163. 1550 gosub4000
  164. 1551 geta$:ifa$=""thengosub520
  165. 1552 ift1=2thenr4$=r8$:goto1566
  166. 1554 ifa$=chr$(13)thenreturn
  167. 1556 ifa$=""thenmd=md+1:gosub2050
  168. 1558 ifa$="[145]"thenmd=md-1:gosub2050
  169. 1560 ifmd<1thenmd=3
  170. 1562 ifmd>3thenmd=1
  171. 1566 gosub1572
  172. 1568 r4$=r1$:t1=7-t1:ift1=5then1554
  173. 1570 goto1551
  174. 1572 sysp,md+18,14:printr4$;md$(md)
  175. 1574 return
  176. 1600 gosub2200
  177. 1610 an=log(in)/log(10)
  178. 1645 goto5000
  179. 1650 gosub2200
  180. 1660 an=10^in
  181. 1695 goto5000
  182. 1700 gosub2040:x=5:y=8:sysp,y,x:print"[176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
  183. 1710 sysp,y+1,x:print"[221][207][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][183][208][221]"
  184. 1720 sysp,y+2,x:print"[221][180][158] calculating machine v4.1 [170][221]"
  185. 1730 sysp,y+3,x:print"