home *** CD-ROM | disk | FTP | other *** search
/ UpTime Volume 1 #4 / utv1n4s1.d64 / calculator (.txt) < prev    next >
Commodore BASIC  |  2022-08-28  |  5KB  |  147 lines

  1. 5 printchr$(8)+chr$(142)
  2. 10 op$="+-*/^s=:_cax[133][134][135][136]":np=12:c$="[154]":d$=""
  3. 20 poke53280,3:poke53281,1:gosub8000:gosub9000
  4. 40 c=0:forx=49152to49262:readn:pokex,n:next
  5. 50 c=0:forx=50000to50090:readn:pokex,n:next
  6. 60 poke50012,asc(c$):poke50060,asc(c$):poke50044,asc(d$):sys49152:goto999
  7. 200 poke783,0:poke781,r:poke782,c:sys65520:return
  8. 999 for p=1to4:f$(p)="0":gosub4900:next
  9. 1000 s$="0":j=0:xt=0:op=-1:xp=0:v1=0
  10. 1020 fd=1
  11. 1030 gosub4000
  12. 1040 poke781,j:poke782,np:sys50000:ifx$<>"c"andx$<>"a"then1100
  13. 1090 if pxthenprint#3:print#3,"[160]***************":print#3:print#3:print#3
  14. 1092 if x$="a" then 999
  15. 1095 goto 1000
  16. 1100 ifx$=":"thens$=str$(-1*val(s$)):goto1030
  17. 1105 ifx$="s"thenxt=1:op=0:goto1020
  18. 1120 if(op>0andop<6)and(xt>0)thenxx=op:xt=2:op=0:goto1020
  19. 1140 ifx$="_"thenx$="":op=0:goto1030
  20. 1160 ifx$<"[133]"orx$>"[136]"then1220
  21. 1180 p=asc(x$)-132:if xt=1 then f$(p)=s$:gosub4900:xt=0:op=-1:goto1260
  22. 1200 if xt<>2 then 1220
  23. 1210 a=val(f$(p)):poke251,0:b=val(s$):ifpeek(251)then2000
  24. 1212 x=xx:gosub3000:f$(p)=str$(a):xt=0:gosub4900
  25. 1215 op=-1:goto1260
  26. 1220 ifx$="x"thenclose3:r=22:c=0:gosub200:sys (8*4096)+4
  27. 1240 xt=0:iffdthen1290
  28. 1260 if xp then 1270
  29. 1265 poke251,0:v1=val(s$):ifpeek(251)then2000
  30. 1266 if(op>0andop<6)thenfd=1:xp=op:ifpxthenpl=0:pe=0:gosub6000
  31. 1267 goto1030
  32. 1270 a=v1:x=xp:poke251,0:b=val(s$):ifpeek(251)then2000
  33. 1275 gosub3000:v1=a:ifpx=0then1285
  34. 1280 po=1:pl=0:pe=0:gosub6000:pl=1:pe=0:po=0:if op=7 then pl=0:pe=1
  35. 1285 s$=str$(a):xp=0:if px then gosub 6000
  36. 1290 if(op>0andop<6)thenxp=op:goto1020
  37. 1300 op=0:goto1020
  38. 2000 s$="overflow!":goto2020
  39. 2010 s$="division by 0!"
  40. 2020 xt=0:op=-1:xp=0:v1=0:goto1020
  41. 3000 onxgoto3020,3030,3040,3050,3060
  42. 3020 a=a+b:return
  43. 3030 a=a-b:return
  44. 3040 a=a*b:return
  45. 3050 a=a/b:return
  46. 3060 if (a>1.98) and (b>126) then 2000
  47. 3065 a=a^b:return
  48. 4000 df=0:ef=0:l=len(s$):nf=0:goto4365
  49. 4020 getx$:ifx$=""then4020
  50. 4040 if((x$>="0"andx$<="9")or(x$="."anddf=0))andl<14then4320
  51. 4060 ifx$="-"andfdandop<>0thengoto4320
  52. 4080 if x$="-"and ef and nf=0 then nf=1:goto4320
  53. 4100 if x$="e" and fd=0 and ef=0 and s$<>"-" then ef=1:df=1:goto 4340
  54. 4120 x=asc(x$):ifx>132andx<137andxt=0thens$=f$(x-132):goto4370
  55. 4140 if x$="p"thengosub9500:goto4020
  56. 4160 ifx$<>chr$(20)then4260
  57. 4170 if mid$(s$,len(s$))="."thendf=0
  58. 4180 x$=mid$(s$,1,1):ifl=1or(l=2and(x$="-"orx$="."))thens$="0":l=1:df=0:goto4360
  59. 4200 if nf and mid$(s$,l,1)="-"thennf=0
  60. 4220 if ef and mid$(s$,l,1)="e"thenef=0
  61. 4240 l=l-1:s$=left$(s$,l):goto4360
  62. 4260 f=0:forj=1tolen(op$):ifx$<>mid$(op$,j,1)then4280
  63. 4265 if op>0 and j<6 and fd then 4020
  64. 4270 op=j:return
  65. 4280 next:goto4020
  66. 4320 df=(x$=".")ordf:ifs$="0"orfdthens$=x$:l=len(s$):fd=0:goto4360
  67. 4340 s$=s$+x$:l=len(s$):fd=0
  68. 4360 if xp=0 then poke781,0:poke782,12:sys50000
  69. 4365 p=0:gosub4900:goto4020
  70. 4370 ef=0:nf=0:df=0:fork=1tolen(s$):x$=mid$(s$,k,1):ifx$="-"thendf=1:goto4400
  71. 4380 if x$="e"thenef=1:df=1:goto4400
  72. 4390 if x$="."thendf=1:goto4400
  73. 4400 next:l=len(s$):fd=0:goto4365
  74. 4900 t$=s$:ifpthent$=f$(p)
  75. 4905 r=rx(p):c=cx(p):gosub200:printd$mid$("               ",1,15-len(t$))t$;
  76. 4910 return
  77. 6000 t$=s$:if po then t$=mid$(op$,xp,1)+" "+t$
  78. 6010 if pl then print#3," ---------------"
  79. 6020 if pe then print#3," ==============="
  80. 6030 print#3,mid$("                ",1,16-len(t$))t$:return
  81. 8000 gosub 20000
  82. 8005 get a$:if a$<>"y" and a$<>"n" and a$<>"[140]" then 8005
  83. 8007 if a$="[140]" then sys (8*4096)+4
  84. 8008 if a$="n" then return
  85. 8010 print"[147]"tab(13)" instructions "
  86. 8020 print"use this program like a regular calc-"
  87. 8030 print"ulator.  numbers can be in scientific"
  88. 8040 print"notation, if desired."
  89. 8042 print"make corrections using the del[146] key."
  90. 8050 print"press s[146] and then a function key to
  91. 8060 [153]"store a value into one of the four
  92. 8070 print"memories.  press a function key to
  93. 8080 [153]"retrieve the value from a memory.
  94. 8090 print"press s[146], then +[146], then a function key to
  95. 8100 [153]"add the value in the main window to a
  96. 8110 print"memory.  (this works for the other
  97. 8115 [153]"the other operators as well.)"
  98. 8130 [153]"press _wait to clear the current operator."
  99. 8140 [153]"use cwait to clear the current calculation."
  100. 8150 [153]"use await to reset calculator and memories."
  101. 8160 [153]"press xwait to exit the program."
  102. 8170 [153][163]6)"totototototototototototototototototototototototototototo"
  103. 8900 [153]"       press spacebar to continue "
  104. 8910 a$[178]"":[161]a$:[139]a$[179][177]" "[167]8910
  105. 8999 [142]
  106. 9000 [153]c$"load":p$[178]"(NULL)tantantantantantantantantantantantantantantantanright$cmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmd(NULL)                (NULL)"
  107. 9010 [153][163]13)" 64 calculator wait"
  108. 9030 p$[178]p$[170]"cmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdmid$tantantantantantantantantantantantantantantantan(NULL)"
  109. 9040 [129]j[178]1[164]5:[135]r,c,x$:[141]200:[153]p$;:r[178]r[171]1:c[178]c[170]8:[141]200:[153]x$;
  110. 9050 [130]:p2$[178]"(NULL)tanright$cmdcmdcmd(NULL) (NULL)cmdcmdcmdmid$tan(NULL)"
  111. 9060 c[178]2:[129]j[178]1[164]np:r[178]17:x$[178][202](op$,j,1):[141]200:[153]p2$;:r[178]r[170]1:c[178]c[170]1
  112. 9070 [141]200:[153]x$;:c[178]c[170]2:[130]:[129]j[178]0[164]4:[135] rx(j),cx(j):[130]
  113. 9090 r[178]21:c[178]14:[141]200:[153]"printer: ":px[178][171]1:[141]9500
  114. 9100 s$[178]"initializing...":p[178]0:[141]4900:[142]
  115. 9500 px[178][168] px:r[178]21:c[178]23:[141]200:[153]c$""[202]("offon",[171]3[172]px[170]1,3[170]px)"wait "
  116. 9510 [139]px[167][159]3,4:[152]3:[152]3:[152]3:[142]
  117. 9520 [160]3:[142]
  118. 10000 [131] 4,1,f1,8,1,f5,4,22,f3,8,22,f7,13,11,"",14,13,5,3,5,24,9,3,9,24
  119. 20000 [153]"contload"[163]11)"tototototototototototototototototo"
  120. 20010 [153][163]11)" uptime presents wait"
  121. 20020 [153][163]9)"f1"[163]30)"f3"
  122. 20030 [153]" (NULL)tantantantantantantantantantantantantantantantanright$   (NULL)tantantantantantantantantantantantantantantantanright$";
  123. 20040 [153]" (NULL)               0cont(NULL)   (NULL)               0cont(NULL)";
  124. 20045 [153]" mid$tantantantantantantantantantantantantantantantan(NULL)   mid$tantantantantantantantantantantantantantantantan(NULL)"
  125. 20050 [153][163]9)"f5"[163]30)"f7"
  126. 20060 [153]" (NULL)tantantantantantantantantantantantantantantantanright$   (NULL)tantantantantantantantantantantantantantantantanright$";
  127. 20070 [153]" (NULL)               0cont(NULL)   (NULL)               0cont(NULL)";
  128. 20080 [153]" mid$tantantantantantantantantantantantantantantantan(NULL)   mid$tantantantantantantantantantantantantantantantan(NULL)";
  129. 20090 [153]""[163]11)"(NULL)tantantantantantantantantantantantantantantantanright$"
  130. 20100 [153][163]11)"(NULL) 64 calculatorcont  (NULL)"
  131. 20110 [153][163]11)"mid$tantantantantantantantantantantantantantantantan(NULL)"
  132. 20120 [153]"       (c) 1987 by mike broussard
  133. 20130 print" published by softdisk publishing, inc."
  134. 20140 print"    do you want instructions? (y/n)"
  135. 20999 return
  136. 31000 data 173,0,3,141,52,192,173,1,3,141,53,192,169,23,141,0,3,169,192,141,1
  137. 31010 data 3,96,169,0,133,251,224,0,208,1,96,160,0,185,104,192,208,15,173,52
  138. 31020 data 192,141,0,3,173,53,192,141,1,3,76,0,0,133,2,228,2,240,5,200,200,200
  139. 31030 data 208,225,200,134,251,185,104,192,133,20,200,185,104,192,133,21,165
  140. 31040 data 43,166,44,32,23,166,176,3,76,227,168,165,95,233,1,133,122,165,96
  141. 31050 data 233,0,133,123,96,15,208,7,20,218,7,0
  142. 40000 data 202,134,2,169,3,141,156,195,140,157,195,169,151,32,210,255,162,0
  143. 40010 data 138,72,162,18,172,156,195,24,32,240,255,173,156,195,105,3,141,156
  144. 40020 data 195,104,170,228,2,208,10,169,31,32,210,255,169,18,32,210,255,189
  145. 40030 data 158,195,32,210,255,169,151,32,210,255,169,146,32,210,255,232,236
  146. 40040 data 157,195,208,199,96,39,12,43,45,42,47,94,83,61,58,95,67,65,88,0
  147.