The new ROM for the ZX80 may be available before these words are in print. It remedies a lot of the defects of the original ROM. It gives floating point facilities, trigonometric functions, keyboard access to reversed characters and many other useful functions.
For those who still have the old ROM, there is no way of dealing with pounds and pence, or dollars and cents, is there?
As a matter of fact, the answers are ‘yes’.
There are ways of getting round the problems. A useful educational program, for example, is to teach kids to add up dollars and cents, or what have you. That can be done in a relatively simple manner, as Program 1 demonstrates. This is a program that goes on indefinitely setting new sums.
This program is self-explanatory; It asks you to add four randomly produced amounts from 1.01 to 99.99.
It asks you to print the answer using Newline instead of the decimal point.
Subroutines line up the decimal point, produce the 0 after the decimal point where required and add the whole numbers and the decimals separately. Your answer and the correct answer are printed and you are told whether you are right or wrong.
You are then invited to press Newline for another sum or S for you score.
The program produces new sums indefinitely.
1 LET J = 0
2 LET K = 0
5 PRINT "ADD"
10 LET T = 0
20 LET T2 = 0
25 FOR N = 1 TO 4
30 LET A = RND(99)
40 LET A2 = RND(99)
50 LET X = A
60 LET Y = A2
70 LET T = T + A
80 LET T2 = T2 + A2
90 GOSUB 2000
100 NEXT N
310 LET X = T
311 LET Y = T2
315 PRINT
320 PRINT
321 PRINT "PRINT YOUR ANSWER"
322 PRINT
323 PRINT "PRESS NEWLINE INSTEAD OF"
324 PRINT
325 PRINT "THE DECIMAL POINT"
330 GOSUB 3000
2000 IF Y < 100 THEN GOTO 2035
2010 LET Y = Y - 100
2020 LET X = X + 1
2030 GOTO 2000
2033 PRINT
2034 PRINT
2035 IF X < 10 AND Y < 10 THEN PRINT , , " ";X;" . 0" ; Y
2040 IF X < 10 AND NOT Y < 10 THEN PRINT , , " ";X;"."; Y
2050 IF NOT X < 10 AND NOT Y < 10 THEN PRINT , , X;"."; Y
2060 IF NOT X < 10 AND Y < 10 THEN PRINT , , X;".0"; Y
2070 RETURN
3000 INPUT A
3005 PRINT , , "-----"
3010 PRINT , , A;".";
3020 INPUT B
3025 IF B < 10 THEN PRINT "0";B
3026 IF NOT B < 10 THEN PRINT B
3031 PRINT
3032 PRINT
3035 PRINT "THE ANSWER IS ";
3040 GOSUB 2000
3070 PRINT
3090 IF A = X AND B = Y THEN GOTO 4000
3100 PRINT "YOU WERE WRONG"
3110 LET K = K + 1
3130 GOTO 4040
4000 PRINT "THAT IS RIGHT"
4010 LET J = J + 1
4040 PRINT
4050 PRINT "PRESS NEWLINE FOR ANOTHER SUM"
4055 PRINT
4056 PRINT "OR S FOR YOUR SCORE"
4060 INPUT Z$
4065 CLS
4070 IF Z$ = "" THEN GOTO 5
4080 IF Z$ = "S" THEN PRINT "YOU GOT ";J;
" RIGHT AND "; K;" WRONG"
Multiplication tables
I haven’t yet got round to making the ZX80 multiply and divide decimals but Program 2 is a simple ‘multiplication table’ teacher. It is a ‘talkative’ program offering three grades of difficulty, setting ten questions, giving the score and inviting further participation.
10 PRINT "WHAT IS YOUR NAME?"
20 INPUT A$
30 CLS
40 LET X = 0
50 PRINT "DO YOU WANT EASY, A LITTLE HARDER, OR DIFFICULT QUESTIONS?"
60 PRINT
70 PRINT "TYPE E FOR EASY; H OR D
80 PRINT
90 INPUT B$
100 CLS
110 PRINT "OK, ";A$
120 PRINT
130 PRINT "HERE ARE 10 QUESTIONS"
140 FOR Z = 1 TO 10
150 LET A = RND(10)
160 LET B = RND(10)
170 IF A < 3 OR B < 3 THEN GOTO 150
180 IF B$ = "D" THEN LET A = A*2
190 IF B$ = "D" OF B$ = "H" THEN LET B = B*2
200 PRINT
210 PRINT
220 PRINT "WHAT IS ";A;" TIMES ";B
230 INPUT T
240 IF T = A*B THEN GOTO 260
250 GOTO 320
260 CLS
270 PRINT "RIGHT"
280 PRINT
290 LET X = X + 1
300 NEXT Z
310 GOTO 360
320 CLS
330 PRINT "WRONG, ";A$
335 PRINT ". ";A;" TIMES ";B;" IS ";A*B
340 PRINT
350 NEXT Z
360 PRINT "THAT IS ALL, ";A$
370 PRINT
380 PRINT
390 PRINT "YOU SCORED ";X;" OUT OF 10"
400 PRINT
410 PRINT
420 PRINT "DO YOU WANT ANOTHER 10?"
430 PRINT
440 PRINT
450 PRINT "TYPE Y FOR YES : N FOR NO"
460 INPUT D$
470 IF D$ = "Y" THEN GO TO 30
480 CLS
490 PRINT "THANK YOU, ";A$
500 PRINT
510 PRINT
520 PRINT "GOODBYE FOR NOW"
530 PRINT
540 PRINT
550 PRINT
560 PRINT , "BUT PLEASE COME BACK"

