This program will turn your Timex 2068 into a printing calculator. It should work on the Timex 1000 if line 100 is changed. The printer can be disabled by entering anything but y at the beginning of the program. The number input accepts positive numbers with any number of digits after the decimal point. Negative numbers and numbers in scientific notation with exponential powers of ten are not accepted. Succesive operations are acceptable and may be mixed but the last operator acts on the result of all preceeding calculations, i.e., no hierarchy of multiplication over addition exists. The code accepts +,-,*,/ operations as well as the decimal point without having to hold down the extended mode key. The c key will delete the last digit entered to correct errors. The c key will not work on operators. Illu strations of the printing mode are shown below.
60 REM ***********************
62 REM * Calculator Program *
64 REM ************************
65 REM
66 PRINT TAB 7;"Calculator Program": PRINT : PRINT
70 LET op=5
72 LET ln=0
80 PRINT "if you want listing enter y"
81 PAUSE 0
82 LET p=0
83 IF INKEY$<>"y" THEN GO TO 87
84 LPRINT
85 LPRINT
86 LET p=1
87 CLS
88 LET l=0
90 LET firstd=1
91 LET x=0
92 LET dp=0
93 LET dt=0
100 PAUSE 0
110 LET n$=INKEY$
120 LET c=CODE n$
130 IF c>=48 AND c<=57 THEN LET l=l+1: GO TO 200
140 IF c=77 OR c=46 OR c=109 THEN LET dp=1: PRINT ".";: LET l=l+1
150 IF c=75 OR c=43 OR c=107 THEN PRINT " + ";: LET l=l+3: GO TO 300
160 IF c=74 OR c=45 OR c=106 THEN PRINT " - ";: LET l=l+3: GO TO 400
170 IF c=66 OR c=42 OR c=98 THEN PRINT " * ";: LET l=l+3: GO TO 500
180 IF c=86 OR c=47 OR c=118 THEN PRINT "/ ";: LET l=l+3: GO TO 600
182 IF c=76 OR c=61 OR c=108 THEN PRINT " = ";: LET ln=ln+1: GO TO 700
184 IF c=67 OR c=99 THEN GO TO 900
199 GO TO 100
200 PRINT n$;
202 IF dp THEN GO TO 250
210 LET dt=VAL n$+dt*10
220 GO TO 100
250 LET dt=dt+VAL n$/10↑(x+1)
260 LET x=x+1
270 GO TO 100
300 GO SUB 1000
320 LET op=1
330 GO TO 91
400 GO SUB 1000
410 LET op=2
420 GO TO 91
500 GO SUB 1000
510 LET op=3
520 GO TO 91
600 GO SUB 1000
610 LET op=4
620 GO TO 91
700 GO SUB 2000
704 PRINT d1
706 IF p=0 THEN GO TO 88
708 LPRINT TAB 20;"= ";d1
709 LPRINT
710 LPRINT
714 GO TO 88
900 IF dp THEN GO TO 940
902 LET dt=dt/10
904 LET dt=INT dt
906 GO TO 960
940 LET dt=dt*10↑(x-1)
942 LET dt=INT dt
944 LET x=x-1
946 LET dt=dt/10↑x
960 PRINT AT ln,(l-1);" ";
962 PRINT AT ln,(l-1);
970 LET l=l-1
980 GO TO 100
1000 IF NOT firstd THEN GO TO 1040
1004 LET d1=dt
1005 IF p=0 THEN GO TO 1010
1006 LPRINT TAB 22;dt
1010 LET firstd=0
1030 RETURN
1040 GO SUB 2000
1050 RETURN
2000 GO TO 2000+10*op
2010 LET d1=dt+d1
2011 IF p=0 THEN RETURN
2012 LPRINT TAB 20;"+ ";dt
2014 RETURN
2020 LET d1=d1-dt
2021 IF p=0 THEN RETURN
2022 LPRINT TAB 20;"- ";dt
2023 RETURN
2030 LET d1=d1*dt
2031 IF p=0 THEN RETURN
2032 LPRINT TAB 20;"* ";dt
2033 RETURN
2040 LET d1=d1/dt
2041 IF p=0 THEN RETURN
2042 LPRINT TAB 20;"/ ";dt
2043 RETURN
2050 PRINT "incomplete expression"
2052 PAUSE 60
2054 CLS
2056 GO TO 60
9000 SAVE "cp" LINE 60
by Roald Schrack
12.89 + 679.64 + 19.56 + 34.08 = 746.17 12.8906 * 45.8 = 590.38948
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.