Classic Computer Magazine Archive COMPUTE! ISSUE 40 / SEPTEMBER 1983 / PAGE 112

Mystery Spell

Doug Hapeman


This spelling game features lively graphics and sprites. It's also a clever teaching aid for parents, teachers, and students in which spelling lessons can be reviewed and then practiced. Originally written for the TI-99/4A with Extended BASIC, there are also versions for the VIC and 64.


If you've ever played Hangman, you won't have any trouble learning "Mystery Spell." Although it's similar in concept, there's a twist. Instead of a gallows, you'll see colorful balloons, flying blackbirds, cheerful music, and a happy face.
    When the game begins, a happy face appears in a little but surrounded by trees and landscape. The letters of the alphabet appear near the bottom of the screen, and blank spaces representing the secret word appear near the top. When you select a letter, the happy face moves to the selected letter and indicates whether it is an incorrect or correct choice. For each correct choice a colored balloon rises to the appropriate place in the secret word, and the letter is displayed. For each incorrect choice a blackbird descends and lands somewhere on the landscape. Too many blackbirds disallow any more guesses, and the word will be spelled correctly for you.
    There are two levels of difficulty: easy, which permits six incorrect guesses, and difficult, allowing only four.
    The program has 20 preselected words, or you can choose the "create your own word list" option (and, if you wish, save it to tape or disk). This option allows you to tailor the word difficulty to any learning level.
    Many features of the TI-99/4A are used in the program: color, graphics, moving sprites, and music. Let's look at some program features and see how certain graphics results are accomplished in the TI version.

Screen Centered Printing
There are several locations in the program where variable length words or phrases are centered. Line 170 is an example. For centering text with the DISPLAY AT statement, a simple equation can determine the proper column position:

    column = (14-LEN(L$)/2).

    It's like using a typewriter. When you want to center your title, you find the center of the page and count back one-half the length of the title. Similarly, in TI BASIC you subtract one-half of the length of the string variable from one-half the screen width. Fourteen is one-half the screen width using DISPLAY AT, and 16 is one-half using CALL HCHAR. The length of the string variable is easily determined by the LEN function.

Moving Sprites
Moving sprites are a fascinating feature of TI Extended BASIC. Through a library of impressive subprograms, sprites can easily be called, defined, magnified, or set in motion, can acknowledge coincidence, change character definition, and so on. Because they are controlled by built-in subprograms, they are easily accessed by even a beginning programmer.
    Regular characters are located on the screen in a 32 column by 24 row format, resulting in a total of 768 screen positions. Sprites, however, are located by dot-row and dot-column positions. Where normal characters are each made up of an eight-by-eight grid, sprites, on the other hand, can be located at any one of the 64 dots in the eight-by-eight grid. Therefore, there are 192 dotrows and 256 dot-columns, for a total of 49,152 screen positions for sprites.
    Mystery Spell uses moving sprites in several locations. The balloon and blackbird sprites are called with motion, but the happy face sprite is initially stationary. Each time a letter is pressed, it moves to the location of the letter and then back to the hut.
    Let's examine just how the happy face movement is achieved. The numeric variables used for determining direction and motion are: R=row, C = column, V = vertical motion, and H = horizontal motion.
    The alphabet is displayed on the screen in two neat rows (A-M) and (N-Z). The ASCII (standard computer code) value of the alphabet is 65(A) to 90(Z). In response to the CALL KEY, any other key pressed is ignored. If the letter pressed is less than 78 (the letter N), then the row variable is set for the upper row; otherwise the row variable is set for the lower row (line 350). CALL GCHAR is used to determine whether the letter has previously been chosen (line 360). If not, then the vertical motion is set for downward movement until coincidence is achieved with the row variable - then motion stops (line 390 and subroutine at line 550).

Another Equation To The Rescue
Knowing which way to move horizontally is determined with another IF-THEN statement (line 400).
    Knowing where to stop horizontally presented a more difficult problem. It could have been determined by the process of elimination through a long series of IF-THEN statements. But, once again, an equation can come to the rescue (line 410): C=(K-64)*16+4-208*INT ((K-64)/14). (K-64) gives a number between 1 and 26, depending on which letter has been pressed. It is multiplied by 16, which is two times eight dotcolumn positions (one for the letter and one for the space). Four is added to center the sprite over the appropriate letter. The last part of the equation 208*INT((K-64)/14) yields either a 0 or 208, and ((K-64)/14) yields a 0 for (A-M) or 1 for (N-Z). The figure 208 represents 26 character positions (13 letters and 13 spaces in each row) times 8 dot positions per character position.
    The best way to understand how the equation works is to experiment by placing different K values into it. For example, suppose the letter F was pressed. The ASCII value of F is 70, hence:

C = (70-64) + 4-208*((70-64)/14)
C = 6 + 4-208*6/14
C = 96 + 4-208*0
C=100    (the dot-column position for F).

Balloon Motion
The balloon sprite moves from wherever the happy face sprite is located to the appropriate blank in the secret word at the top of the screen. See the "correct guess subroutine" (lines 570-600); you should be able to follow the program logic for balloon direction and motion.

64 Version Notes

Erlc Brandon, Programming Assistant

Bird    The most interesting feature of the 64 version of "Mystery Spell" (Program 2) is the animated bird. The bird flies around the top of the screen, swooping down to pick up letters and to sit on its perch, depending on whether your guesses are right or wrong.
    As the bird moves around, it seems to flap its wings, creating an illusion of flight. This is achieved by rapidly displaying different "poses." In films, this is done by passing many frames through a projector every second. To achieve the illusion of flapping wings, we too must create a few "frames" of a bird in motion.
    Using a sprite editor, we first drew the bird you see in Figure 1. Then, using that sprite, we designed two more birds, one with the wing up (Figure 2) and one with the wing down (Figure 3). Using those shapes, we designed three more birds identical to the first three, but without legs. This gave us three "frames" for the bird carrying a letter, and three "frames" for the bird flying freely. We then set up the DATA statements in the program as if we were going to display six different sprites.
    Immediately after the screen RAM are eight memory locations that tell the 64 where in memory to find the shapes of the eight sprites. Usually these locations are at 2040 to 2047 ($07F8 to $07FF). By rapidly POKEing 2040 with the pointer to each "frame," the bird seems to flap its wings. To see how this is done, look at lines 2000-2060. This is the routine which flies the bird around the top of the screen until you press a key. Line 2050 steps through the "frame" numbers. The actual POKEing is done at the end of line 2000.
    Another interesting feature of the game is that when you guess correctly, the bird swoops down to pick up a letter, and then carries it up to the word. How is that letter incorporated into the bird sprite?
    In the character set ROM at 53248 ($D000), the shape of each character is contained in eight bytes. Each byte is one row, and each bit is a column within that row. Depending on whether the value of that bit is 0 or 1, the pixel will be clear or set inside the character. The sprite is 24 bits wide, which is as wide as three characters. This means that by putting character shape data into every third byte within a sprite, we can make character shapes inside sprites. This technique could be used in any program which moves letters or text around smoothly. To see how this is done, look at lines 2180 to 2260.
    Lines 2180 and 2190 make the character ROM available to be PEEKed. They also turn off the keyboard. Lines 2200 to 2240 take the character data and put it in the sprites. Finally, lines 2250 and 2260 cover up the character ROM and re-enable the keyboard.

