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