This program displays an American Independence Day tribute, cycling through the original 13 colonies in the order they ratified the Constitution before rendering a graphic of the 13-colony flag. For each colony, an animated firework effect is produced using block graphics characters (CHR$ 133 and 128) that scroll upward from the bottom of the screen, with a starburst shape drawn at the top using block graphics CHR$ 134 and 137. The flag rendering uses the ZX Spectrum’s block graphics characters: CHR$ 143 (solid block, red ink) for stripes, CHR$ 128 (quarter block, green ink) for alternate stripes, and a canton drawn with solid block graphics and inverse-mode asterisks arranged in a circular star pattern. The program loops back to the colony display on a “Y” keypress, using a string dimension array C$(13,20) to store the colony names.
Program Analysis
Program Structure
The program is organized into three main phases: an introduction, a colony fireworks loop, and a flag display. Line numbers begin at 5001 and run to 9998, suggesting this was part of a larger program or type-in listing with deliberate spacing. The flow is essentially linear with a replay loop at the end.
- Introduction (5001–5018): Title screen with border/ink/paper setup, a short beep, and an explanatory message with a 500-frame pause.
- Initialization (5020–5260): Arrays are dimensioned and filled with block-graphic characters for later use as stripe rows.
- Colony fireworks loop (5270–5350): Iterates through all 13 colonies, displaying the colony name and an animated firework.
- Flag display (5360–5465): Renders the 13-colony flag using stripe arrays and inverse asterisks for the star canton.
- Replay prompt (5470–5482): Asks the user to play again, looping back to line 5260 on “Y”.
Array Usage
| Variable | Size | Purpose |
|---|---|---|
C$(13,20) | 13 strings × 20 chars | Colony names in ratification order |
B$(30) | 30 chars | One row of red solid block graphics (CHR$ 143) for flag stripes |
G$(30) | 30 chars | One row of green quarter-block graphics (CHR$ 128) for alternate stripes |
S$(12) | 12 chars | One row of blue solid block graphics (CHR$ 143) for the canton rows |
Firework Animation
The firework effect (lines 5290–5340) picks a random horizontal position R between 5 and 25 using LET R=RND*20+5. A rising spark is simulated by printing CHR$ 133 (a half-block) at each row from 19 down to 5, immediately overwriting it with a space to create motion. At the apex, a starburst is constructed using four block-graphic characters around the center:
CHR$ 128— center top (solid quarter block)CHR$ 134— upper-left and lower-right diagonal branchesCHR$ 137— upper-right and lower-left diagonal branches
The screen is then cleared with CLS before the next colony, so the starburst is only briefly visible — there is no deliberate pause after the burst, making the effect quite fast.
Flag Rendering
The 13 stripes are produced by alternating B$ (red, CHR$ 143 × 30) and G$ (green ink, CHR$ 128 × 30) six times with an extra B$ row, giving 13 stripe rows total (lines 5370–5410). The canton (blue field) is overlaid at rows 5–11 by printing the 12-character S$ seven times in ink 1 (blue) starting at column 0 (lines 5430–5450). Two additional solid-block characters are stamped at positions to reinforce the canton corners using the escape \::\:: (four solid block chars).
The 13 stars are drawn using INVERSE 1 and asterisk characters arranged in a circular/oval pattern across lines 5–10, columns 3–9, mimicking the Betsy Ross flag’s ring of stars (line 5460).
Notable Techniques
- Pre-filling string arrays
B$,G$, andS$with repeated block-graphic characters at initialization avoids re-computing them in the display loop. - The
INKattribute is set before assigning characters toG$at line 5210, but since string variables don’t store color attributes, this ink change only affects subsequentPRINTcalls — the ink colors for flag stripes are set immediately before eachPRINT B$/PRINT G$call. - The replay loop uses a non-empty check:
IF R$="" THEN GO TO 5480(line 5480) before testing for “Y”, which guards against an empty INPUT response re-entering the condition check rather than the INPUT statement itself.
Bugs and Anomalies
- The
INK 2at line 5210 sets green ink forG$character assignment, but since character attributes are not stored in string variables, the actual color of the alternate stripes depends on the prevailing ink at print time. TheINK 2at line 5365 correctly sets this before the stripe printing loop begins. C$(2)is set to"PENNSYLVANIA "with two trailing spaces — these are harmless padding since the array dimension is 20 characters, but they are unnecessary.- The title at line 5275 reads “FIRST OF FIFTY” rather than referencing the 13 colonies, which is thematically inconsistent with the explanatory text on screen — this appears to be an artifact from the original magazine listing.
- The flag uses green ink (INK 2) for alternating stripes instead of white (INK 7), likely due to the limited color contrast between white stripes and the white paper background.
- Line 5000 is referenced in the
SAVE "DECOR" LINE 5000statement but does not exist in the listing; the program actually begins at line 5001. This means the auto-run target is a non-existent line, which on the Spectrum falls through to the first available line.
Content
Source Code
5001 REM ORIGINALLY APPEARED IN FAMILY COMPUTING
5009 CLS : PRINT AT 10,0;"***DECORATION OF INDEPENDENCE***"
5011 BORDER 2: INK 1: PAPER 7
5012 BEEP 1,10
5015 PRINT ''"THE ORIGINAL 13 COLONIES APPEAR IN THE ORDER THAT THEY ENTERED THE UNION, FOLLOWED BY THE FLAG OF THE 13 COLONIES."
5016 PAUSE 500
5018 CLS
5020 DIM B$(30)
5030 DIM G$(30)
5040 DIM S$(12)
5050 DIM C$(13,20)
5060 LET C$(1)="DELAWARE"
5070 LET C$(2)="PENNSYLVANIA "
5080 LET C$(3)="NEW JERSEY"
5090 LET C$(4)="GEORGIA"
5100 LET C$(5)="CONNECTICUT"
5110 LET C$(6)="MASSACHUSETTS"
5120 LET C$(7)="MARYLAND"
5130 LET C$(8)="SOUTH CAROLINA"
5140 LET C$(9)="NEW HAMPSHIRE"
5150 LET C$(10)="VIRGINIA"
5160 LET C$(11)="NEW YORK"
5170 LET C$(12)="NORTH CAROLINA"
5180 LET C$(13)="RHODE ISLAND"
5190 FOR F=1 TO 30
5200 LET B$(F)=CHR$ 143
5210 INK 2: LET G$(F)=CHR$ 128
5220 NEXT F
5230 FOR F=1 TO 12
5240 INK 1: LET S$(F)=CHR$ 143
5250 NEXT F
5260 INK 1
5270 FOR F=1 TO 13
5275 PRINT AT 0,0;" F I R S T OF F I F T Y "
5280 PRINT AT 21,10;C$(F)
5290 LET R=RND*20+5
5300 FOR H=19 TO 5 STEP -1
5310 PRINT AT H,R;CHR$ 133;AT H,R;CHR$ 32
5320 NEXT H
5330 PRINT AT 4,R;CHR$ 128;AT 3,R-1;CHR$ 134;AT 5,R-1;CHR$ 137;AT 3,R+1;CHR$ 137;AT 5,R+1;CHR$ 134
5340 CLS
5350 NEXT F
5360 PRINT AT 5,0;
5365 INK 2
5370 FOR F=1 TO 6
5380 PRINT B$
5390 PRINT G$
5400 NEXT F
5410 PRINT B$
5420 PRINT AT 6,0;
5430 FOR F=0 TO 6
5440 INK 1: PRINT S$
5450 NEXT F
5455 INK 1
5456 PRINT AT 5,0;"\::\:: "
5457 PRINT AT 5,7;"\::\:: "
5460 INVERSE 1: PRINT AT 5,6;"*";AT 5,5;"*";TAB 7;"*";AT 6,4;"*";TAB 8;"*";AT 7,3;"*";TAB 9;"*";AT 8,3;"*";TAB 9;"*";AT 9,4;"*";TAB 8;"*";AT 10,5;"*";TAB 7;"*"
5465 INVERSE 0
5470 PRINT AT 21,1;"REMEMBER: FOURTH OF JULY,1776"
5472 INPUT "AGAIN? Y/N";R$
5480 IF R$="" THEN GO TO 5480
5482 IF R$="Y" THEN GO TO 5260
9997 STOP
9998 SAVE "DECOR" LINE 5000
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