Program 1:
Mystery Spell - TI-99 Extended BASIC

100 REM MYSTERY SPELL
120 DIM A$(26),B$(20)
122 ON ERROR 140
125 CALL INIT :: CALL LOAD(-31878,1
    3)
130 REM **INITIALIZATION AND INTROD
    UCTION**
140 DISPLAY AT(12,5)ERASE ALL:"ONE
    MOMENT PLEASE..." :: GOTO 780
150 DISPLAY AT(7,1)ERASE ALL BEEP:"
    PRESS<3 SPACESIFOR": : :" 1 =
       INSTRUCTIONS": :"  2 = MYST
    ERY SPELL": :" 3 = FINISH MY
    STERY SPELL"
160 DISPLAY AT(23,3):"PLEASE ENGAGE
     ALPHA LOCK" :: CALL KEY(0,K,S)
    :: IF S=0 OR(K<49 OR K>51)THEN
    160 :: ON K-48 GOTO 980,190,170
170 DISPLAY AT(12,5)ERASE ALL BEEP:
    "THANKS FOR PLAYING," :: DISPLA
    Y AT(14,14-LEN(L$)/2):L$ :: STO
    P
190 DISPLAY AT(7,1)ERASE ALL BEEP:"
    CHOOSE A WORD LIST:": : :"  A
    =  PRESELECTED WORDS": :"  B =
     CREATE YOUR OWN"
200 CALL KEY(0,K,S):: IF S=0 OR(K<:6
    5 OR K>66)THEN 200 :: IF K=66 T
    HEN 220
210 PSW=1 :: GOTO 230
220 PSW=0 :: GOTO 1620
230 CALL CLEAR :: RESTORE 940 :: GO
    TO 930