Basic Accounting With Decimal Currencies
Program 3 is very complicated. It keeps accounts, in a way. It prints out the account name or number, adds and subtracts cash amounts, splits them into categories or groups, gives one grand total and six sub-totals. Of course, it is rather limited by the availability of display space. The ‘Continue’ facility can be used but it really needs a printer.
This program allows the entry of account number, name, etc., plus a column of pounds and pence, or dollars and cents, and a category column.
The amounts can then be totalled in one grand total and six subtotals by category number.
Data entry is in the form:
1 Account number, name, etc. (any string)—newline
2 Pounds/dollars—newline—pence/cents—newline
3 Category of account (any number, normally 1 to 6)—newline
Note that the decimal point is not used but that .50 must be entered as 50 and not 5 as in calculator usage. The entry of a single figure after the decimal point is treated as one-hundredth part, i.e. 5 is treated as 05.
Debits (minus figures) are entered in the normal way e.g. -2566 newline 09. There is no need to put the minus sign before the decimal entry.
After the entry of the category number, the details in 1,2 and 3 are printed. Repeat for as many entries as required.
When all entries have been made, enter:
T newline to obtain main total only OR
TC newline to obtain main total and subtotals
If further entries or corrections are necessary, enter
C newline
and repeat 1,2,3,T or TC. The amounts entered are added to the previous totals.
The program uses several subroutines for tabulation, to persaude the ZX80 to add and subtract decimals and to ensure that the results are printed correctly.
1 LET J = 0
2 LET J2 = 0
3 LET H = 0
4 LET H2 = 0
5 LET G = 0
6 LET G2 = 0
7 LET K = 0
8 LET K2 = 0
9 LET L = 0
10 LET L2 = 0
11 LET M = 0
12 LET M2 = 0
15 LET Z = 0
16 LET Z2 = 0
45 PRINT "ACCOUNT £P CATEGORY"
47 GOSUB 600
50 INPUT A$
60 IF A$S = "T" OR A$ = "TC" THEN GOTO 270
70 INPUT B
80 INPUT B2
85 IF B < 0 THEN LET B2 = -B2
90 INPUT C
110 PRINT A$;
120 LET I = 15
130 LET X = B
140 LET Y = B2
150 GOSUB 2000
155 GOSUB 1000
157 GOSUB 2050
160 LET Z = Z + B
170 LET Z2 = Z2 + B2
195 LET I = 25
200 PRINT C
210 GOSUB 5000
250 GOTO 50
270 GOSUB 600
290 PRINT "TOTAL";
300 LET I = 15
310 LET X = Z
320 LET Y = Z2
325 GOSUB 9000
330 GOSUB 2000
335 GOSUB 1000
339 GOSUB 2050
340 IF A$ = "TC" THEN GOTO 345
342 GOTO 500
345 PRINT
346 PRINT "CATEGORY TOTALS"
368 PRINT "...1",
369 LET X = H
370 LET Y = H2
375 GOSUB 8000
379 PRINT "...2",
380 LET X = J
381 LET Y = J2
385 GOSUB 8000
387 PRINT "...3",
388 LET X = K
389 LET Y = K2
390 GOSUB 8000
395 PRINT "...4",
400 LET X = L
404 LET Y = L2
405 GOSUB 8000
425 PRINT "...5",
430 LET X = M
440 LET Y = M2
450 GOSUB 8000
460 PRINT "...6",
465 GOSUB GOSUB 600
500 INPUT B$
505 PRINT
510 IF B$ = "C" THEN GOTO 50
520 STOP
600 FOR N = 1 TO 32
610 PRINT "-";
620 NEXT N
630 RETURN
1000 GOSUB 1040
1010 GOSUB 1050
1020 RETURN
1040 PRINT " " ;
1050 IF I + PEEK(16420) = 33 THEN RETURN
1060 IF I = 0 THEN IF PEEK(16420) < 2 THEN RETURN
1070 GOTO 1040
2000 IF Y < 100 THEN GOTO 2040
2010 LET Y = Y - 100
2020 LET X = X + 1
2030 GOTO 2000
2040 RETURN
2050 IF Y < 10 AND NOT Y < 0 THEN PRINT X;".0";Y;
2055 IF Y < -9 THEN PRINT X;".";Y*-1
2060 IF Y > -10 AND Y < 0 THEN PRINT X ;".0";Y*-1
2065 IF NOT Y < 10 THEN PRINT X;".";Y;
2070 RETURN
5000 IF C = 1 THEN LET G = G + B
5010 IF C = 1 THEN LET G2 = G2 + B2
5020 IF C = 2 THEN LET H = H + B
5030 IF C = 2 THEN LET H2 = H2 + B2
5035 IF C = 3 THEN LET J = J + B
5040 IF C = 3 THEN LET J2 = J2 + B2
5045 IF C = 4 THEN LET K = K + B
5050 IF C = 4 THEN LET K2 = K2 + B2
5055 IF C = 5 THEN LET L = L + B
5060 IF C = 5 THEN LET L2 = L2 + B2
5065 IF C = 6 THEN LET M = M + B
5070 IF C = 6 THEN LET M2 = M2 + B2
5080 RETURN
6000 IF Y > -100 THEN GOTO 6040
6010 LET Y = Y + 100
6020 LET X = X - 1
6030 GOTO 6000
6040 RETURN
6500 LET Y = Y + 100
6510 LET X = X - 1
6520 GOTO 9010
7000 LET X = X + 1
7010 LET Y = Y - 100
7020 GOTO 9020
8000 GOSUB 9000
8100 GOSUB 2000
8020 GOSUB 2050
8030 RETURN
9000 IF Y < 0 AND X < 0 THEN GOSUB 6000
9010 IF X > 0 AND Y < 0 THEN GOTO 6500
9020 IF X < 0 AND Y > 0 THEN GOTO 7000
9030 RETURN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.