Spelling

This file is part of Timex Sinclair Public Domain Library Tape 1003 . Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000
Tags: Education

This program is a spelling quiz that displays words one at a time and asks the player to type each one back from memory. It uses two fixed-length string arrays: W$(100,6) holds up to 100 six-character words, and I$(1,6) captures the player’s input for comparison. A GOSUB at line 1000 populates all 100 vocabulary entries, covering themed groups such as food, clothing, animals, and art supplies. The quiz tracks attempts with variable T and correct answers with C, printing a score after every 10 words. A repeat-prevention check at line 68 compares the current word against the previously shown word (stored in S$(1)) to avoid immediate repetition.


Program Analysis

Program Structure

The program divides cleanly into three parts: initialisation (lines 10–35), the main quiz loop (lines 65–150), and a word-list data subroutine (lines 1000–2000). Control flows from the setup into an infinite loop that picks a random word, displays it briefly, clears the screen, prompts for input, evaluates the answer, and either increments the correct-answer counter or shows the right spelling before looping back.

Data Structures

  • W$(100,6) — a 100-element string array, each element 6 characters wide, holding the word list. All words in the list fit within six characters.
  • I$(1,6) — a single-element string array used to capture the player’s typed answer via INPUT I$(1).
  • S$(1,6) — a single-element string array used solely to remember the most recently shown word, preventing immediate repetition.
  • T — attempt counter, reset to 0 after every 10 questions.
  • C — correct-answer counter, reset alongside T.

Quiz Loop Logic

  1. Line 65: pick a random index N in range 1–100 using INT(RND*101).
  2. Line 67: reject 0 (possible because RND can return 0, making INT(0*101)=0).
  3. Line 68: reject the index if it matches the previously shown word, stored in S$(1).
  4. Line 69: record the chosen word in S$(1) for next-round duplicate prevention.
  5. Lines 70–90: display the word, pause for about 4 seconds (PAUSE 100 at ~25 fps on a ZX81 = ~4 s), then clear the screen.
  6. Line 100: collect the player’s attempt.
  7. Lines 110–119: on a correct answer, increment both counters; after 10 attempts, print the score, reset, pause, and continue.
  8. Lines 120–150: on a wrong answer, show the correct spelling, pause, increment T, and redisplay the word for another attempt.

Notable Techniques and Idioms

Using a one-element DIM array (DIM I$(1,6)) rather than a simple string variable is a common ZX81 idiom to obtain a fixed-width string buffer for INPUT, ensuring the comparison with the equally-dimensioned W$(N) works correctly with trailing-space padding.

The PAUSE 100 at line 80 serves as the “memorisation window”: the word is visible just long enough to read, then CLS at line 90 forces the player to rely on memory when typing. This is the core mechanic of the quiz.

Bugs and Anomalies

  • Duplicate word at indices 35 and 90: Both W$(35) and W$(90) are set to "POLICE". This means one slot is wasted and the word appears twice as often in the random draw.
  • Repeat prevention only checks the last word: Line 68 only prevents the immediately preceding word from being repeated; the same word can reappear after any intervening question.
  • Wrong-answer path increments T but not C: On a wrong answer, T is incremented at line 133 and the loop jumps back to line 70 to redisplay. If the player eventually gets it right, T is incremented again at line 111 and C is incremented, but T has now been incremented twice for that word, potentially shortening the round unexpectedly.
  • Score display resets unconditionally: Lines 115–116 reset both T and C whether reached from a correct answer (line 113) or a wrong-answer path (line 135), which is the intended behaviour, but the wrong-answer double-increment of T noted above means the 10-question boundary may be hit mid-retry.
  • INT(RND*101) produces values 0–100: Line 67 correctly guards against 0, but the range is otherwise fine since the array is dimensioned to 100 and the maximum value produced is 100.

Word List

The 100 vocabulary entries are organised into loose thematic clusters loaded sequentially in the subroutine at lines 1000–1990: fruits and animals, kitchen items, tableware, seafaring, medical, clothing, zoo animals, art supplies, musical instruments, street scenes, and miscellaneous. All words are at most six letters, matching the fixed array width.

IndicesTheme
1–9Fruits, animals, household
10–30Food and kitchen items
31–50Tableware, sea, nature
51–66Medical, clothing
67–73Zoo animals
74–83Art supplies, music
84–100Street scenes, outdoors, misc.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10122 – 10175.

Related Products

Related Articles

Related Content

Image Gallery

Spelling

Source Code

   1 REM "SPELLING"
  10 DIM W$(100,6)
  15 DIM I$(1,6)
  20 GOSUB 1000
  25 DIM S$(1,6)
  30 LET T=0
  35 LET C=0
  65 LET N=INT (RND*101)
  67 IF N=0 THEN GOTO 65
  68 IF W$(N)=S$(1) THEN GOTO 65
  69 LET S$(1)=W$(N)
  70 PRINT "SPELL ",W$(N)
  80 PAUSE 100
  90 CLS 
 100 INPUT I$(1)
 110 IF W$(N)<>I$(1) THEN GOTO 120
 111 LET T=T+1
 112 LET C=C+1
 113 IF T<>10 THEN GOTO 65
 114 PRINT "NUMBER RIGHT ";C
 115 LET T=0
 116 LET C=0
 117 PAUSE 300
 118 CLS 
 119 GOTO 65
 120 PRINT "WRONG ";W$(N)
 130 PAUSE 100
 133 LET T=T+1
 135 IF T=10 THEN GOTO 114
 140 CLS 
 150 GOTO 70
