ZX80 Table

Developer(s): R. Bharath
Date: 1981
Type: Program
Platform(s): ZX80
Tags: Utility

Answer the prompts for the largest number of digits, the number of rows and the number of columns, then enter the numbers one at a time. The program prints them as a table with every column right-aligned. The column limit it prints is 32 divided by the digit count, minus one, but line 220 accepts one more column than that.

The heading says 4K ROM, 16K RAM, but in testing it ran in a 1K ZX80.

Published in Syntax September 1981 (ZX80 Table).

Related Articles

Constructs number tables with columns lined up.

Image Gallery

Source Code

  30 PRINT "PROGRAM ARRANGES"
  40 PRINT "LIST OF INPUT NUMBERS AS TABLE"
  50 PRINT "USER CHOOSES NUMBER OF ROWS, COLS"
  60 PRINT
  70 PRINT "WHAT IS LARGEST NUMBER"
  80 PRINT "OF DIGITS IN ANY NUMBER"
  90 PRINT "IN YOUR LIST?"
 100 INPUT L
 110 CLS
 120 LET F=L+1
 130 PRINT "IN THAT CASE THE LIMIT IS"
 150 PRINT (32/F)-1,"COLUMNS"
 160 PRINT "HOW MANY ROWS?"
 170 INPUT R
 180 CLS
 190 PRINT "HOW MANY COLUMNS?"
 200 INPUT C
 210 CLS
 220 IF NOT C>(32/F) THEN GO TO 250
 230 PRINT "TOO MANY COLS. TRY AGAIN."
 240 GO TO 70
 250 LET T=R*C
 260 DIM A(T)
 270 PRINT R,"ROWS",C,"COLS"
 280 PRINT "INPUT NUMBERS ONE BY ONE"
 290 PRINT "ROW BY ROW"
 300 PRINT "REMEMBER ";L;" DIGITS OR LESS"
 310 FOR I=1 TO T
 320 INPUT A(I)
 330 NEXT I
 340 CLS
 350 FOR I=1 TO R
 360 FOR J=1 TO C
 370 LET K=C*(I-1)+J
 380 GO SUB 600
 390 PRINT A(K);
 400 NEXT J
 410 PRINT
 420 NEXT I
 430 PRINT
 440 PRINT
 450 PRINT "INPUT LIST ARRANGED AS TABLE"
 460 PRINT R;" ROWS ";C;" COLS"
 470 STOP
 600 REM COUNT DIGITS FOR ALIGNING
 610 LET D=0
 620 LET G$=STR$(A(K))
 630 LET D=D+1
 640 LET G$=TL$(G$)
 650 IF NOT G$=CHR$(1) THEN GO TO 630
 660 FOR S=D TO F
 670 PRINT " ";
 680 NEXT S
 690 RETURN

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.