Recall

Type
Game
Category
Memory game (Concentration with a rebus-style hidden message)
Author
Barry Kolbe
Published in
Antic, May 1988 (Vol. 7, No. 1)
Year
1988
Language
Atari BASIC
Requirements
48K RAM, Atari BASIC, one or two joysticks; disk or cassette
A black GRAPHICS 2 board of numbers 1 to 30 in five rows, with a cream box cursor around 24 and a text window reading Pick two numbers CONTROL G to guess, Current player 1, SCORE 1: 0 2: 0

About the program

Recall is an Atari 8-bit version of the TV game show Concentration. It was the "Bonus Game" in Antic's May 1988 issue, a month after the magazine had printed a GFA BASIC version for the ST. Barry Kolbe, a high-school maths teacher from Madison, Wisconsin, who also co-wrote the October 1987 Antic Spelling Checker, wrote this one in Atari BASIC.

The board has 30 numbered squares, each hiding one of 15 pairs of little pictures, such as a boat, a ring and a heart. Choose two numbers. If the pictures match, they're replaced by two letters of a hidden phrase, you score a point, and you go again. If they don't match, they flip back and it's your opponent's turn. Like the show, the real game is reading the phrase before it's fully uncovered: press CTRL-G at the start of your turn to guess. A correct guess wins all the points still on the board.

What you need

A 48K Atari 8-bit with Atari BASIC, and one joystick (two for a two-player game, the second in port 2). The listing here also runs under the Altirra BASIC replacement used by many emulators (see Changes from the published listing).

Typing it in

The magazine marked lines 1650 (the display-list interrupt), 1680 (a character-set copy routine), 1720 (the cursor shape) and 1760 (a player-movement routine) as hard to type, and offered a second listing to write them to LINES.LST. This disk listing includes them and has no TYPO II codes. In the notation, {inv}…{/inv} is inverse (Atari key), {CTRL-x} is CTRL plus the key, and {DEL CHAR} and {CLEAR} are ESC followed by CTRL-DELETE or SHIFT-CLEAR. The 15 pictures are the DATA in lines 1430–1570, eight bytes each.

How to play

RUN it and wait for "please wait" to finish. Press SELECT to choose one or two players and START to begin. Move the box cursor with the joystick and press the button to turn a square over, then pick a second one. Against the computer, the Atari moves first, and as Kolbe warned, it has an infallible memory. After the last pair, or a correct guess, the winner and the phrase are shown. START plays again and OPTION quits.

The ten phrases are in lines 1900–1990 ("THE HOUND OF THE BASKERVILLES", "ANTIC THE ATARI RESOURCE" and so on). Replace them or add more, keeping the lines 10 apart starting at 1900, under 31 letters and without punctuation, and change the 10 in INT(RND(0)*10) in line 1850 to the number of phrases. If you hold SELECT while typing RUN, the BREAK key stays enabled for debugging (line 40).

How it works

  • Two strings, one board. MATCH$ holds the picture behind each square, as character codes (163–173 and 187–190, the redefined shapes) shuffled into position by swapping (lines 630–670). T$ holds the phrase, centred in 30 characters and converted into the colour-shifted letter codes used on a GRAPHICS 2 screen (lines 1860–1880). A matched pair prints T$ at both positions.
  • The computer's memory. Every square anyone turns over is copied into CG$. On its turn the computer first scans CG$ for any two equal pictures it has seen (lines 1140–1180). For its second pick it looks for the partner of the square it just turned over (lines 1380–1410). Only otherwise does it guess at random.
  • Cursor and colours. The box cursor is player 0, moved by the routine in MOVX$, and a display-list interrupt (DLI$), switched on for one line of the board's display list, changes colours partway down the screen.
  • Guess key. Line 230 checks the keyboard code in location 764 for 189, which is CTRL-G.

Variations to try

  • Make the computer forgetful, so that some of the time it guesses instead of using its memory: add 1135 IF RND(0)<0.3 THEN POKE 1791,0:GOTO 1250.
  • Draw your own pictures by editing the DATA in lines 1430–1570.

Changes from the published listing

