home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 32 / 032.d81 / visicalculator (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  6KB  |  183 lines

  1. 10 poke650,128:print"[147]"chr$(142);:gosub 1000:goto1300
  2. 20 t$="":get t$:if t$="" then 20
  3. 22 poke198,.
  4. 23 ift$="q"then3000
  5. 24 if t$="m" then goto 600
  6. 25 if ct=0 then e=0
  7. 30 if t$="=" or t$="+" or t$="-" or t$="*" or t$="/" then goto500
  8. 40 if t$="[176]" or t$="[185]" then goto500
  9. 50 if t$<>"[170]" then 80
  10. 60 if ct<>0 then gosub960:e=note:x=e:gosub700:goto560
  11. 70 gosub950:ac=notac:x=ac:gosub700:goto560
  12. 80 if t$="v"goto850
  13. 85 if t$="."andbs$="9" then pt$="y":goto 160
  14. 90 if t$>="0"andt$<= "9" and pt$<>"y"thene=bs*e+val(t$):goto 160
  15. 95 if t$>="0"andt$<= bs$andpt$="y"thene=e+val(t$)/xx:xx=xx*bs:goto160
  16. 97 if t$=chr$(8) thenbs=16:bs$="f":print ""tab(15) "[144](h)":goto200
  17. 98 if t$=chr$(4) thenbs=10:bs$="9":print""tab(15)"[144](d)":goto200
  18. 99 if t$=chr$(15) thenbs=8:bs$="7":print ""tab(15)"[144](o)":goto200
  19. 100 if t$="p" then goto 900
  20. 110 if t$>="a"andt$<="f"andbs$="f"thene=bs*e+asc(t$)-asc("7"):goto160
  21. 120 ift$=chr$(133)then gosub20000:goto10
  22. 130 if t$=chr$(3) then ac=0:op$=" ":po$=op$:goto 150
  23. 140 if t$=chr$(5) then goto 150
  24. 141 if t$="&"then goto500
  25. 145 gosub 10000:goto20
  26. 150 e=0:pt$="":xx=bs:x=e:gosub700:goto560
  27. 160 x=e:ct=ct+1:gosub700:goto 560
  28. 200 xx=bs:if ct<>0 then t=e:gosub1600:e=t:gosub700:goto560
  29. 210 t=ac:gosub1600:ac=t:gosub700:goto560
  30. 500 if op$="+"then ac=ac+e
  31. 510 if op$="-"then ac=ac-e
  32. 520 if op$="*"then ac=ac*e
  33. 530 if op$="/"then ac=ac/e
  34. 540 if op$=" "then ac=e
  35. 544 if op$="[185]"then gosub950:ac=ac or e
  36. 545 if op$="[176]"then gosub950:ac=ac and e
  37. 546 if pf$<>"y" then goto 550
  38. 547 st$=str$(e):gosub1500:print#4,op$ left$(sp$,i);st$
  39. 548 if t$="=" then st$=str$(ac):gosub1500:print#4,"=" left$(sp$,i);st$
  40. 550 op$=t$
  41. 555 pt$="":xx=bs:x=ac:gosub700:ct=0:
  42. 560 print "";left$(sp$,15-len(st$));st$;"[146]"
  43. 561 r=0:c=22:gosub800:print"visi-calculator":ifv=0 then 20
  44. 562 r=1:c=19:gosub800:print"[144]   ac=" "               [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]";ac
  45. 563 r=2:c=19:gosub800:print"   e =" "               [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]";e
  46. 564 r=3:c=19:gosub800:print"   m =" "               [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]";m
  47. 565 ifop$="[176]"thenop$="and"
  48. 566 ifop$="[185]"thenop$="or "
  49. 567 ifop$="="thenop$="=  "
  50. 570 r=4:c=19:gosub800:print"   op= "op$
  51. 572 goto20
  52. 600 t$="":get t$:if t$="" then 600
  53. 610 if t$="r" then ac = m:op$=" ":ct=0:x=ac:gosub700:goto560
  54. 620 if t$="+" then m=m+d:goto 560
  55. 630 if t$="-" then m=m-d:goto 560
  56. 640 if t$="*" then m=m*d:goto 560
  57. 650 if t$="/" then m=m/d:goto 560
  58. 660 if t$="c" then m = 0:goto 560
  59. 670 gosub 10000:goto20
  60. 700 rem change number (dec,hex,etc)to char
  61. 705 d=x:if bs=10thenst$=str$(x):return
  62. 710 st$=""
  63. 716 if x <0 then x=65536+x
  64. 720 for i=1to100
  65. 730 t1=(x/bs - int(x/bs))*bs+1
  66. 740 st$=mid$(h$,t1,1)+st$
  67. 750 x=int(x/bs)
  68. 760 if x=0 then return
  69. 770 next
  70. 800 poke 781,r:poke782,c:poke783,peek(783)and254:sys65520:return
  71. 850 if v=0 then v=1:goto 20
  72. 860 v=0:goto 10
  73. 900 open15,4,15:close15:ifst<>.then20
  74. 905 if pf$="y"then print"[144]  [209]":pf$="":close4:goto20
  75. 910 ifpf$<>"y"thenprint"[144][209]  "
  76. 915 pf$="y":open4,4:print#4,"printer on"
  77. 920 goto 20
  78. 950 ifac>lporac<lm then gosub10000:goto20
  79. 960 ife>lpore<lmthen gosub10000:goto20
  80. 970 return
  81. 1000 poke53280,2:poke 53281,1
  82. 1010 print "[144][213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
  83. 1020 print "[221] prtr on  [209]off   [221]"
  84. 1025 print "[221]                 [221]"
  85. 1030 print "[221][213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201][221]"
  86. 1040 print "[221][221]               [221][221]"
  87. 1050 print "[221][202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203][221]"
  88. 1060 print "[221][213][192][192][192][201][213][192][201][213][192][201][213][192][201][213][192][201][221]"
  89. 1070 print "[221][221][159]a[144]nd[221][221][154]1[144][221][221][154]2[144][221][221][154]3[144][221][221][150]d[144][221][221]"
  90. 1080 print "[221][202][192][192][192][203][202][192][203][202][192][203][202][192][203][202][192][203][221]"
  91. 1090 print "[221][213][192][192][192][201][213][192][201][213][192][201][213][192][201][213][192][201][221]"
  92. 1100 print "[221][221][159]o[144]r [221][221][154]4[144][221][221][154]5[144][221][221][154]6[144][221][221][150]o[144][221][221]"
  93. 1110 print "[221][202][192][192][192][203][202][192][203][202][192][203][202][192][203][202][192][203][221]"
  94. 1120 print "[221][213][192][192][192][201][213][192][201][213][192][201][213][192][201][213][192][201][221]"
  95. 1130 print "[221][221][159]n[144]ot[221][221][154]7[144][221][221][154]8[144][221][221][154]9[144][221][221][150]h[144][221][221]"
  96. 1140 print "[221][202][192][192][192][203][202][192][203][202][192][203][202][192][203][202][192][203][221]"
  97. 1150 print "[221][213][192][192][192][201][213][192][201][213][192][201][213][192][201][213][192][201][221]"
  98. 1160 print "[221][221] [159]e[144] [221][221][154].[144][221][221][154]0[144][221][221][154]=[144][221][221][150]c[144][221][221]"
  99. 1170 print "[221][202][192][192][192][203][202][192][203][202][192][203][202][192][203][202][192][203][221]"
  100. 1180 print "[221][213][192][192][192][201][213][192][201][213][192][201][213][192][201][213][192][201][221]"
  101. 1190 print "[221][221][154]m[144]em[221][221][154]+[144][221][221][154]-[144][221][221][154]*[144][221][221][154]/[144][221][221]"
  102. 1200 print "[221][202][192][192][192][203][202][192][203][202][192][203][202][192][203][202][192][203][221]"
  103. 1210 print "[221][213][192][192][192][201]      [213][192][192][192][192][201][221]"
  104. 1220 print "[221][221][154]r[144]ec[221]      [221][154]q[144]uit[221][221]"
  105. 1230 print "[221][202][192][192][192][203]      [202][192][192][192][192][203][221][159] use cmdr with cyan [157][148][157][157] "
  106. 1235 print "[144][202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203][150]use ctrl with lt re [157][148][157][157]d[144][146][145]"
  107. 1240 print ""tab(15)"(d)"
  108. 1250 gosub2000:return
  109. 1300 sp$="                    ":op$=" ":print "";:xx=10:bs=10:bs$="9"
  110. 1310 lp=32767:lm=-32768:h$="0123456789abcdef":goto555
  111. 1500 fori=1tolen(st$):if mid$(st$,i,1)="." then i=15-i:return
  112. 1510 next
  113. 1520 i=15-i:return
  114. 1600 t=int(t)
  115. 1610 x=t:return
  116. 2000 r=5:c=19:gosub800
  117. 2010 print"[159]<cmdr> a,o,n:[146] used"
  118. 2020 r=6:gosub800:print"to enter logical"
  119. 2030 r=7:gosub800:print"operator (and, or, &"
  120. 2040 r=8:gosub800:print"not)."
  121. 2050 r=9:gosub800:print"[150]<ctrl> d,h,o:[146] used"
  122. 2060 r=10:gosub800:print"to change decimal,"
  123. 2070 r=11:gosub800:print"hex, & octal modes."
  124. 2080 r=12:gosub800:print" p:[146] toggles printer"
  125. 2090 r=13:gosub800:print"on and off."
  126. 2100 r=14:gosub800:print" v:[146] toggles the"
  127. 2110 r=15:gosub800:print"visual display."
  128. 2120 r=16:gosub800:print" m:[146] is used as"
  129. 2130 r=17:gosub800:print"a memory for the"
  130. 2140 r=18:gosub800:print"calculator. use one"
  131. 2145 r=19:gosub800:print"of the following"
  132. 2150 r=20:gosub800:print"after pressing   [154] m [146]:"
  133. 2160 r=21:gosub800:print"[154]    +  -  *  / r "
  134. 2170 r=22:gosub800:print"f1 = additional help"
  135. 2999 return
  136. 3000 print"[147] [154]are you sure you want to quit?   [[159]y[154]/[159]n[154]]"
  137. 3010 geta$:ifa$<>"y"anda$<>"n"then3010
  138. 3020 ifa$="n"then10
  139. 3030 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
  140. 3040 print"[147]";:ifer<>63thenend
  141. 3050 load"hello connect",8
  142. 10000 rem beep
  143. 10010 s=54272:pokes+4,.:pokes+24,15
  144. 10020 pokes+5,10:pokes+6,0:pokes,34:pokes+1,50:pokes+4,33
  145. 10040 return
  146. 20000 print "[147]" tab(14) "instructions" chr$(13)
  147. 20010 print"your visi-calculator can be used just"
  148. 20020 print"like a hand calculator. it calculates"
  149. 20030 print"in decimal, hexidecimal and octal. it"
  150. 20040 print"can also print as it calculates (if you"
  151. 20050 print"have a printer)." chr$(13)
  152. 20060 print"the current mode and printer switch is"
  153. 20070 print"displayed" chr$(13)
  154. 20075 print"following are the keys used by visi-    calculator:"
  155. 20080 print"[144]key" tab(12) "use[146]" chr$(13)
  156. 20090 print"[144]0-9,a-f     - used to enter decimal"
  157. 20095 print"              octal or hex