Spelling

This file is part of and 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

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
 1000 LET W$(1)="APPLE"
 1010 LET W$(2)="ORANGE"
 1020 LET W$(3)="GRAPE"
 1030 LET W$(4)="DOG"
 1040 LET W$(5)="CAT"
 1050 LET W$(6)="BOOK"
 1060 LET W$(7)="RUN"
 1070 LET W$(8)="NUMBER"
 1080 LET W$(9)="BOWL"
 1090 LET W$(10)="RADIO"
 1100 LET W$(11)="BEANS"
 1110 LET W$(12)="MILK"
 1120 LET W$(13)="ONION"
 1130 LET W$(14)="CREAM"
 1140 LET W$(15)="SAUCE"
 1150 LET W$(16)="BREAD"
 1160 LET W$(17)="SALAD"
 1170 LET W$(18)="BAKE"
 1180 LET W$(19)="BUTTER"
 1190 LET W$(20)="PEPPER"
 1200 LET W$(21)="DINNER"
 1210 LET W$(22)="SPOON"
 1220 LET W$(23)="GLASS"
 1230 LET W$(24)="SAUCER"
 1240 LET W$(25)="KNIFE"
 1250 LET W$(26)="FORK"
 1260 LET W$(27)="PLATE"
 1270 LET W$(28)="NAPKIN"
 1280 LET W$(29)="CUP"
 1290 LET W$(30)="SUGAR"
 1300 LET W$(31)="SHELL"
 1310 LET W$(32)="PILL"
 1320 LET W$(33)="TURKEY"
 1330 LET W$(34)="CAKE"
 1340 LET W$(35)="POLICE"
 1350 LET W$(36)="STEAK"
 1360 LET W$(37)="SOUP"
 1370 LET W$(38)="ROLLS"
 1380 LET W$(39)="OCEAN"
 1390 LET W$(40)="SHIP"
 1400 LET W$(41)="KAYAK"
 1410 LET W$(42)="PADDLE"
 1420 LET W$(43)="CANOE"
 1430 LET W$(44)="FISH"
 1440 LET W$(45)="NETS"
 1450 LET W$(46)="RAFT"
 1460 LET W$(47)="COTTON"
 1470 LET W$(48)="TONGUE"
 1480 LET W$(49)="TOOTH"
 1490 LET W$(50)="TOOLS"
 1500 LET W$(51)="DOCTOR"
 1510 LET W$(52)="NURSE"
 1520 LET W$(53)="OFFICE"
 1530 LET W$(54)="SCALES"
 1540 LET W$(55)="HURT"
 1550 LET W$(56)="SHIRT"
 1560 LET W$(57)="PANTS"
 1570 LET W$(58)="BOOTS"
 1580 LET W$(59)="JACKET"
 1590 LET W$(60)="SOCKS"
 1600 LET W$(61)="GLOVES"
 1610 LET W$(62)="RIBBON"
 1620 LET W$(63)="MITTEN"
 1630 LET W$(64)="PURSE"
 1640 LET W$(65)="SKIRT"
 1650 LET W$(66)="SHOES"
 1660 LET W$(67)="LION"
 1670 LET W$(68)="PANDA"
 1680 LET W$(69)="BEAR"
 1690 LET W$(70)="MONKEY"
 1700 LET W$(71)="DEER"
 1710 LET W$(72)="CAMEL"
 1720 LET W$(73)="ZEBRA"
 1730 LET W$(74)="TRAIN"
 1740 LET W$(75)="PAINT"
 1750 LET W$(76)="BRUSH"
 1760 LET W$(77)="PENCIL"
 1770 LET W$(78)="CRAYON"
 1780 LET W$(79)="PAPER"
 1790 LET W$(80)="DRAW"
 1800 LET W$(81)="SMOCK"
 1810 LET W$(82)="DRUMS"
 1820 LET W$(83)="GUITAR"
 1830 LET W$(84)="HORN"
 1840 LET W$(85)="STREET"
 1850 LET W$(86)="TRUCK"
 1860 LET W$(87)="BARBER"
 1870 LET W$(88)="BENCH"
 1880 LET W$(89)="STATUE"
 1890 LET W$(90)="POLICE"
 1900 LET W$(91)="PUMP"
 1910 LET W$(92)="PICNIC"
 1920 LET W$(93)="FOREST"
 1930 LET W$(94)="POND"
 1940 LET W$(95)="ANGEL"
 1950 LET W$(96)="CANDLE"
 1960 LET W$(97)="CHALK"
 1970 LET W$(98)="STRING"
 1980 LET W$(99)="ERASER"
 1990 LET W$(100)="COOKIE"
 2000 RETURN 
 2010 STOP 
 2020 SAVE "1017%1"
 2030 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