\n1000 LET W$(1)="APPLE"
\n1010 LET W$(2)="ORANGE"
\n1020 LET W$(3)="GRAPE"
\n1030 LET W$(4)="DOG"
\n1040 LET W$(5)="CAT"
\n1050 LET W$(6)="BOOK"
\n1060 LET W$(7)="RUN"
\n1070 LET W$(8)="NUMBER"
\n1080 LET W$(9)="BOWL"
\n1090 LET W$(10)="RADIO"
\n1100 LET W$(11)="BEANS"
\n1110 LET W$(12)="MILK"
\n1120 LET W$(13)="ONION"
\n1130 LET W$(14)="CREAM"
\n1140 LET W$(15)="SAUCE"
\n1150 LET W$(16)="BREAD"
\n1160 LET W$(17)="SALAD"
\n1170 LET W$(18)="BAKE"
\n1180 LET W$(19)="BUTTER"
\n1190 LET W$(20)="PEPPER"
\n1200 LET W$(21)="DINNER"
\n1210 LET W$(22)="SPOON"
\n1220 LET W$(23)="GLASS"
\n1230 LET W$(24)="SAUCER"
\n1240 LET W$(25)="KNIFE"
\n1250 LET W$(26)="FORK"
\n1260 LET W$(27)="PLATE"
\n1270 LET W$(28)="NAPKIN"
\n1280 LET W$(29)="CUP"
\n1290 LET W$(30)="SUGAR"
\n1300 LET W$(31)="SHELL"
\n1310 LET W$(32)="PILL"
\n1320 LET W$(33)="TURKEY"
\n1330 LET W$(34)="CAKE"
\n1340 LET W$(35)="POLICE"
\n1350 LET W$(36)="STEAK"
\n1360 LET W$(37)="SOUP"
\n1370 LET W$(38)="ROLLS"
\n1380 LET W$(39)="OCEAN"
\n1390 LET W$(40)="SHIP"
\n1400 LET W$(41)="KAYAK"
\n1410 LET W$(42)="PADDLE"
\n1420 LET W$(43)="CANOE"
\n1430 LET W$(44)="FISH"
\n1440 LET W$(45)="NETS"
\n1450 LET W$(46)="RAFT"
\n1460 LET W$(47)="COTTON"
\n1470 LET W$(48)="TONGUE"
\n1480 LET W$(49)="TOOTH"
\n1490 LET W$(50)="TOOLS"
\n1500 LET W$(51)="DOCTOR"
\n1510 LET W$(52)="NURSE"
\n1520 LET W$(53)="OFFICE"
\n1530 LET W$(54)="SCALES"
\n1540 LET W$(55)="HURT"
\n1550 LET W$(56)="SHIRT"
\n1560 LET W$(57)="PANTS"
\n1570 LET W$(58)="BOOTS"
\n1580 LET W$(59)="JACKET"
\n1590 LET W$(60)="SOCKS"
\n1600 LET W$(61)="GLOVES"
\n1610 LET W$(62)="RIBBON"
\n1620 LET W$(63)="MITTEN"
\n1630 LET W$(64)="PURSE"
\n1640 LET W$(65)="SKIRT"
\n1650 LET W$(66)="SHOES"
\n1660 LET W$(67)="LION"
\n1670 LET W$(68)="PANDA"
\n1680 LET W$(69)="BEAR"
\n1690 LET W$(70)="MONKEY"
\n1700 LET W$(71)="DEER"
\n1710 LET W$(72)="CAMEL"
\n1720 LET W$(73)="ZEBRA"
\n1730 LET W$(74)="TRAIN"
\n1740 LET W$(75)="PAINT"
\n1750 LET W$(76)="BRUSH"
\n1760 LET W$(77)="PENCIL"
\n1770 LET W$(78)="CRAYON"
\n1780 LET W$(79)="PAPER"
\n1790 LET W$(80)="DRAW"
\n1800 LET W$(81)="SMOCK"
\n1810 LET W$(82)="DRUMS"
\n1820 LET W$(83)="GUITAR"
\n1830 LET W$(84)="HORN"
\n1840 LET W$(85)="STREET"
\n1850 LET W$(86)="TRUCK"
\n1860 LET W$(87)="BARBER"
\n1870 LET W$(88)="BENCH"
\n1880 LET W$(89)="STATUE"
\n1890 LET W$(90)="POLICE"
\n1900 LET W$(91)="PUMP"
\n1910 LET W$(92)="PICNIC"
\n1920 LET W$(93)="FOREST"
\n1930 LET W$(94)="POND"
\n1940 LET W$(95)="ANGEL"
\n1950 LET W$(96)="CANDLE"
\n1960 LET W$(97)="CHALK"
\n1970 LET W$(98)="STRING"
\n1980 LET W$(99)="ERASER"
\n1990 LET W$(100)="COOKIE"
\n2000 RETURN 
\n2010 STOP 
\n2020 SAVE "1017%1"
\n2030 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