See all articles from Syntax/Syntax ZX80 v2 n2
With 8 bit words, the ZX80 can handle numbers up to only 5 digits. This program enables you to add 7 digit numbers, so long as their total doesn’t exceed 7 digits. After hitting RUN (NL), respond with a number up to 7 digits. Hit (NL) and that number appears on the screen. Enter another number (NL). The running total appears. Zeros show only as spaces. To see zeros, change line 260 to PRINT “0”;, but then you will get 7 digit numbers with zeros as place holders. To change the number of usable digits, change lines 5, 7, 200, and 210.
5 DIM X(7)
7 DIM Y(7)
10 INPUT A$
20 FOR N=1 TO 7
30 LET X(N)=CODE(A$)-28
35 IF X(N)<0 THEN GO TO 70
37 IF X(N)>9 THEN STOP
50 LET A$=TL$(A$)
60 NEXT N
70 LET M=N-1
80 FOR I=1 TO N-1
90 LET Y(I)=Y(I)+X(M)
97 IF Y(I)>9 THEN GO TO 130
100 LET M=M-1
110 NEXT I
120 GO TO 200
130 LET Y(I)=Y(I)-10
140 LET Y(I+1)=Y(I)+1
150 GO TO 95
200 LET M=7
202 LET FL=0
210 FOR I=1 TO 7
212 IF FL>0 THEN GO TO 220
214 IF Y(M)=0 THEN GO TO 260
215 LET FL=0
220 PRINT Y(M);
230 LET M=M-1
240 NEXT I
245 PRINT
250 GO TO 10
260 PRINT " ";
270 GO TO 230
Syntactic Sum= 28812
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.