One change, so the program also runs under Altirra BASIC, the free replacement BASIC built into many emulators. Altirra BASIC adds a command called MOVE, so it rejected the published lines that use that word as the start of a variable name. The variable is renamed everywhere in the program. The new name is the same length, so the memory layout is unchanged and the program behaves exactly as published on genuine Atari BASIC. If you type it in from the magazine, the original names work fine on a real Atari.

Published Now Lines
MOVE$ MOVX$ 190, 430, 1330, 1630, 1760

Listing

10 REM RECALL
20 REM BY BARRY KOLBE
30 REM (c)1988, ANTIC PUBLISHING
40 DEBUG=PEEK(53279)=5
100 GOSUB 1610
110 GOSUB 890:GRAPHICS 2:POKE 756,CHSET:POKE 559,46:POKE 752,1:GOSUB 525
120 DL=PEEK(560)+256*PEEK(561)+14
130 POKE DL,PEEK(DL)+128:POKE 513,INT(ADR(DLI$)/256):POKE 512,ADR(DLI$)-256*PEEK(513):POKE 54286,192
140 X=1:Y=0:POSITION X,Y:? #6;" 1  2  3  4  5  6";:Y=Y+2
150 POSITION X,Y:? #6;" 7  8  9 10 11 12";:Y=Y+2
160 POSITION X,Y:? #6;"13 14 15 16 17 18";:Y=Y+2
170 POSITION X,Y:? #6;"19 20 21 22 23 24";:Y=Y+2
180 POSITION X,Y:? #6;"25 26 27 28 29 30";
190 PLAYER=0:IF OPP=1 THEN PLAYER=1:X=USR(ADR(MOVX$),ADR(PDEF$),PL0,YP):POKE 53248,XP
195 POKE 704,96*PLAYER+30
200 POKE 656,0:POKE 657,1:? "Pick two numbers CONTROL G to guess";:POKE 656,1:POKE 657,10
210 ? "Current player ";PLAYER+1:IF XG=1 THEN GOSUB 575
211 GOSUB 525
220 POKE 656,2:POKE 657,5:? "SCORE  1: ";SC(1);:POKE 657,25:? "2: ";SC(2)
230 IF PEEK(764)=189 THEN 970
240 IF OPP=1 AND PLAYER THEN GOSUB 1120:XP=TX:YP=TY:GOTO 260
250 GOSUB 430:GOSUB 1060
260 F=((XP-52)/24)+1+((YP-14)/16)*6
270 IF DONE(F)=1 THEN 230
280 CG$(F,F)=MATCH$(F,F)
290 SY=INT((F-1)/6):SX=F-SY*6
300 POSITION 1+SX*3-3,SY*2:? #6;" ";MATCH$(F,F)
310 IF OPP=1 AND PLAYER THEN GOSUB 1350:XP=TX:YP=TY:GOTO 330
320 GOSUB 430:GOSUB 1060
330 S=((XP-52)/24)+1+((YP-14)/16)*6
340 SY1=INT((S-1)/6):SX1=S-SY1*6
350 IF F=S THEN 310
360 IF DONE(S)=1 THEN 310
370 CG$(S,S)=MATCH$(S,S)
380 POSITION 1+SX1*3-3,SY1*2:? #6;" ";MATCH$(S,S)
390 IF MATCH$(F,F)=MATCH$(S,S) THEN DONE(F)=1:DONE(S)=1:CG$(F,F)=" ":CG$(S,S)=" ":GOTO 720
400 GOSUB 1030:PLAYER=PLAYER+1:XG=1:IF PLAYER=2 THEN PLAYER=0
410 GOSUB 530:GOSUB 550:GOTO 200
420 REM STICK MOVE
430 X=USR(ADR(MOVX$),ADR(PDEF$),PL0,YP):POKE 53248,XP
440 FOR I=1 TO 50:NEXT I
450 IF PEEK(764)=189 THEN GOTO 970
460 ST=PEEK(632+PLAYER):IF ST=14 THEN YP=YP-16:IF YP<=0 THEN YP=78
470 IF ST=13 THEN YP=YP+16:IF YP>=94 THEN YP=14
480 IF ST=11 THEN XP=XP-24:IF XP<=44 THEN XP=172
490 IF ST=7 THEN XP=XP+24:IF XP>=188 THEN XP=52
500 IF PEEK(644+PLAYER)=1 THEN 430
510 GOSUB 525
520 RETURN
525 POKE 77,0:IF  NOT (DEBUG) THEN POKE 16,112:POKE 53774,112
526 RETURN
530 M$=STR$(F):IF F<10 THEN M$="  ":M$(2)=STR$(F)
540 POSITION 1+SX*3-3,SY*2:? #6;M$;:RETURN
550 M$=STR$(S):IF S<10 THEN M$="  ":M$(2)=STR$(S)
560 POSITION 1+SX1*3-3,SY1*2:? #6;M$:RETURN
570 GOSUB 530:GOTO 200
575 FOR XG=14 TO 0 STEP -1:SOUND 0,50,14,XG:NEXT XG:POKE 704,96*PLAYER+30:RETURN
580 REM
590 REM RESTART
610 GOSUB 1850
620 MATCH$=BL$:CG$=BL$
630 FOR I=1 TO 30:RN(I)=I:NEXT I
640 FOR I=1 TO 30:X=INT(RND(0)*30)+1:B=RN(I):RN(I)=RN(X):RN(X)=B:NEXT I
650 FOR I=1 TO 15:MATCH$(RN(I),RN(I))=CHR$(I+162):MATCH$(RN(15+I),RN(15+I))=CHR$(I+162)
660 IF I>11 THEN MATCH$(RN(I),RN(I))=CHR$(175+I):MATCH$(RN(15+I),RN(15+I))=CHR$(I+175)
670 NEXT I
680 FOR I=1 TO 30:DONE(I)=0:NEXT I:XP=52:YP=14:SC(1)=0:SC(2)=SC(1):RETURN
690 REM
700 REM WINNING
720 GOSUB 1040:POSITION 1+SX*3-3,SY*2:? #6;" ";T$(F,F);:POSITION 1+SX1*3-3,SY1*2:? #6;" ";T$(S,S);
730 SC(PLAYER+1)=SC(PLAYER+1)+1
740 IF SC(1)+SC(2)<>15 THEN 200
750 POKE 54286,64:FOR I=10 TO 250 STEP 10:POKE 710,I:POKE 712,250-I:SOUND 0,150+I,10,8
760 FOR J=1 TO 15:NEXT J:SOUND 0,0,0,0:NEXT I
770 POKE 53248,0:GRAPHICS 0:POKE 752,1:POSITION 4,4:? "The Winning player is ";
780 PLAYER=1:IF SC(2)>SC(1) THEN PLAYER=2
790 ? PLAYER:POSITION 4,8:? "THE PUZZLE IS ":POSITION 4,10:? A$
800 POSITION 4,12:? "SCORES  1: ";SC(1);"    2: ";SC(2)
810 POSITION 4,16:? "Press {inv}START{/inv} to play again"
820 POSITION 4,18:? "Press {inv}OPTION{/inv} to quit"
830 IF PEEK(53279)=6 THEN 110
840 IF PEEK(53279)=3 THEN GRAPHICS 0:END
850 GOTO 830
860 REM
870 REM INTRO
890 GRAPHICS 17:POKE 708,30:POKE 709,202:POKE 710,152:POKE 711,14:POKE 712,50
895 POSITION 4,1:? #6;"{inv}*{/inv} {inv}RECALL{/inv} {inv}*{/inv}":OPP=2
900 GOSUB 610:GOSUB 950
910 POSITION 2,15:? #6;"{inv}select{/inv} to choose":POSITION 2,17:? #6;"{inv}start{/inv} to begin"
920 I=PEEK(53279):IF I=6 THEN RETURN
930 IF I=5 THEN GOSUB 1050:OPP=OPP+1:IF OPP>2 THEN OPP=1
940 GOSUB 950:GOTO 920
950 IF OPP=1 THEN POSITION 2,7:? #6;"  {inv}TWO PLAYER{/inv}  ":POSITION 2,9:? #6;"> ONE PLAYER <":RETURN
960 POSITION 2,7:? #6;"> TWO PLAYER <":POSITION 2,9:? #6;"  {inv}ONE PLAYER{/inv}  ":RETURN
970 REM GUESS
980 POKE 752,0:POKE 764,255:? "{CLEAR}":POKE 656,1:POKE 657,2:? "GUESS ";:POP
990 POKE 656,2:POKE 657,2:INPUT R$:IF R$=A$ THEN ? "CORRECT":GOTO 1020
1000 PLAYER=PLAYER+1:IF PLAYER=2 THEN PLAYER=0
1010 POKE 752,1:? "{CLEAR}":GOTO 200
1020 SC(PLAYER+1)=SC(PLAYER+1)+15-(SC(1)+SC(2)):GOTO 750
1030 REM DELAY
1040 FOR I=1 TO 200:NEXT I:GOSUB 525:RETURN
1050 REM SOUND
1060 SOUND 0,200,10,8:FOR I=1 TO 50:NEXT I:SOUND 0,0,0,0:RETURN
1070 IF PEEK(764)=255 THEN 1070
1080 POKE 764,255:RETURN
1090 REM DELAY
1100 FOR I=1 TO 20:NEXT I:RETURN
1110 REM
1120 REM COMPUTER
1140 POKE 1791,0:FOR I=1 TO 29:FOR J=I+1 TO 30
1150 IF CG$(I,I)=" " THEN 1180
1160 IF CG$(J,J)=CG$(I,I) THEN CF=I:CS=J:POKE 1791,1:GOTO 1190
1170 NEXT J
1180 NEXT I:GOTO 1250
1190 YF=INT((CF-1)/6):XF=CF-YF*6-1:GOTO 1270
1200 POKE 1791,0:FOR I=1 TO 30:IF DONE(I)=0 THEN CF=I:GOTO 1220
1210 NEXT I:GOTO 1250
1220 FOR J=30 TO I+1 STEP -1:IF DONE(J)=0 THEN CS=J:POKE 1791,1:GOTO 1190
1230 NEXT J
1240 REM RANDOM MOVE
1250 XF=INT(RND(0)*6):YF=INT(RND(0)*5):CF=YF*6+XF:IF  NOT DONE(CF) AND SC(1)+SC(2)<8 THEN 1280
1260 IF DONE(CF) THEN 1200
1270 REM MOVE
1280 TX=52+24*XF:TY=16*YF+14
1290 IF TX=XP THEN 1310
1300 FOR J=XP TO TX STEP SGN(TX-XP)*24:POKE 53248,J:GOSUB 1090:NEXT J
1310 IF YP=TY THEN RETURN
1320 FOR J=YP TO TY STEP SGN(TY-YP)*16:GOSUB 1330:GOSUB 1090:NEXT J:RETURN
1330 X=USR(ADR(MOVX$),ADR(PDEF$),PL0,J):RETURN
1340 REM
1350 REM COMPUTER 2ND MOVE
1370 IF PEEK(1791)=1 THEN CF=CS:GOTO 1190
1380 FOR I=1 TO 30
1390 IF I=F THEN 1410
1400 IF CG$(I,I)=MATCH$(F,F) THEN CF=I:GOTO 1190
1410 NEXT I
1420 GOTO 1250
1430 DATA 4,28,52,116,12,255,126,60
1440 DATA 0,0,120,100,255,255,102,0
1450 DATA 0,126,16,158,249,31,0,0
1460 DATA 24,60,126,255,153,153,255,0
1470 DATA 24,60,126,255,255,24,24,24
1480 DATA 16,56,40,56,56,56,124,186
1490 DATA 66,36,24,126,66,66,66,126
1500 DATA 0,54,127,127,62,28,8,0
1510 DATA 0,24,60,126,126,60,24,0
1520 DATA 8,12,79,159,188,248,124,0
1530 DATA 126,66,66,126,126,126,126,0
1540 DATA 0,0,1,10,28,40,64,0
1550 DATA 56,108,124,56,48,56,48,0
1560 DATA 60,60,24,60,102,66,102,60
1570 DATA 0,60,36,255,255,255,255,255
1580 REM
1590 REM INIT
1610 GRAPHICS 18:POSITION 7,2:? #6;"{inv}RECALL{/inv}":POSITION 3,4:? #6;"by barry kolbe"
1620 POSITION 5,6:? #6;"{inv}please wait{/inv}":GOSUB 525
1630 DIM BL$(30),M$(2),SC(2),A$(30),R$(30),T$(30),MATCH$(30),RN(30),CG$(30),CMOV$(35),MOVX$(60),PDEF$(12)
1640 DIM DONE(30),DLI$(20)
1650 DLI$="H{inv}){/inv}{CTRL-,}{inv}{CTRL-M}{/inv}{CTRL-J}{inv}T{CTRL-M}{/inv}{CTRL-X}{inv}P){/inv}{CTRL-J}{inv}{CTRL-M}{/inv}{CTRL-W}{inv}P{/inv}h@"
1670 BL$="                                ":POKE 752,1:SC(1)=0:SC(2)=0
1680 CMOV$="hh{inv}{CTRL-E}L{/inv}h{inv}){CTRL-.}{CTRL-E}N){/inv}{CTRL-,}{inv}{CTRL-E}M{CTRL-E}K"{/inv}{CTRL-C}{inv} {/inv}{CTRL-,}{inv}1M{CTRL-Q}KHPyfLfNJ{/inv}{CTRL-P}{inv}p{/inv}{CTRL-.}"
1710 POKE 752,1:PMBASE=PEEK(106)-16:PL0=PMBASE*256+512
1720 PDEF$="{DEL CHAR}{DEL CHAR}{inv}{CTRL-B}{CTRL-B}{CTRL-B}{CTRL-B}{CTRL-B}{CTRL-B}{CTRL-B}{CTRL-B}{/inv}{DEL CHAR}{DEL CHAR}"
1740 POKE 623,1:POKE 54279,PMBASE:POKE 53277,3:POKE 559,46:POKE 704,78:POKE 53256,3
1750 XP=52:YP=14:POKE 705,148:POKE 706,148
1760 MOVX$="hh{inv}{CTRL-E}L{/inv}h{inv}{CTRL-E}K{/inv}h{inv}{CTRL-E}N{/inv}h{inv}{CTRL-E}Mj{/inv}hh{inv}{CTRL-E}T){/inv}{CTRL-,}{inv}({CTRL-Q}M{CTRL-H}P{CTRL-;} {/inv}{CTRL-,}{inv}{CTRL-D}U$U1K$T{CTRL-Q}MfTfU%UI{/inv}{CTRL-L}{inv}Pn{/inv}{CTRL-.}"
1790 CHSET=PEEK(106)-20:MYCH=CHSET*256:RESTORE 1430
1800 X=USR(ADR(CMOV$),MYCH)
1810 FOR I=3 TO 13:FOR J=0 TO 7:READ B
1820 POKE MYCH+I*8+J,B:NEXT J:NEXT I
1830 FOR I=27 TO 30:FOR J=0 TO 7:READ B
1840 POKE MYCH+I*8+J,B:NEXT J:NEXT I:POKE 756,CHSET:RETURN
1850 I=INT(RND(0)*10):RESTORE 1900+I*10
1860 READ A$:T$=BL$(1,30):A=LEN(A$)-1:X=INT((30-A)/2):X=X+(X=0):T$(X,X+A)=A$
1870 FOR I=X TO X+A:T=ASC(T$(I,I)):T=T+160:IF T=192 THEN 1890
1880 T$(I,I)=CHR$(T)
1890 NEXT I:XP=52:YP=14:RETURN
1900 DATA A STITCH IN TIME SAVES NINE
1910 DATA THE MERCHANT OF VENICE
1920 DATA ROSES ARE RED VIOLETS ARE BLUE
1930 DATA CHARGE OF THE LIGHT BRIGADE
1940 DATA THE HOUND OF THE BASKERVILLES
1950 DATA ANTIC THE ATARI RESOURCE
1960 DATA HE WHO LAUGHS LAST LAUGHS BEST
1970 DATA THE WALRUS AND THE CARPENTER
1980 DATA DECLARATION OF INDEPENDENCE
1990 DATA ALEXANDER THE GREAT

Download

The original program from the Antic disk, to LOAD or ENTER instead of typing it: RECALL.BAS.

Credits