Census

This file is part of and Synchro-Sette November 1983. Download the collection to get this file.
Date: November 1983
Type: Program
Platform(s): TS 1000

This program estimates and displays the United States population for a user-supplied date, then enters a real-time loop updating the count. It asks the user to enter a year, month, and day, then applies an exponential growth formula: P = INT(2 × 10^(8 + T)), where T is the fractional number of 150-year periods elapsed since 1969. After displaying the current estimate, it also shows population figures for one minute, one hour, one day, and one week ago, using fixed offsets (4, 231, 5553, and 38874 respectively). A delay loop at lines 440–450 paces the updates before incrementing P by 10 and looping back to redisplay, simulating a live population clock. The title “CENSUS” is displayed in inverse video using the ZX81’s block-graphic character encoding.


Program Analysis

Program Structure

The program is divided into three broad phases: a title/input phase (lines 10–200), a calculation and initial display phase (lines 240–310), and a live-update loop (lines 320–470). Lines 9998–9999 are utility lines for saving and auto-running the program and are not part of the runtime logic.

  1. Lines 10–50: Display inverse-video title “CENSUS” and scroll down.
  2. Lines 60–230: Prompt for year (Y), month (M), and day (D), each separated by six SCROLL calls to space the display.
  3. Lines 240–260: Compute the population estimate.
  4. Lines 270–430: Display current population plus historical offsets.
  5. Lines 440–470: Delay loop, increment P by 10, then GOTO 280 to refresh.

Population Formula

The core calculation occupies lines 240–260:

  • T = ((Y + M/12 + D/365) - 1969) / 150 — normalises the input date to a fraction of a 150-year span from 1969.
  • P = INT(2 × 10^(8 + T)) — applies exponential growth anchored so that at epoch 1969, P ≈ 200,000,000 (2 × 10^8), roughly the U.S. population in that year.

The 150-year divisor controls the growth rate; a full 150-year span would multiply the population by a factor of 10, representing an assumed long-term exponential trend. This is a simplification rather than a demographic model.

Historical Offset Constants

Rather than recomputing historical values, the program subtracts hard-coded offsets from P:

LabelOffset subtractedImplied rate
A minute ago4~4 persons/minute
An hour ago231~3.85 persons/minute
Yesterday5553~3.86 persons/minute
A week ago38874~3.86 persons/minute

The per-minute rate of approximately 3.85–4 is broadly consistent with U.S. net population growth figures from the early 1980s (roughly 2 million per year ÷ 525,600 minutes ≈ 3.8/minute). The slight inconsistency between the “minute” offset (4) and the others is a minor rounding artefact.

Live Update Loop

Lines 440–470 implement the real-time clock behaviour. The FOR N=1 TO 3000: NEXT N busy-wait loop provides a software delay intended to approximate one minute of elapsed time, after which P is incremented by 10 and the display block (lines 280–430) is repeated via GOTO 280. The increment of 10 per iteration is notably inconsistent with the per-minute offset of 4 used in line 340; this means the displayed “current” population will drift faster than the historical comparisons would predict.

Key BASIC Idioms

  • Repeated SCROLL: Used in groups of two or six throughout to create visual spacing on the ZX81’s 32-column display without using PRINT blank lines, avoiding the need to manage cursor position explicitly.
  • Inverse-video title: Line 20 uses TAB 10;"% %C%E%N%S%U%S% " where each %X encodes an inverse-video character, producing a highlighted title banner.
  • INT P without parentheses: Line 260 uses LET P=INT P, the ZX81 BASIC shorthand where INT takes the immediately following token as its argument — valid syntax on this platform.
  • Utility lines 9998–9999: Storing SAVE and RUN at high line numbers is a common convention to keep housekeeping commands accessible without interfering with normal execution flow.

Content

Appears On

Cassette to accompany the November 1983 issue of Synchro-Sette.

Related Products

Related Articles

Related Content

Image Gallery

Census

Source Code

  10 SCROLL 
  20 PRINT TAB 10;"% %C%E%N%S%U%S% "
  30 FOR N=1 TO 6
  40 SCROLL 
  50 NEXT N
  60 PRINT "WHAT YEAR IS IT? ";
  70 INPUT Y
  80 PRINT Y
  90 FOR N=1 TO 6
 100 SCROLL 
 110 NEXT N
 120 PRINT "WHAT MONTH (1 - 12)? ";
 130 INPUT M
 140 PRINT M
 150 FOR N=1 TO 6
 160 SCROLL 
 170 NEXT N
 180 PRINT "DATE (1 - 31)? ";
 190 INPUT D
 200 PRINT D
 210 FOR N=1 TO 6
 220 SCROLL 
 230 NEXT N
 240 LET T=((Y+M/12+D/365)-1969)/150
 250 LET P=2*10**(8+T)
 260 LET P=INT P
 270 PRINT "DATE: ";M;"/";D;"/";Y
 280 FOR N=1 TO 6
 290 SCROLL 
 300 NEXT N
 310 PRINT "U.S. POPULATION",P
 320 SCROLL 
 330 SCROLL 
 340 PRINT "A MINUTE AGO",P-4
 350 SCROLL 
 360 SCROLL 
 370 PRINT "AN HOUR AGO",P-231
 380 SCROLL 
 390 SCROLL 
 400 PRINT "YESTERDAY",P-5553
 410 SCROLL 
 420 SCROLL 
 430 PRINT "A WEEK AGO",P-38874
 440 FOR N=1 TO 3000
 450 NEXT N
 460 LET P=P+10
 470 GOTO 280
 9998 SAVE "CENSU%S"
 9999 RUN 

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

People

No people associated with this content.

Scroll to Top