240 CALL SPRITE(#2,120,2,78,121,0,0
    ):: CALL MAGNIFY(3):: CALL SPRI
    TE(#4,136,16,8,128,0,1):: CALL
    SPRITE(#3,140,2,8,128,0,-2)
250 DISPLAY AT(5,9):"MYSTERY SPELL"
     :: T=200 :: GOSUB 1050 :: IF P
    SW=1 THEN GOTO 1840
260 DISPLAY AT(19,1)BEEP:" WHAT IS
    YOUR NAME, PLEASE?" :: DISPLAY
    AT(23,1):"TYPE NAME, THEN PRESS
     ENTER"
270 ACCEPT AT(5,9)SIZE(14):L$ :: CA
    LL HCHAR(5,7,32,22)
280 REM **MAIN PROGRAM LOOP**
290 DISPLAY AT(19,1)BEEP:" CHOOSE
    THE LEVEL OF PLAY"
300 DISPLAY AT(23,1):"{3 SPACES}1)
    EASY{3 SPACES}2) DIFFICULT" ::
    CALL KEY(0,K,S):: IF S=0 OR K>5
    0 OR K<49 THEN 300 :: IF K=49 T
    HEN ER=7 ELSE ER=5
310 FOR SP=5 TO 13 .. CALL DELSPRIT
    E(#SP):: NEXT SP
320 DISPLAY AT(19,1):" A B C D E F
    G H I J K L M" :: DISPLAY AT(23
    ,1)BEEP:" N O P Q R S T U V W X
    Y Z" :: RANDOMIZE
330 CALL HCHAR(5,3,32,28):: W$=B$(I
    NT(20*RND)+I):: F=LEN(W$):: FOR
     I=1 TO F :: DISPLAY AT(5,2*I+1
    4-F):"-" :: NEXT I :: Y=0 :: SP
    =13
340 CALL KEY(0,K,S):. IF S=0 OR(K<6
    5 OR K>90)THEN 340 ELSE C=121
350 IF K<78 THEN R=128 ELSE R=160
360 CC= ((k-64)*16+16-208*INT((K-64)
    /14))/8 :: CALL GCHAR((R+24)/8,
    CC,X):: IF X=32 THEN 370 ELSE 3
    90
370 DISPLAY AT(16,14-(8+LEN(L$))/2)
    SIZE(S+LEN(L$))BEEP:" OOPS, ";L
    $;"," :: DISPLAY AT(17,1):" YOU
     TRIED THAT ONE ALREADY"
380 FOR D=1 TO 500 :: NEXT D :: CAL
    L HCHAR(16,1,33,64):: GOTO 340
390 V=12 :: H=0 :: GOSUB 550
400 IF K<72 OR(K>77 AND K<85)THEN H
    =-12 ELSE H=12
410 V=0 :: C=(K-64)*16+4-208*INT((K
    -64)/14):: GOSUB 550
420 X=0 :: CALL HCHAR((R+24)/B,(C+1
    2)/8,32):: FOR I=1 TO F :: IF A
    SC(SEG$(W$,I,1))<>K THEN 450
430 CALL PATTERN(#2,124):: GOSUB 58
    0
440 CALL PATTERN(#2,120):: DISPLAY
    AT(5,2*I+14-F)SIZE(-1):CHR$(K):
    : X=1 :: Y=Y+1
450 NEXT I :: IF X=1 THEN 470
460 CALL PATTERN(#2,128):: GOSUB 62
    0 :: CALL PATTERN(#2,120)
470 H=-H :: C=121 :: GOSUB 550
480 V=-12 :: H=0 :: R=78 :: GOSUB 5
    50
490 IF Y=LEN(W$)THEN GOSUB 740 ELSE
    
500 :: GOTO 510
500 IF ER=1 THEN GOSUB 710 ELSE 340
510 DISPLAY AT(23,1)BEEP:"
    {5 SPACES}ANOTHER WORD? (Y/N)"
520 CALL KEY(0,K,S):: IF S=0 OR K<>
    89 AND K<>78 THEN 520 :: IF K=8
    9 THEN 290
530 CALL DELSPRITE(ALL):: GOTO 150
540 REM **SUB TO MOVE HAPPY FACE**
550 CALL MOTION(#2,V,H)
560 CALL COINC(#2,R,C,4,Z):: IF Z=0
     THEN 560 ELSE CALL MOTION(#2,0
    ,0):: CALL LOCATE(#2,R,C):: RET
    URN
570 REM **SUB FOR CORRECT GUESS**
580 B=8*(2*I+14-F):: CALL SPRITE(#1
    ,132,14,R,C,(32-R)/8,(B-C)/8)
590 J=2^(1/12):: FOR A=1 TO 25 :: C
    ALL SOUND(-40,220*J^A,1):: NEXT
     A
600 CALL COINC(#1,32,B,6,Z):: IF Z=
    0 THEN 600 ELSE CALL DELSPRITE(
    #1):: RETURN
610 REM **SUB FOR INCORRECT GUESS**
620 SP=SP-1 :: ER=ER-1 :: IF ER>4 T
    HEN RR=80 ELSE RR=50
630 IF ER=6 OR ER=4 THEN C=52
640 IF ER=5 OR ER=1 THEN C=188
650 IF ER=3 THEN C=110
660 IF ER=2 THEN C=132
670 CALL SPRITE(#SP,140,2,1,120,(RR
    -1)/B,(C-120)/8)
680 J=2^(1/12):: FOR A=25 TO 1 STEP
     -1 :: CALL SOUND(-40,440*J^A,1
    ):: NEXT A
690 CALL COINC(#SP,RR,C,6,Z):: IF Z
    =0 THEN 690 ELSE CALL MOTION(#S
    P,0,0):: CALL LOCATE(#SP,RR,C):
    : CALL PATTERN(#SP,100):: RETURN
700 REM **SUB FOR BLACKBIRDS WIN**
710 CALL HCHAR(19,3,32,28):: DISPLA
    Y AT(19,15-(8+LEN(L$))/2):"SORR
    Y, ";L$;","
720 DISPLAY AT(23,1)BEEP:"THE BLACK
    BIRDS WIN THIS TIME" :: GOSUB 7
    60 :: RETURN
730 REM **SUB FOR PLAYER WINS**
740 CALL HCHAR(19,3,32,28):: DISPLA
    Y AT(19,15-(8+LEN(L$))/2):"GREA
    T, ";L$;","
750 DISPLAY AT(23,1):"{3 SPACES}THA
    T'S THE SECRET WORD"
760 CALL HCHAR(5,3,32,26):: FOR I=1
     TO F :: DISPLAY AT(5,2*I+14-F)
    :SEG$(W$,I,1):: NEXT I :: T=180
     :: GOSUB 1050 :: RETURN
770 REM **ASSIGN COLORS AND DEFINE
    CHARACTERS**
780 FOR I=0 TO 9 :: CALL COLOR(I,2,
    8):: NEXT I :: CALL COLOR(10,3,
    8):: CALL COLOR(11,11,8):: CALL
     COLOR(1,13,8)
800 FOR I=1 TO 25 :: READ C,A$(I)::
     CALL CHAR(C,A$(I)):: NEXT I ::
     CALL SCREEN(15):: GOTO 150
810 DATA 112,C0C0C0C0C0C0C0C0,113,0
    303030303030303,114,FFFFFFFFFFF
    FFFFF,115,C0C0C0FFFFC0C0C0,116,
    030303FFFF030303
820 DATA 105,18+C3C7E7EFFFFFF,106,F
    FFFFFFFFFFFFFFF,107,FFFFFF7E7E3
    C3C18,108,071F7FFFFF7FlF07,109,
    C0F0FEFFFFFEF0C0
830 DATA 96,00000000030F3FFF,97,FFF
    FFFFFFFFFFFFF,98,FFFFEFC78383C7
    EF,99,7F3FlE3C78FCFEFF,33,FFFFF
    FFFFFFFFFFF
840 DATA 91,1F3F7FFFFFFFFFFF,92,FBF
    CFEFFFFFFFFFF,93,00000000C0F0FC
    FF
850 DATA 120,071820404C888081808884
    4340201807EOIBOC023211018101112
    1C202041BE0
860 DATA 124,071820404C888081809F90
    4844231807EO18OC0232110181OIF90
    91222C418E0
870 DATA 128,071820404C888O81808384
    4840201807E018OC023211018101C12
    112020418E0
880 DATA 132,030FlF3F3F3F3FlF0F0703
    010102040880EOFOFBFBFBFBF0E0C0B
    0
890 DATA 136,030F3F7F7F3FFFFFFFFF3F
    7F7F37070l0C0CCFEFEFCFFFFFFFFF
    CFEFEECE0B0
900 DATA 140,000000000000183D478301
    000000000000000000000018BCE2Cl8
    00000000000
910 DATA 100,0001010100010307070707
    0301000101C0E0F0D0C0E0F0F0FBFBF
    8F0E0C02020
920 REM **PRINT SCREEN**
930 CALL HCHAR(16,1,33,288):: FOR I
    =1 TO 21 :: READ R,C,G$ :: DISP
    LAY AT(R,C)SIZE(-6):G$ :: NEXT
    I :: GOTO 240
940 DATA 9,12,`[aa\1.10,12,grrrrp,l
    1,12,grrrrp,12,12,grrrrp,l3,14,
    st,14,14,st,15,14,st
950 DATA 9,5,iii,10,4,1jjjm,11,4,lj
    jjm,12,5,kjk,13,6,b,14,6,a,15,6
    ,a
960 DATA 9,22,iii,10,21,1jjjm,11,21
    ,IiJjm,12,22,kjk,13,23,a,14,23,
    c,15,23,a
970 REM **INSTRUCTIONS**
980 DISPLAY AT(1,8)ERASE ALL:"MYSTE
    RY SPELL": :"{3 SPACES}THE OBJE
    CT OF MYSTERY":"SPELL IS TO GUE
    SS THE SECRET":"WORD."
990 DISPLAY AT(6,4):"WHEN YOU PRESS
     A LETTER,":"THE HAPPY FACE WIL
    L MOVE TO":"THE SELECTED LETTER
     AND LET":"YOU KNOW WHETHER YOU
     MADE A"
1000 DISPLAY AT(10,1):"RIGHT OR WRO
     NG CHOICE.":"{3 SPACES}A CORRE
     CT CHOICE LAUNCHES":"A BALLOON
     . AN INCORRECT ONE":"CAUSES A
      BLACKBIRD TO LAND."
1010 DISPLAY AT(14,1):"IF TOO MANY
     BLACKBIRDS LAND,":"YOU WILL LO
     SE THE GAME.": :"{3 SPACES}THE
     RE ARE TWO LEVELS:"
1020 DISPLAY AT(19,1)BEEP:"EASY) P
     ERMITS 6 INCORRECT":"
     {7 SPACES}GUESSES.": :"HARD)
     PERMITS ONLY 4."
1030 DISPLAY AT(24,6):"**PRESS ANY
     KEY**" :: CALL KEY(0,K,S):: IF
      S=0 THEN 1030 ELSE 190
1040 REM **SUB FOR BLACKBIRD FLIGHT
      AND THEME MELODY**
1050 R=8 :: FOR SP=5 TO 13 :: C=INT
     (RND*240)+l :: CALL SPRITE(#SP
     ,140,2,R,C,0,12):: R=R+12 :: N
     EXT SP
1060 CALL SOUND(T,175,0)
1070 CALL SOUND(T,349,0,175,2)
1080 CALL SOUND(T,587,0,175,2)
1090 CALL SOUND(2*T,523,0,440,1,175
     ,2)
1100 CALL SOUND(T,587,0,175,2)
1110 CALL SOUND(2*T,523.0,440,1,185
     ,2)
1120 CALL SOUND(T,196,0)
1130 CALL SOUND(T,3.30,0,196,2)
1140 CALL SOUND(T,587,0,196,2)
1150 CALL SOUND(2*T,523,0,466,1,196
     ,2)
1160 CALL SOUND(T,587,0,196,2)
1170 CALL SOUND(2*T,523,0,466,1,208
     ,2)
1180 CALL SOUND(T,220,2)
1190 CALL SOUND(T,523,0,440,1,220,2
     )
1200 CALL SOUND(T,311,2)
1210 CALL SOUND(T,523,0,440,1,311,2
     )
1220 CALL SOUND(T,294,2)
1230 CALL SOUND(T,494,0,415,1,294,2
     )
1240 CALL SOUND(T,277,2)
1250 CALL SOUND(T,466,0,392,1,277,2
     )
1260 CALL SOUND(T,440,0,262,2)
1270 CALL SOUND(T,523,0,262,2)
1280 CALL SOUND(T,587,0,247,2)
1290 CALL SOUND(T,698,0,247,2)
1300 CALL SOUND(2*T,659,0,233,2)
1310 CALL SOUND(2*T,784,0,659,1,1-l
     ,2)
1320 CALL SOUND(T,880,0,175,2)
1330 CALL SOUND(T,831,0,175,2)
1340 CALL SOUND(T,880,0,262,2,349,2
     )
1350 CALL SOUND(T,1047,0,262,2,349,
     2)
1360 CALL SOUND(T,1047,0,220,2)
1370 CALL SOUND(T,880,0,220,2)
1380 CALL SOUND(T,784,0,262,2,349,2
     )
1390 CALL SOUND(T,698,0,262,2,349,2
     )
1400 CALL SOUND(T,784,0,233,2)
1410 CALL SOUND(T,698,0,233,2)
1420 CALL SOUND(T,587,0,294,2,349,2
     )
1430 CALL SOUND(T,698,0,294,2,349,2
     )
1440 CALL SOUND(T,698,0,220,2)
1450 CALL SOUND(T,587,0,220,2)
1460 CALL SOUND(T,523,0,262,2,349,2
     )
1470 CALL SOUND(T,440,0,262,2,349,2
     )
1480 CALL SOUND(T,392,0,247,2)
1490 CALL SOUND(T,784,0,247,2)
1500 CALL SOUND(T,698,0,294,2,349,2
     )
1510 CALL SOUND(T,659,0,294,2,349,2
     )
1520 CALL SOUND(T,587,0,196,2)
1530 CALL SOUND(T,440,0,196,2)
1540 CALL SOUND(T,440,0,233,2,349,2
     )
1550 CALL SOUND(T,494,0,233,2,349,2
     )
1560 CALL SOUND(T,523,0,175,2,220,2
     )
1570 CALL SOUND(T,587,0,175,2,220,2
     )
1580 CALL SOUND(2*T,659,0,262,2)
1590 CALL SOUND(3*T,698,0,262,2,175
     ,0)
1600 FOR I=l TO 30 STEP 2 :: CALL S
     OUND(-T,698,I,262,I,175,I):: N
     EXT I :: RETURN
1610 REM **CREATE A WORD LIST**
1620 DISPLAY AT(1,4)ERASE ALL:"WORD
      LIST INSTRUCTIONS": : :" IN
     THIS SEGMENT YOU MAY":"EITHER
     CREATE A WORD LIST"
1630 DISPLAY AT(6,1):"OR LOAD AN EX
     ISTING ONE FROM":"A STORAGE DE
     VICE.": : :" WHEN CREATING A
     WORD LIST,":"TYPE EACH WORD, T
     HEN PRESS"
1640 DISPLAY AT(12,1):"ENTER. MAXI
     MUM WORD LENGTH":"IS 13 CHARAC
     TERS.  20 WORDS":"MUST BE ENTE
     RED FOR EACH OF":"THE WORD LIS
     TS CREATED."
1650 DISPLAY AT(18,3)BEEP:"AS YOU E
     NTER EACH LIST.":"YOU MAY SAVE
      IT TO A STORAGE":"DEVICE FOR
     FUTURE USE WITH":"MYSTERY SPEL
     L."
1660 DISPLAY AT(24,6):"**PRESS ANY
     KEY**" :: CALL KEY(0,k:,S):: IF
      S=0 THEN 1660
1670 DISPLAY AT(7,1)ERASE ALL BEEP:
     "PRESS{3 SPACES}TO": : :"  1
     =  CREATE A WORD LIST": :"  2
      =  LOAD A WORD LIST": :"  3
     =  EXIT"
1680 CALL KEY(0,K,S):: IF S=0 OR(K<
     49 OR K>51)THEN 1680 :: J=0 ::
     ON K-48 GOTO 1690,1795,190
1690 DISPLAY AT(1,5)ERASE ALL:"ENTE
     R THE WORD LIST:"
1700 I=1 :: C=1 :: FOR A=1 TO 2 ::
     R=3 :: FOR Z=1 TO 10
1710 ACCEPT AT(R,C)SIZE(-13)BEEP:B$
     (I):: R=R+2 :: I=I+1 :: NEXT Z
      :: C=15 :: NEXT A
1720 DISPLAY AT(24,1)BEEP:"CORRECT
     OR CHANGE ANY? (Y/N)"
1730 CALL KEY(0,K,S):: IF S=0 OR K<
     >89 AND k:<=78 THEN 1730 :: IF
     K=89 THEN 1700 :: J=1 :: GOTO
     1795
1740 FOR I=1 TO 20 :: PRINT #1:B$(I
     ):: NEXT I :: CLOSE #1 :: GOTO
      230
1750 FOR I=1 TO 20 :: INPUT #1:B$(I
     ):: NEXT I :: CLOSE #1
1760 DISPLAY AT(11,6)ERASE ALL BEEP
     :"DO YOU WISH TO SEE": :"
     {4 SPACES}THE WORD LIST? (Y/N)
     "
1770 CALL KEY(0,K,S):: IF S=0 OR(K<
     >89 AND K<>78)THEN 1770 :: IF
     K=89 THEN 1780 ELSE 230
1780 DISPLAY AT(1,10)ERASE ALL BEEP
     :"WORD LIST" :: R==3 :: FOR I=1
      TO 20 STEP 2 :: DISPLAY AT(R,
     1):B$(I),B$(I+1):: R=R+2 :: NE
     XT I
1790 DISPLAY AT(24,1):"PRESS ANY kE
     Y WHEN FINISHED" :: CALL KEY(0
     ,K,S):: IF S=0 THEN 1790 ELSE
     230
1795 ON ERROR 1795
1800 DISPLAY AT(5,6)ERASE ALL BEEP:
     "WHAT IS THE NAME": :"  OF YOU
     R STORAGE DEVICE?": :"(EXAMPLE
     : CS1 OR DSk1.WORDS)"
1810 DISPLAY AT(23,1):"PLACE TAPE O
     R DISK IN DEVICE" :: ACCEPT AT
     (11,3):F$ :: OPEN #1:F$,INTERN
     AL,UPDATE,FIXED 50
1820 IF J=0 THEN 1750 ELSE 1740
1830 REM **PRESELECTED WORD LIST**
1840 FOR I=1 TO 20 :: READ B$(I)::
     NEXT I :: GOTO 260
1850 DATA BANANAS,CARROTS,RHUBARB,C
     ABBAGE,TURNIF,BEANS,CORN,CELER
     Y,WATERMELON,ORANGES,APPLES,PE
     ACHES
1860 DATA MUSHROOMS,ONIONS,POTATOES
     ,TOMATOES,GRAPES,PUMPKIN,SQUAS
     H,LEMONS

TI version
A letter is successfully chosen in the TI version of "Mystery
Spell."


Program 2: Mystery Spell - 64 Version
by Eric Brandon, Programming Assistant

100 GOSUB 2660
110 X=RND(-TI)
120 DIM W(20),W$(500)
130 GOSUB 1190 :REM DRAW HOUSE
140 PRINT"{HOME}{BLU}PLEASE WAIT...
150 GOSUB 1380 :REM POKE IN SPRITES
160 GOSUB 1970 :REM GET WORDS
170 GOSUB 690{2 SPACES}:REM SET UP SPRIT
    ES
180 PRINT"{HOME}{14 SPACES}"
190 W$=W$(RND(1)*N+1)
200 GOSUB 650
210 L$=" ABCDEFGHIJKLMNOPQRSTUVWXYZ"
220 PRINT"{HOME}{17 DOWN}{8 RIGHT}";
230 FOR I=2 TO 14
240 PRINTMID$(L$,I,1)"{RIGHT}";
250 NEXT
260 PRINT:PRINT"{DOWN}{8 RIGHT}";
270 FOR I=15TO 27
280 PRINTMID$(L$,I,1)"{RIGHT}";
290 NEXT
300 PRINT"{HOME}{4 DOWN}"SPC(18-LEN(G$))
    ;
310 FOR I=1TO LEN(G$)
320 PRINTMID$(G$,I,1)"{RIGHT}";
330 NEXT
340 IF COUNT<>LEN(W$) THEN420
350 POKE 198,0
360 FOR DL=1TO100:NEXTDL:CL=CL+1:IFCL=3T
    HENCL=1
370 PRINTMID$("{BLK}{CYN}",CL,1);
380 PRINT"{HOME}{14 SPACES}YOU WIN !!!!"
390 GETA$:IFA$=""THEN 360
400 GOTO 2610
410 GOSUB 2000
420 GETA$:IFA$<"A"ORA$>"Z"ANDA$<>"←"THE
    N410
430 IF A$=""THEN 760
440 P=ASC(A$)-64
450 IF MID$(L$,P+1,1)<>" "THEN540
460 PRINT"{HOME}{4 DOWN}{8 SPACES}LETTER
     ALREADY CHOSEN{10 SPACES}"
470 FOR I=1 TO 800:NEXTI
480 PRINT"{HOME}{4 DOWN}{38 SPACES}"
490 PRINT"{HOME}{4 DOWN}"SPC(18-LEN(G$))
    ;
500 FOR I=1TO LEN(G$)
510 PRINTMID$(G$,I,1)"{RIGHT}";
520 NEXT
530 GOTO 420
540 L$=LEFT$(L$,P)+" "+MID$(L$,P+2)
550 RF=0 :REM FLAG FOR CORRECT GUESS
560 FOR I=1 TO LEN(W$)
570 IF MID$(W$,I,1)<>A$ THEN 610
580 G$=LEFT$(G$,I)+MID$(W$,I,1)+MID$(G$,
    1+2)
590 RF=RF+1
600 COUNT=COUNT+1
610 NEXT I
620 IF RF=0 THEN GOSUB 1030
630 IF RF THEN GOSUB 2070
640 GOTO 220
650 G$=" "
660 FOR I=1 TO LEN(W$):G$=G$+"-":W(I)=0:
    NEXT
670 RETURN
680 I=I+1:GOTO1980
690 REM SET UP SPRITES
700 V=53248
710 FOR I=0 TO 15:POKE V+I,0:NEXT
720 POKE V+21,255
730 FOR I=V+39 TO V+46:POKE I,0:NEXT
740 X=0:Y=60:S=251
750 RETURN
760 PRINT"{HOME}{BLU}ENTER YOUR GUESS: "
    ;
770 POKE V+21,PEEK(V+21)AND254
780 FOR I=1 TO LEN(W$):PRINT"[<@>]";:NEX
    T
790 PRINT"{HOME}{18 RIGHT}";GU$;
800 IF LEN(GU$)<LEN(W$)THENPRINT"[<+>]";
810 IF LEN(GU$)<LEN(W$)-1 THEN FOR I=2 T
    O LEN(W$)-LEN(GU$):PRINT"[<@>]";
820 GET K$:IF K$=""THEN 820
830 IF K$=CHR$(20) AND LEN(GU$)>0 THEN G
    U$=LEFT$(GU$,LEN(GU$)-1):GOTO790
840 IF K$=CHR$(13) AND LEN(GU$)=LEN(W$)
    THEN 870
850 IF K$>="A" AND K$<="Z" AND LEN(GU$)<
    LEN(W$) THEN GU$=GU$+K$
860 GOTO 790
870 IF GU$<>W$ THEN 930
880 PRINT"{HOME}{38 SPACES}"
890 PRINT"{HOME}{4 DOWN}"SPC(18-LEN(" "+
    W$));
900 FOR I=1TO LEN(" "+W$)
910 PRINTMID$(" "+W$,I,1)"{RIGHT}";
920 NEXT:GOTO350
930 PRINT"{HOME}{BLK}{13 SPACES}SORRY...
     YOU LOSE{5 SPACES}"
940 PRINT"{BLK}THE WORD WAS ..."
950 PRINT"{HOME}{4 DOWN}"SPC(18-LEN(" "+
    W$));
960 FOR I=1TO LEN(" "+W$)
970 PRINTMID$(" "+W$,I,1)"{RIGHT}";
980 FOR D=l TO 200:NEXT
990 NEXT
1000 POKE 198,0
1010 GETA$:IFA$=""THEN1010
1020 GOTO 2610
1030 DB=DB+1:S=S-3
1040 DX=32*DB+16:DY=225
1050 IF DB=8 THEN DB=0
1060 POKEV,XAND255:POKEV+16,PEEK(V+16)AN
     D2540R-(X>255):POKE V+1,Y:POKE2040,
     S
1070 IF X=0 THEN POKE V+21,PEEK(V+21)OR1
1080 FLAG=0
1090 IFABS(X-DX)>lTHENX=X+3:FLAG=1:IFX>3
     44THEN X=0:POKEV+21,PEEK(V+21)AND25
     4
1100 IF Y<DY THEN Y=Y+2:FLAG=1
1110 S=S+1:IFS=251THENS=248
1120 IF FLAG THEN 1060
1130 X=DX:Y=DY
1140 POKEV+2*DB,XAND255:POKEV+16,PEEK(V+
     16)OR(2TDB)*(-(X>255))
1150 POKEV+2*DB+1,Y:POKE2040+DB,254,
1160 IF DB<>0 THEN POKE V+21,PEEK(V+21)A
     ND254
1170 X=0:Y=60:IF D8=0 THEN 930
1180 RETURN
1190 POKE 53281,3:POKE 53280,4
1200 PRINT"{CYN}{CLR}
1210 PRINT"{4 DOWN}
1220 PRINT
1230 PRINT"{5 SPACES}{GRN}{3 SPACES}
     {RVS}{2 SPACES}{OFF}{10 SPACES}
     {WHT}[<D>]{UP}{RVS}[<B>]{OFF}{DOWN}
     {6 SPACES}{GRN}
1240 PRINT"(6 SPACES}{RVS}[<K>]
     {4 SPACES}(OFF}[<J>]{6 SPACES}{RVS}
     {YEL}E[<*>]{BLK}{OFF}[<2 G>]
     {3 SPACES}(GRN} {RVS}[<J>] [<L>]
     {OFF}
1250 PRINT"(6 SPACES}{RVS}[<J>]
     {4 SPACES}[<L>]{OFF}{5 SPACES}{RVS}
     {YEL}E{2 SPACES}[<*>]{OFF}{BLK}
     [<G>]{3 SPACES}{GRN} {RVS}
     {3 SPACES}{OFF}
1260 PRINT"(6 SPACES){RVS}[<G>]
     {4 SPACES}[<>]2{OFF}(4 SPACES}{RVS}
     {YEL}E{4 SPACES}[<*>]{OFF}{GRN}
     {3 SPACES}{RVS}[<J>]{3 SPACES}[<L>]
     {OFF}
1270 PRINT"{6 SPACES}{RVS}{6 SPACES}
     {OFF}{4 SPACES}{RVS}{RED}{4 SPACES}
     [<E>] {OFF}{GRN}{3 SPACES}{RVS}
     {5 SPACES}{OFF}
1280 PRINT"(6 SPACES}[<5>]{2 SPACES}
     {RVS}(2 SPACES}{OFF}(6 SPACES}{RVS}
     {RED} [<E>]{4 SPACES}{OFF}
     {2 SPACES}{GRN}(3 SPACES}{RVS}[<5>]
     {OFF}
1290 PRINT"{RVS}[<6>](8 SPACES}[<5>]
     {2 SPACES}[<6>]{6 SPACES}{RED}
     {2 SPACES}[<I>][<F>] [<E>][<6>]
     {5 SPACES}[<5>] [<6>]{12 SPACES}";
1300 PRINT"{8 SPACES}[<5>]{2 SPACES)
     [<6>](6 SPACES}{RED}{2 SPACES}{OFF}
      {RVS}[<K>]{2 SPACES}[<6>]
     {5 SPACES}[<5>] [<6>](12 SPACES)";
1310 PRINT"[<6>]{RVS}";
1320 FOR I=0 TO 8:PRINT"{40 SPACES}";:NE
     XT
1330 FOR I=1 TO 8 : L=1024+23*40+I*4 :PO
     KE L,114:POKEL+54272,0:NEXT
1340 FOR I=0 TO 39:POKE 1024+24*40+1,160
     :POKE 55296+24*40+I,13:NEXT
1350 PRINT"{HOME}
1360 PRINT"{BLK}
1370 RETURN
1380 I=15872:IFPEEK(I+1)=96THENFORI=1T06
     4*6+2:READA:NEXT:RETURN
1390 READ A:IF A=256 THEN 1410
1400 POKE I,A:I=I+1:GOTO 1390
1410 FOR I=0 TO 63:POKE 254*64+I,PEEK(24
     9*64+I):NEXT:RETURN
1420 DATA 0,96,0,0,113,224,0
1430 DATA 121,176,0,125,252,117,193
1440 DATA 192,127,255,192,113,255,128
1450 DATA 0,252,0,0,24,0,0
1460 DATA 24,0,0,102 01,0,102
1470 DATA 0,0,0,0,0,0,0
1480 DATA 0,0,0,0,0,0,0
1490 DATA 0,0,0,0,0,0,0
1500 DATA 0,0,0,0,0,0,0
1510 DATA 0,0,0,0,0,1,224
1520 DATA 0,1,176,0,127,252,117
1530 DATA 193,192,127,255,192,113,255
1540 DATA 128,0,252,0,0,24,0
1550 DATA 0,24,0,0,102,0,0
1560 DATA 102,0,0,0,0,0,0
1570 DATA 0,0,0,0,0,0,0
1580 DATA 0,0,0,0,0,0,0
1590 DATA 0,0,0,0,0,0,0
1600 DATA 0,0,0,0,0,0,1
1610 DATA 224,0,1,176,112,127,252
1620 DATA 127,221,192,115,185,192,1
1630 DATA 179,128,0,172,0,0,24
1640 DATA 0,0,24,0,0,102,0
1650 DATA 0,102,0,0,0,0,0
1660 DATA 0,0,0,0,0,0,0
1670 DATA 0,0,0,0,0,0,0
1680 DATA 0,0,0,0,0,0,0
1690 DATA 0,0,0,0,96,0,0
1700 DATA 113,224,0,121,176,0,125
1710 DATA 252,117,193,192,127,255,192
1720 DATA 113,255,128,0,252,0,0
1730 DATA 0,0,0,0,0,0,0
1740 DATA 0,0,0,0,0,0,0
1750 DATA 0,0,0,0,0,0,0
1760 DATA 0,0,0,0,0,0,0
1770 DATA 0,0,0,0,0,0,0
1780 DATA 0,0,0,0,0,0,0
1790 DATA 0,1,224,0,1,176,0
1800 DATA 127,252,117,193,192,127,255
1810 DATA 192,113,255,128,0,252,0
1820 DATA 0,0,0,0,0,0,0
1830 DATA 0,0,0,0,0,0,0
1840 DATA 0,0,0,0,0,0,0
1850 DATA 0,0,0,0,0,0,0
1860 DATA 0,0,0,0,0,0,0
1870 DATA 0,0,0,0,0,0,0
1880 DATA 0,0,1,224,0,1,176
1890 DATA 112,127,252,127,221,192,115
1900 DATA 185,192,1,179,128,0,172
1910 DATA 0,0,112,0,0,0,0
1920 DATA 0,0,0,0,0,0,0
1930 DATA 0,0,0,0,0,0,0
1940 DATA 0,0,0,0,0,0,0
1950 DATA 0,0,0,0,0,0,0
1960 DATA 0,0,0,0,0,0,0,256
1970 I=1
1980 READ W$(I):IFW$(I)="*"THENN=I-1:RET
     URN
1990 I=I+1:GOTO1980
2000 POKEV,XAND255:POKEV+16,PEEK(V+16)AN
     D2540R-(X>255):POKE V+1,Y:POKE2040,
     S
2010 IF X=0 THEN POKE V+21,PEEK(V+21)OR1
2020 X=X+3:IFX>344 THEN X=0:POKEV+21,PEE
     K(V+21)AND254
2030 Y=Y-1+RND(1)*2:IFY>100THENY=99
2040 IF Y<50 THEN Y=50
2050 S=S+1:IFS=254THENS=251
2060 RETURN
2070 DX=INT(P+13*(P>13))*16+24+40
2080 DY=173+INT(P/14)*24:IF S>250 THEN S
     =S-3
2090 POKEV,XAND255:POKEV+16,PEEK(V+16)AN
     D2540R-(X>255):POKEV+1,Y:POKE2040,S
2100 IF X=0 THEN POKE V+21,PEEK(V+21)OR1
2110 FLAG=0
2120 IFABS(X-DX)>2THENX=X+3:FLAG=1:IFX>3
     44THENX=0:POKEV+21,PEEK(V+21)AND254
2130 IF Y<DY THEN Y=Y+2:FLAG=1
2140 S=S+1:IFS=251THENS=248
2150 IF FLAG THEN 2090
2160 X=DX:Y=DY
2170 POKEV,XAND255:POKEV+16,PEEK(V+16)AN
     D2540R-(X>255):POKEV+1,Y:POKE2040,2
     49
2180 POKE 56334,PEEK(56334)AND254
2190 POKE 1,PEEK(1)AND251
2200 FOR I=0 TO 7
2210 B=PEEK(53248+8*P+I)
2220 FOR J=248 TO 250
2230 POKE J*64+40+I*3,B
2240 NEXT J,I
2250 POKE 1,PEEK(1)OR4
2260 POKE 56334,PEEK(56334)OR1
2270 PRINT"{HOME}{17 DOWN}{8 RIGHT}";
2280 FOR I=2 TO 14
2290 PRINTMID$(L$,I,1)"{RIGHT}";
2300 NEXT
2310 PRINT:PRINT"{DOWN}(8 RIGHT)";
2320 FOR I=15TO 27
2330 PRINTMID$(L$,I,1)"{RIGHT}";
2340 NEXT
2350 DX=160-8*LEN(G$):DY=69
2360 POKEV,XAND255:POKEV+16,PEEK(V+16)AN
     D2540R-(X>255):POKEV+1,Y:POKE2040,S
2370 IF X=0 THEN POKE V+21,PEEK(V+21)OR1
2380 FLAG=0
2390 IFABS(X-DX)>2THENX=X+3:FLAG=1:IFX>3
     44THEN X=0:POKEV+21,PEEK(V+21)AND25
     4
2400 IF Y>DY THEN Y=Y-2:FLAG=1
2410 S=S+1:IFS=251THENS=248
2420 IF FLAG THEN 2360
2430 X=DX:Y=DY
2440 POKEV,XAND255:POKEV+16,PEEK(V+16)AN
     D2540R-(X>255):POKEV+1,Y:POKE2040,2
     49
2450 PRINT"{HOME}{4 DOWN}"SPC(18-LEN(G$)
     );
2460 FOR I=1TO LEN(G$)
2470 IF MID$(G$,I,1)=A$ THEN PRINT A$;:R
     F=RF-1:IFRF=0 THEN GOSUB 2560
2480 IF MID$(G$,I,1)<>A$ THEN PRINT"
     {RIGHT}";
2490 PRINT"{RIGHT}";
2500 IF RF=0 THEN I=100:GOTO2540
2510 FOR J=0 TO 15:X=X+1:S=S+1:IFS=251TH
     ENS=248
2520 POKEV,XAND255:POKEV+16,PEEK(V+16)AN
     D2540R-(X>255):POKE2040,S
2530 NEXT J
2540 NEXT I
2550 RETURN
2560 FOR K=0 TO 7
2570 FOR J=248 TO 250
2580 POKE J*64+40+K*3,0
2590 NEXT J,K
2600 RETURN
2610 PRINT"{CLR}{7 DOWN}{BLK}DO YOU WISH
      TO PLAY AGAIN (Y/N) ?"
2615 POKE V+21,PEEK(V+21)AND254
2620 PRINT"{10 DOWN}YOU MISSED THIS MANY
      :"
2630 GETA$:IFA$<>"N"AND A$<>"Y"THEN2630
2640 IF A$="Y"THENPOKE V+21,0:RUN110
2650 END
2660 POKE 53281,0:POKE 53280,0
2670 PRINT"{CLR}{YEL}{13 SPACES}INSTRUCT
     IONS
2680 PRINT"{2 DOWN}{WHT}{4 SPACES}CHOOSE
      LETTERS TO GUESS THE WORD.
2690 PRINT"{DOWN}IF YOU CHOOSE A WRONG L
     ENTER, THE BIRD
2700 PRINT"{DOWN}WILL LAND ON ITS PERCH.
2710 PRINT"{DOWN}{4 SPACES}WHEN ALL THE
     PERCHES ARE FULL, OR
2720 PRINT"{DOWN}YOU GUESSED THE WORD, T
     HE GAME IS OVER
2730 PRINT"{2 DOWN}{4 SPACES}YOU CAN HIT
      THE "CHR$(34)"←"CHR$(34)" KEY ANY
     TIME TO
2740 PRINT"{DOWN}GUESS THE WORD. IF YOU
     GET IT WRONG,{DOWN}{4 SPACES}YOU LO
     SE.
2750 PRINT"{3 DOWN}{9 RIGHT}{YEL}HIT A K
     EY TO BEGIN`
2760 GETA$:IFA$=""THEN2760
2770 RETURN
2780 DATA HAPPY,BRIDGE,FAMILY,CHILDREN
2790 DATA WINDOW,TRAIN,DWARF,BIRDS
2800 DATA SUPERMAN,CONCERT,PEOPLE,MAGIC
2810 DATA SPACE,SCIENCE,PLANETS,GALAXY,S
     TARS
2820 DATA ROOMS,TEACHER,CHALK,BLACKBOARD
2830 DATA SCREEN,COMPUTER,KEYBOARD,PROGR
     AM
2840 DATA SPELLING,WORDS,COLORS,LETTERS
2850 DATA MARKET,STREETS,SQUARE,TRIANGLE
2860 DATA MOVIE,SPACESHIP,LASER,AIRPLANE
     ,BOAT
2870 DATA STICK,ROCK,PAPER,WIN,PLACE,SHO
     W
2880 DATA CHANNEL,EXECUTIVE,MONEY,SHIRT
2890 DATA QUIET,LOUD,BILLBOARD,YACHT,MOT
     ORCYCLE,*

64 version
The bird carries an L to complete the spelling and end the
game in "mystery Spell." 64 version


Program 3: Mystery Spell - VIC Version
by Gregg Peele, Editorial Programmer

100 DIMYA$(21):GOSUB1020:DIMW(20)
105 POKE36879,30
110 PRINT"{CYN}{CLR} {DOWN}{9 SPACES)
    [<5 +>]
120 PRINT"{14 SPACES}[c4 +3
130 PRINT"{2 DOWN}
140 PRINT"
150 PRINT"{GRN}{2 SPACES}{RVS} {OFF}.
    {8 SPACES}{BLK} [<2 G>]{2 SPACES)
    {GRN}
160 PRINT" {RVS}[<K>] {OFF}[<J>]
    {5 SPACES}{RED} NM{BLK}[<2 G>] {GRN)
     {RVS}[<J>] [<L>]{OFF}
170 PRINT" {RVS}{<J>] [<L>]{OFF}
    {4 SPACES}{RED} N{2 SPACES}M{BLK}
    [<G>] {GRN} {RVS}{3 SPACES}{OFF}
180 PRINT" {RVS}[<G>] [<N>]{OFF}
    {3 SPACES}{RED} N[<4 O>]M{GRN} {RVS}
    [<J>]{3 SPACES}[<L>]{OFF}
190 PRINT" {RVS}{3 SPACES}{OFF}
    {3 SPACES}{RED} B{4 SPACES}B{GRN)
    {RVS}{5 SPACES}{OFF}
200 PRINT" {BLK} {RVS} {OFF}{3 SPACES}
    {RED}{2 SPACES}B{4 SPACES}B{GRN}
    {3 SPACES}{RVS}{BLK} {OFF}
210 PRINT"{BLK}{2 SPACES}{RVS} {OFF}
    {3 SPACES}{RED}{2 SPACES}B{4 SPACES}
    B{2 SPACES}{BLK} {RVS} {OFF}
220 PRINT"{6 SPACES}{RED}{2 SPACES}B
    {4 SPACES}B
225 PRINT"{3 SPACES}{RVS}{BLK}MYSTERY
    {2 SPACES}SPELL{OFF}"
230 PRINT"{3 DOWN}";H$
240 T=7680:W=0
250 IFW<22THENT=T+1:IFT>7694ANDT<8000 TH
    ENT=T+21:IFT>7750THENT=T+1
260 W=W+1:IFW>44THENW=0:GOTO250
270 IFW>22THENT=T-20:IFT<7701THEN240
280 TO=PEEK(T):Tl=PEEK(T+1):T2=PEEK(T+2)
290 C0=PEEK(T+30720):Cl=PEEK(T+30721):C2
    =PEEK(T+30722)
300 POKET,74:POKET+1,81:POKET+2,75
310 POKET+30720,0:POKET+30721,0:POKET+30
    722,0
320 FORD=1TO100:NEXTD
330 POKET,67:POKET+2,67
340 FORD=1TO100:NEXTD
350 POKET,T0:POKET+1,TI:POKET+2,T2
360 POKET+30720,C0:POKET+30721,Cl:POKET+
    30722,C2
1000 IFW=30THENGOSUB2000
1010 GOTO250
1020 PRINT"{CLR}ENTER YOUR OWN WORDS
     {2 SPACES}Y OR N"
1030 H$={2 SPACES}"{HOME}{BLK}{12 DOWN)
     {10 RIGHT}{RVS}..{DOWN}{2 LEFT}JK
     {OFF}"
1040 S$={2 SPACES}"{HOME}{BLK}{12 DOWN)
     {10 RIGHT}{RVS}..{DOWN}{2 LEFT}UI
     {OFF}"
1050 GETX$:IFX$<>"N"ANDX$<>"Y"THEN1050
1060 IFX$="N"THEN1080
1070 FORT=1TO20:PRINT"WORD#";T;:INPUTYA$
     (T):NEXT:GOTO1120
1080 FORT=1TO20:READA$:YA$(T)=A$:NEXT
1090 DATA GRAPES, ORANGES, POTATOES, ONIONS
     ,BROCCOLI
1100 DATA BEANS,TOMATO,SPINACH,CUCUMBERS
     ,CARROT,LETTUCE,RADISHES
1110 DATA APPLE,CORN,PEAR,PEACH,GRAPEFRU
     IT,COCONUT,KUMQUAT,BANANA
1120 W$=YA$(RND(1)*20+1):RETURN
2000 FORT=1TO300:NEXT:FORT=8010TO8010+22
     :POKET,32:NEXT
2010 GOSUB 2210
2020 L$=" ABCDEFGHIJKLMNOPQRSTUVWXYZ"
2030 PRINT"{HOME}{16 DOWN}";:FORT=1TO10:
     PRINTMID$(L$,T,1);" ";:NEXT
2040 PRINT"{DOWN}{4 RIGHT}";:FORT=11TO19
     :PRINTMID$(L$,T,1);" ";:NEXT
2050 PRINT"{DOWN}{5 RIGHT}";:FORT=20TO27
     :PRINTMID$(L$,T,1);" ";:NEXT
2060 PRINT"{HOME}(3 DOWN}";G$;"{HOME}
     {22 DOWN}(5 LEFT}";
2062 IFWR>OTHENFORY=OTOWR:PRINT"
     {3 RIGHT}";:NEXT:PRINT"{LEFT}JQK";
2065 IFWR=7THENGOTO 5000
2070 IF COUNT<>LEN(W$)THEN2080
2075 FORT=1TO20:PRINT"{HOME}YOU WIN
     {7 LEFT}";:FORD=1TO200
2078 NEXTO:PRINT"{9 SPACES}";:FORZ=1TO20
     0:NEXTZ:NEXTT:PRINTH$;:GOTO5000
2080 PRINT"{HOME}{4 DOWN}{25 SPACES}";:G
     ETA$:IFA$<"A"ORA$>"Z"THEN2030
2090 P=ASC(A$)-64
2100 IF MID$(L$,P+1,1)<>" "THEN2120
2110 PRINT"{HOME}{4 DOWN}LETTER ALREADY
     CHOSEN";:FORT=1TO600:NEXT:GOT02080
2120 L$=LEFT$(L$,P)+" "+MID$(L$,P+2):PRI
     NTS$:FL=1:GOSUB3000
2130 FOR I=1 TO LEN(W$)
2140 IF MID$(W$,I,1)<> A$ THEN2180
2145 FLAG=0
2150 G$=LEFT$(G$,I)+MID$(W$,I,1)+MID$(G$
     ,I+2)
2160 COUNT=COUNT+1:PRINTHS:GOTO2180
2170 IF MID$(W$,I,1)<>" "ANDMID$(W$,I,1)
     =LEFRT$(A$,1)THENPRINTH$
2180 NEXT I
2185 WR=WR+FL
2190 GOTO 2060
2200 RETURN
2210 G$=" "
2220 FOR I=1 TO LEN(W$):G$=G$+"-":W(I)=0
     :NEXT
2230 RETURN
3000 FORG=7878TO8164STEP22
3010 Y0=PEEK(G):Y1=PEEK(G+1):Y2=PEEK(G+2
     )
3020 Z0=PEEK(G+30720):Z1=PEEK(G+30721):Z
     2=PEEK(G+30722)
3030 POKEG+30720,0{3 SPACES}:POKEG+30721
     ,0:POKEG+30722,0
3040 POKEG,74:POKEG+1,81:POKEG+2,75
3055 FORT=1TO100:NEXT
3060 POKEG,67:POKEG+2,67:FORT=1TO100:NEX
     T
3070 IFG>8160THENRETURN
3090 POKEG,Y0:POKEG+1,YI:POKEG+2,Y2
3100 POKEG+30720,Z0:POKEG+30721,Z1:POKEG
     +30722,Z2
3115 FORR=GTOG+20
3116 IFPEEK(R)=PTHENM=R
3117 NEXTR
3120 IFM>G+ITHENG=G-21:GOTO3126
3125 IFM=G+ITHENG=G-22:J=J+1
3126 IFJ=5THENM=0:IFFL=0THENWR=WR+1:J=0:
     RETURN
3127 IFJ=5THENM=0:J=0:RETURN
3128 NEXT
3129 M=0:J=0
3130 NEXT:IFFL=0THENWR=WR+1
3140 RETURN
5000 PRINT"{HOME}THE WORD WAS{HOME}
     {3 DOWN}{RIGHT}";:FORT=ITOLEN(W$):P
     RINTMID$(W$,T,1);:FORU=1T0200:NEXT:
     NEXT
5010 PRINT"{HOME}{5 DOWN}PLAY AGAIN?Y OR
     N"
5011 GETM$:IFM$=""THEN5011
5012 IFM$="Y"THENRUN
5013 IFM$<>"N"THEN5011
5015 PRINT"{CLR}":END

VIC version
The bird swoops down to get the final letter for a correctly
spelled word in the VIC version of "Mystery Spell."