A.N.A.L.O.G. ISSUE 11 / MAY 1983 / PAGE 90

Adventure in the Fifth Dimension!

16K Cassette/24K Disk

by Brian Moriarty

Adventure is an entertainment ideally suited to the home computer. No arcade game can offer the logical challenge and intellectual involvement of a good adventure program.

Unfortunately, most of the adventures available for the ATARI require more than 16K of memory to run. This prevents many owners of the ATARI 400 System from enjoying the excitement of adventure. And very few text adventures take advantage of the ATARI’s unique hardware capabilities to produce a clear, easy-to-read display.

A.N.A.L.O.G.’s Adventure in the 5th Dimension addresses both of these problems. It’s a beginner’s-level text adventure with all the features you’d expect in a commercial product — a large vocabulary, blinking cursor, independent scrolling window and the ability to save and load games.

Don’t be fooled by the fact that The 5th Dimension is written in ATARI BASIC. The program uses machine-language subroutines to give you speed performance that rivals even the most expensive commercial adventures. Best of all, the whole thing will fit (just barely) in a 16K cassette-based system!

THE GAME SCENARIO

Few of our national treasures are more secure than the original Declaration of Independence. It’s kept at the Library of Congress in a closely guarded display case, sealed in an atmosphere of inert gas to preserve its integrity. The entire display can be retracted deep into the earth at the touch of a button. Stored in this underground vault, the Declaration is capable of surviving the most vicious enemy assault, including a thermonuclear attack.

One afternoon, as a gaggle of tourists stood admiring the priceless document, a shining door of light appeared over the display case. The crowd watched in helpless amazement as alien beings reached their 5-dimensional fingers through the bulletproof glass, snatched the Declaration and vanished without a trace!

You are a top-notch private investigator, hired by the government to retrieve the Declaration. You must search the city of Washington for clues, find a way into the alien universe, locate the Declaration and return it to the police station.

In your search, you will encounter weird technologies and multi-dimensional terrors never before seen. It takes skill and insight to outwit the aliens — and plenty of patience to navigate the streets of Washington!

Typing It In

You will notice that our source listing for The 5th Dimension is un-encoded; that is, the code has not been scrambled to prevent you from seeing possible clues. We decided not to scramble our listing because encoded programs are very hard to type, and they make it nearly impossible to learn how the program works.

It is VERY IMPORTANT that you type each line of the program EXACTLY as you see it printed. Include all of the spaces and control characters; yes, even the REM statements! Save every few lines of new code in case your cat pulls out the power cord. Be especially careful with the DATA statements at the end of the program. And don’t try to RUN anything until you have used D:CHECK or C:CHECK to guarantee the accuracy of your work.

Playing The Game

After your copy of The 5th Dimension has passed the CHECK routine without errors, SAVE a perfect copy into a disk or tape. Now you can type RUN. The title screen will appear along with the message “Initializing.” After about five seconds, you’ll see the following prompt:

Press START to being new game.
Press OPTION to restore old game.

Press the START key. Your screen should now look like this:

Your Location:
Street Corner.

You can go: N S W

You see: Morning paper




Okay.
>>>>> What next? 

The screen is divided into five imaginary text areas or “windows.” The black response window at the bottom accepts commands from the user, and displays descriptions of objects and the results of your actions. A blinking cursor in the response window indicates that the program is waiting for new commands.

The location window at the top of the screen gives you a brief description of your immediate surroundings. Underneath it is the compass window, which indicates all of the possible exits from that location.

The objects window shows a list of all objects visible at the current location. The bottom of the blue screen area is the inventory window, which lists whatever items you may be carrying.

Like most text adventures. The 5th Dimension understands two-word sentences in the form VERB-(space)-NOUN. Try typing the sentence TAKE PAPER on the starting screen. The “Morning paper” will vanish from the objects window and reappear in your inventory window.

You can interact with objects on the screen just like you can in real life. Watch the response window as you type the sentences EXAMINE PAPER and READ PAPER. When you’re done, the sentence DROP PAPER will return it to the object window. Part of the fun of adventuring is finding out which verbs and nouns the program will understand. If you type an illegal or misspelled word, you’ll see the message “I don’t understand — try again” in the response window.

Single-Character Commands

The 5th Dimension also understands a limited number of single-character commands. These are used to control your movement, and to perform other special functions.


MOVEMENT COMMANDS:
N — North S — South E — East W — West
U — Up D — Down

OTHER COMMANDS:
I — Inventory H — Help Q — Quit/Save Game

The movement commands let you go in any of the directions indicated in the compass window. The “I” command updates the inventory window so you can see what you’re carrying. The inventory window is also updated whenever you TAKE, DROP or THROW anything.

The “H” command will give you a brief hint appropriate for that location. “Q” is used to exit the program, and to save games.

Saving And Loading Games

The 5th Dimension allows you to save your current game status on disk or tape. To use this feature, make sure your storage device is properly connected and loaded with a blank tape or formatted disk. Type the command Q (Quit) and answer Y to the “Save Game?” prompt. Then indicate whether you are saving to disk or tape.

Don’t be frightened when the screen goes black. The program turns off ANTIC during the game saving and loading functions to prevent the display from going crazy. When the save is complete, the screen will return in all its glory and you can continue the game. I/O errors will cause the console to squawk with irritation, and the “Disk or Tape?” prompt will reappear.

To load a previously saved game, type Q/RETURN and then RETURN again to exit. RUN the program again and press the OPTION key after the initialization is complete. When the screen appears, the game will be restored to exactly the way it was when you last saved it.

Don’t try aborting the game with the BREAK key. The program disables it to prevent you from crashing the machine-language routine that blinks the cursor. Hit SYSTEM RESET and you will return safely to BASIC without erasing the program.

Hints For Successful Adventuring

  1. Draw a map. You’ll get hopelessly lost in the streets of Washington if you don’t draw a map. The alien universe also contains areas that can be tricky to navigate without careful mapping.

    The easiest way to map an adventure maze is use the “Hansel and Gretel” technique. Drop an item to mark your place and move one step in each direction, noting where it brings you. Then retrieve the item, drop it somewhere else and repeat the procedure.

    The method works even better if you have more than one item to drop. Be careful - some directions loop around in circles, while others bring you back to the location you just left! With careful and methodical mapping, you should be able to figure out the entire street niaze in less than 15 minutes.

  2. Use the “H” (Help) command. Different locations have different hints. Some of these hints may prove very useful.
  3. Examine everything. Objects may have important features that will not be evident unless you examine them closely. You should also keep track of the items you discover — most of them are essential to your success.
  4. Save your game frequently. Use the “Q” command to save your current status after every important discovery, and before you try anything that might be dangerous. Otherwise you’ll have to go back to the street corner and start all over again.
  5. Try anything. Don’t be afraid to find out what you can or can’t do. The worst that can happen is that you will be blown into a million pieces.
  6. Don’t give up hope. It is possible to retrieve the Declaration and return it to the police station — I promise! If you’re really stuck, ask for other peoples’ suggestions. A fresh outlook might uncover a solution you didn’t think of.
  7. Don’t call A.N.A.L.O.G. We are absolutely, positively and definitely not giving adventure hints over the telephone! If you’re really stuck, drop us a desperate note and we’ll print it in our next “Letters” column along with an appropriate reply. And remember to run D:CHECK or C:CHECK on the program before you try to play it. One byte in the wrong place can make Adventure in the 5th Dimension as hard to beat as an alien force field!

Program Variables

C0-C710
Common variables. You can save lots of memory by defining commonly used constants as variables. I use the “C” prefix to indicate “common.” Unfortunately, I couldn’t use variables for common line references because I wanted to make the program compatible with the Datasoft BASIC Compiler. See review elsewhere in this issue.
Q,W,I,X,Y,Z
General-purpose working variables.
FLAG
Used to indicate whether the inventory window should be updated. See line 75.
M$
The master location matrix. It contains the data which determines the objects and legal exits available at each location. M$ is divided into 24 16-character sections or modules, each holding the data for one location. The first character position in each module is a unique letter from A-Y which identifies that location. The next six positions correspond to the six possible directions of movement. A letter in any position indicates which location you will enter if you go in that direction. A “?” character indicates no exit in that direction. Positions 8-16 contain “?” characters unless an object is present; if so, the code letter for that object is inserted in any location to a maximum of 8. Position 7 was a flag byte used in an early version of the program. I was too lazy to remove it.
CL$
The current location buffer. Every time you move into a new location, the program copies the appropriate location module from M$ into CL$. Any changes in the status of a location (objects dropped or taken, new exits opened, etc.) are made in CL$; when you leave that location, CL$ is copied back into M$ and a new module is copied into CL$. This insures that M$ will always reflect the latest status of every location.
CL, CL8
The address of CL$ and the address of position 8 in CL$.
ST$
Player status buffer. The first four positions will contain a “?” character unless you have picked up an object; then the code letter for that object is stored into one of the positions. Dropping an object replaces the letter with a “?”. Your inventory can contain no more than 4 objects simultaneously. Position 5 is a code letter indicating your current location.
ST
The address of ST$.
VERB$, NOUN$
These are the lookup tables for the legal verbs and nouns. The first four characters of each word are stored along with a unique alphabetic identifier. A machine-language routine rapidly compares the user input with the data in these tables. If a match is found, the routine returns the word’s identifier code; if not, it returns a zero.
V,N
The addresses of VERB$ and NOUN$.
C$
The lookup table for single-character commands. It is scanned whenever you input a single character. A match returns the position of the matching character; no match yields a zero.
K$
The keyboard input buffer.
V$,N$
When you enter a sentence and press RETURN, lines 56 and 57 break K$ into verb and noun segments by determining the location of the space character. These segments are stored in V$ and N$ for later comparison with the lookup tables.
LOOK$,DLI$,F$,D$
Used to store the program’s four machine-language subroutines. LOOK$ is a general-purpose character locator. DLI$ contains a display list interrupt handler that blinks the cursor and changes the color of the response window at the bottom of the screen. F$ is a high-speed screen clearing routine. D$ is the noun/verb decoder.
OK$,DH$
Used to store commonly used text phrases. See line 214.

BASIC Listing

10 CLR :GOTO 210
11 GRAPHICS C0:ST$=M$(401,405):Z=ASC(ST$(C5,C5)):OPEN #C2,C8,C0,"S:":GOSUB 15:POKE 703,C4
12 POSITION C0,19:? #C2;"________________________________________";
13 Q=USR(ADR(DLI$),ADR(DLI$)+32):POKE 54286,192:POKE C16,112:POKE 53774,112:GOTO 66
14 POKE C710,C0:POKE C709,C14:RETURN 
15 POKE C709,C14:POKE C710,148:RETURN :REM 
16 FOR I=C0 TO C12 STEP C4:X1=USR(ADR(F$),I):NEXT I
17 X1=USR(ADR(F$),C15):RETURN 
18 SOUND C0,25,C10,C15:FOR I=C1 TO C4:NEXT I:SOUND C0,C0,C0,C0:RETURN 
19 ? "I don't understand.  Try again.":GOTO 53
20 ? "That is impossible.":RETURN 
21 ? "There isn't enough room here.":RETURN 
22 ? OK$:? "You hear a powerful blast.":RETURN 
23 ? "It isn't here.":RETURN 
24 X=USR(LOOK,CL8,N,C8):RETURN 
25 Y=USR(LOOK,ST,N,C4):RETURN 
26 GOSUB 25:IF Y THEN RETURN 
27 POP :POP :? DH$:GOTO 53
28 Q=C16*(ASC(ST$(C5,C5))−65)+C1:RETURN :REM 
29 POP :FLAG=C1:GOTO 72
30 ? #C2;"Street corner.":RETURN 
31 ? #C2;"Lost in a maze of streets.":RETURN 
32 ? #C2;"West of police station.":RETURN 
33 ? #C2;"South of a store.":RETURN 
34 ? #C2;"Lobby of police station.":? #C2;"Sergeant eyes you suspiciously.":RETURN 
35 ? #C2;"Bathroom.":GOSUB 15:RETURN 
36 ? #C2;"Inside store.  Sign reads:":? #C2;"GREEN BATTERIES ONLY $1.OO!":RETURN 
37 ? #C2;"Dead-end alley.":RETURN 
38 ? #C2;"Fire escape.":RETURN 
39 ? #C2;"Roof of building.":RETURN 
40 ? #C2;"Bedroom.":RETURN 
41 ? #C2;"Kitchen.":RETURN 
42 ? #C2;"White void.":POKE C709,C0:POKE C710,C14:RETURN 
43 ? #C2;"Golden void.":POKE C709,C14:POKE C710,24:RETURN 
44 ? #C2;"Green void.":POKE C709,C14:POKE C710,212:RETURN 
45 ? #C2;"Infinite void.":GOSUB 14:RETURN 
46 ? #C2;"Lost in a crimson void.":POKE C709,C14:POKE C710,64:RETURN 
47 ? #C2;"Dense forest.":GOSUB 15:RETURN 
48 ? #C2;"River bank.":RETURN 
49 POP :CLOSE #C2:GRAPHICS C0
50 GOSUB 14:POSITION C12,C10:? "Congratulations!":? "↓   You have saved the Declaration!↓↓↓↓":END 
51 POP :GRAPHICS C0:GOSUB 14:POKE 752,C1:? "↓↓↓↓↓   An unearthly anti−matter blast"
52 ? ".            OBLITERATES":? ".         this entire area!":GOTO 223
53 POP :? ">>>>> What next";:GOSUB 18:TRAP 53:INPUT K$:TRAP 10000:L=LEN(K$):IF L=C0 THEN 19
54 IF L=C1 THEN V$=K$:GOTO 63
55 Q=USR(LOOK,ADR(K$),ADR(" "),L):IF Q<C4 THEN 19
56 V$=K$(C1,Q−C1):IF Q=C4 THEN V$(C4,C4)="!"
57 N$=K$(Q+C1,L):IF LEN(N$)<C4 THEN 19
58 Z=USR(ADR(D$),ADR(VERB$)−C5,V):IF Z=C0 THEN 19
59 IF Z=76 THEN K$=K$(Q+C1,L)
60 Q=USR(ADR(D$),ADR(NOUN$)−C5,N):IF Q=C0 AND Z<>76 THEN 19
61 N$=CHR$(Q):IF N$="X" THEN ? "Refer to it by color.":GOTO 53
62 Z=Z−64:ON Z GOSUB 93,107,120,129,136,144,147,153,159,163,177,183,185,188,203:GOTO 53
63 Q=USR(LOOK,ADR(C$),V,C9):IF Q=C0 THEN 19
64 IF Q>C6 THEN Q=Q−C6:ON Q GOTO 77,82,88
65 Q=Q+C1:Z=ASC(CL$(Q,Q)):IF Z=63 THEN ? "You can't go that way.":GOTO 53
66 GOSUB 16:GOSUB 28:M$(Q,Q+C15)=CL$:ST$(C5,C5)=CHR$(Z):GOSUB 28:CL$=M$(Q,Q+C15)
67 ? OK$:POSITION C2,C0:? #C2;"Your location:";:POSITION C2,C1
68 Z=Z−64:ON Z GOSUB 30,31,31,32,31,31,31,33,34,35,36,37,38,39,40,41,42,43,44,45,46,46,46,47,48
69 REM * SHOW LEGAL EXITS
70 POSITION C2,C4:? #C2;"You can go: ";:FOR I=C1 TO C6:IF CL$(I+C1,I+C1)<>"?" THEN ? #C2;C$(I,I);" ";
71 NEXT I
72 X1=USR(ADR(F$),C6):X1=USR(ADR(F$),C10):POSITION C2,C6:? #C2;"You see: ";:X=C6
73 FOR I=C1 TO C8:Q=ASC(CL$(I+C8,I+C8))−64:IF Q<>−C1 THEN RESTORE 245+Q:READ K$:POSITION 11,X:? #C2;K$:X=X+C1
74 NEXT I:IF X=C6 THEN POSITION 11,X:? #C2;"Nothing interesting"
75 IF FLAG=C1 THEN FLAG=C0:GOTO 78
76 GOTO 53
77 REM * I
78 ? OK$:GOSUB 17:POSITION C2,C15:? #C2;"You have: ";
79 X=C15:FOR I=C1 TO C4:Q=ASC(ST$(I,I))−64:IF Q<>−C1 THEN RESTORE 245+Q:READ K$:POSITION C12,X:? #C2;K$:X=X+C1
80 NEXT I:IF X=C15 THEN POSITION 12,X:? #C2;"Nothing"
81 GOTO 53
82 REM * Q
83 ? "Type Y to save, RETURN to quit";:INPUT K$:IF K$<>"Y" THEN CLOSE #C2:GRAPHICS C0:END 
84 CLOSE #C1:POKE 559,34:? "Position Save: Disk or Tape";:INPUT N$:IF N$<>"D" AND N$<>"T" THEN 53
85 TRAP 84:K$="D1:SAVE.DAT":IF N$="T" THEN K$="C:"
86 POKE 559,C0:POKE 54272,C0:OPEN #C1,C8,C0,K$:M$(401,405)=ST$:GOSUB 28:M$(Q,Q+C15)=CL$
87 FOR I=325 TO C1 STEP −81:? #C1;M$(I,I+80):NEXT I:? #C1;NOUN$:CLOSE #C1:POKE 559,34:POKE 54286,192:GOTO 53
88 REM * H
89 IF USR(LOOK,ADR("ABCDEGHUVW"),CL,C10) THEN ? "A map is essential.":GOTO 53
90 IF USR(LOOK,ADR("JNORSY"),CL,C6) THEN ? "Examine everything.":GOTO 53
91 IF CL$(C1,C1)="T" THEN ? "No earthly power can help you.":GOTO 53
92 ? "How's your pitching arm lately?":GOTO 53
93 REM * VERB A
94 Q=Q−64:GOSUB 24:IF X=C0 THEN GOSUB 25:IF Y=C0 THEN 23
95 ON Q GOTO 96,96,96,96,96,97,96,96,98,96,98,96,99,100,101,99,102,103,96,96,104,96,106
96 ? "Seems ordinary.":RETURN 
97 ? "There's a battery inside!":RETURN 
98 ? "Has a battery attachment.":RETURN 
99 ? "Looks dangerous.":RETURN 
100 ? "Looks like this: ^^^":RETURN 
101 ? "They shimmer eerily.":RETURN 
102 ? "Looks thirsty.":RETURN 
103 ? "Stock is dated 1775!":RETURN 
104 N$="V":GOSUB 24:IF X=C0 THEN GOTO 96
105 ? "It's protected by a powerful":? "force field.":RETURN 
106 ? "Looks like a shining door.":RETURN 
107 REM * VERB B
108 GOSUB 25:IF Y THEN ? "You already have that.":RETURN 
109 Z=USR(LOOK,ST,ADR("?"),C4):IF Z=C0 THEN ? "You can't carry any more.":RETURN 
110 GOSUB 24:IF X=C0 THEN 23
111 IF USR(LOOK,ADR("NPQSTVW"),N,7) THEN 20
112 IF N$="U" AND USR(LOOK,CL8,ADR("V"),C8) THEN ? "Force field won't let you.":RETURN 
113 IF N$="K" AND USR(LOOK,CL8,ADR("P"),C8) THEN ? "Beast would rather you didn't.":RETURN 
114 IF N$="R" AND USR(LOOK,CL8,ADR("Q"),C8) THEN ? "Soldier won't cooperate.":RETURN 
115 IF N$="D" AND CL$(C1,C1)="K" THEN ? "Cashier says, '$1.OO, please.'":RETURN 
116 IF N$="M" THEN 118
117 CL$(X+C8,X+C8)="?":ST$(Z,Z)=N$:GOTO 29
118 IF USR(LOOK,ST,ADR("O"),C4) THEN 117
119 GOTO 51
120 REM * VERB C
121 GOSUB 26:X=USR(LOOK,CL8,ADR("?"),C8):IF X=C0 THEN 21
122 IF N$="L" AND CL$(C1,C1)="Y" THEN CL$(C9,C9)="?":N$="?":? "Soldier walks away with it."
123 IF USR(LOOK,ADR("NPQSTVW"),N,7) THEN 20
124 IF N$="M" AND CL$(C1,C1)="T" THEN ? "It's up against the force field."
125 IF N$="U" AND CL$(C1,C1)="I" THEN 49
126 IF N$="D" AND CL$(C1,C1)="K" THEN ? "Cashier returns it to shelf."
127 IF USR(LOOK,CL8,ADR("M"),C8) THEN 51
128 ST$(Y,Y)="?":CL$(X+C8,X+C8)=N$:GOTO 29
129 REM * VERB D
130 GOSUB 25:IF Y=C0 THEN ? DH$:RETURN :REM 
131 IF USR(LOOK,ADR("NPQV"),N,C4) THEN POP :GOTO 19
132 IF N$="I" OR N$="K" THEN ? "Needs a power source.":RETURN 
133 IF N$="H" OR N$="J" THEN ? "It's already activated.":RETURN 
134 IF N$="S" OR N$="T" THEN ? "Indicate a direction.":RETURN 
135 ? "Be more specific.":RETURN 
136 REM * VERB E
137 GOSUB 24:IF N$="S" AND X THEN 146
138 IF N$="T" THEN ? "It's already open.":RETURN 
139 GOSUB 26:IF N$="A" OR N$="U" THEN ? OK$:RETURN 
140 IF N$="F" AND Y THEN 142
141 GOTO 20
142 N$="?":GOSUB 24:IF X=C0 THEN 21
143 ST$(Y,Y)="G":NOUN$(30,30)="G":CL$(X+C8,X+C8)="E":GOSUB 97:? "It fell out on the floor.":GOTO 29
144 REM * VERB F
145 IF N$<>"S" THEN 20
146 ? "Lock is very secure.":RETURN 
147 GOSUB 24:IF X=C0 THEN 23
148 Y=USR(LOOK,ST,ADR("C"),C4):IF N$="S" AND Y THEN 151
149 IF N$="S" AND Y=C0 THEN ? "You have nothing to break it with.":RETURN 
150 GOTO 20
151 CL$(C5,C5)="O":CL$(X+C8,X+C8)="T":M$(234,234)="C":ST$(Y,Y)="?":? "The stone broke the window!"
152 NOUN$(80,80)="T":POP :GOTO 70
153 REM * VERB H
154 GOSUB 25:IF Y THEN ? "You already have that.":RETURN 
155 GOSUB 24:IF X=C0 THEN ? DH$:RETURN :REM 
156 Y=USR(LOOK,ST,ADR("B"),C4):IF Y=C0 THEN ? "You don't have any money.":RETURN 
157 IF N$<>"D" THEN 20
158 ST$(Y,Y)="D":CL$(X+C8,X+C8)="?":? "Cashier takes your $1 bill.":GOTO 29
159 REM * VERB I
160 GOSUB 24:GOSUB 25:IF X=C0 AND Y=C0 THEN 23
161 IF N$="M" AND USR(LOOK,ST,ADR("O"),C4)=C0 THEN 51
162 GOTO 96
163 REM * VERB J
164 GOSUB 26:IF USR(LOOK,ADR("MNPQSTVW"),N,C8) THEN 20
165 X=USR(LOOK,CL8,ADR("?"),C8):IF X=C0 THEN 21
166 IF N$="C" THEN 168
167 ST$(Y,Y)="?":CL$(X+C8,X+C8)=N$:? "Didn't go far.":GOTO 29
168 ? "Indicate a direction (N/S/E/W)";:GOSUB 18:INPUT K$:IF LEN(K$)<>C1 THEN POP :GOTO 19
169 Q=USR(LOOK,ADR(C$),ADR(K$),C4):IF Q=C0 THEN POP :GOTO 19
170 IF CL$(Q+C1,Q+C1)="?" THEN 176
171 IF CL$(Q+C1,Q+C1)=CL$(C1,C1) THEN 167
172 Z=C16*(ASC(CL$(Q+C1,Q+C1))−65)+C9:I=USR(LOOK,ADR(M$(Z)),ADR("?"),C8):X=USR(LOOK,ADR(M$(Z)),ADR("M"),C8)
173 IF X AND CL$(C1,C1)="Q" AND Q=C4 THEN M$(313,320)="???????U":ST$(Y,Y)="?":GOTO 22
174 IF X THEN M$(Z,Z+7)="????????":ST$(Y,Y)="?":GOTO 22
175 IF I THEN M$(Z+I−C1,Z+I−C1)="C":ST$(Y,Y)="?":? "Gone!":GOTO 29
176 ? "You can't throw it that way.":RETURN 
177 REM * VERB K
178 GOSUB 24:IF X=C0 THEN 23
179 IF N$="P" OR N$="Q" THEN 181
180 GOTO 20
181 IF USR(LOOK,ST,ADR("R"),C4)=C0 THEN ? "Not without a weapon.":RETURN 
182 ? "Bayonet scared it away!":CL$(X+C8,X+C8)="?":GOTO 29
183 REM * VERB L
184 ? K$:RETURN 
185 REM * VERB M
186 GOSUB 26:IF N$<>"O" THEN 20
187 ? "You're already wearing them.":RETURN 
188 REM * VERB N
189 GOSUB 26:X=USR(LOOK,ST,ADR("I"),C4):Z=USR(LOOK,ST,ADR("K"),C4)
190 IF X=C0 AND Z=C0 THEN ? "You have nothing to attach it to.":RETURN 
191 IF N$="D" THEN 194
192 IF N$="E" THEN 196
193 GOTO 20
194 IF Z THEN ? "Cube absorbs the battery and hums.":GOTO 199
195 IF X THEN ? "Green battery doesn't fit.":RETURN 
196 IF X THEN ? "Spheroid absorbs the battery and":? "displays a symbol: ^^^":GOTO 198
197 IF Z THEN ? "Blue battery doesn't fit.":RETURN 
198 ST$(X,X)="H":M$(150,150)="Q":M$(153,153)="W":NOUN$(35,35)="H":GOTO 201
199 ST$(Z,Z)="J":M$(263,263)="J":M$(262,262)="?":NOUN$(40,40)="J"
200 IF CL$(C1,C1)="Q" THEN CL$(C6,C6)="?":CL$(7,7)="J"
201 IF CL$(C1,C1)="J" THEN CL$(C9,C9)="W":CL$(C6,C6)="Q"
202 ST$(Y,Y)="?":FLAG=C1:POP :GOTO 70:REM 
203 REM * VERB O
204 GOSUB 24:GOSUB 25:IF Y=C0 AND N$<>"N" THEN ? DH$:RETURN 
205 IF N$="N" AND X THEN 100
206 IF N$="A" AND Y THEN ? "HEADLINE: Declaration Stolen!":? "Police Anxiously Await Recovery!":RETURN 
207 IF N$="U" AND Y THEN ? "'We the people ... '":RETURN 
208 IF N$="W" AND Y THEN 106
209 GOTO 20
210 READ FLAG,C0,C1,C2,C4,C5,C6,C7,C8,C9,C10,C12,C14,C15,C16,C709,C710
211 GOSUB 14:POKE 752,C1:? "↓↓↓↓↓          Brian Moriarty's":? "↓   ADVENTURE in the 5TH DIMENSION "
212 ? "↓      (C)1983 ANALOG Computing":POSITION C12,C16:? "  INITIALIZING  ":REM 
213 DIM M$(406),CL$(16),K$(24),N$(4),V$(4),LOOK$(43),VERB$(100),NOUN$(100),C$(9),ST$(5),DLI$(64),F$(42),D$(76)
214 DIM OK$(5),DH$(20):OK$="Okay.":DH$="You don't have that."
215 NOUN$="PAPEABILLBSTONCGREEDBLUEERADIFSPHEICUBEKTEABLMASSMSYMBNGLOVOBEASPSOLDQBAYORWINDSDECLUFIELVDUCTWBATTX"
216 VERB$="EXAMALOOKATAKEBGET!BDROPCLEAVCGIVECUSE!DOPENEUNLOFBREAGSMASGBUY!HTOUCITHROJKILLKSAY!LWEARMATTANREADO"
217 C$="NSEWUDIQH":LOOK=ADR(LOOK$):CL=ADR(CL$):CL8=CL+C8:V=ADR(V$):N=ADR(N$):ST=ADR(ST$)
218 M$(C1)="?":M$(406)="?":M$(C2)=M$:FOR I=C1 TO 385 STEP C16:READ CL$:M$(I,I+LEN(CL$))=CL$:NEXT I
219 M$(401,405)="????A":CL$=M$(C1,C16):FOR I=C1 TO 76:READ Q:D$(I)=CHR$(Q):NEXT I
220 FOR I=C1 TO 43:READ Q:LOOK$(I)=CHR$(Q):NEXT I
221 FOR I=C1 TO 64:READ Q:DLI$(I)=CHR$(Q):NEXT I
222 FOR I=C1 TO 42:READ Q:F$(I)=CHR$(Q):NEXT I
223 POSITION C4,C16:? "Press  START  to begin new game.":? ". Press  OPTION  to restore old game."
224 IF PEEK(53279)=C6 THEN 11
225 IF PEEK(53279)=3 THEN 227
226 GOTO 224
227 CLOSE #C1:POKE 559,34:POSITION C8,20:? "Load from Disk or Tape";:INPUT N$:IF N$<>"D" AND N$<>"T" THEN 227
228 POKE 559,C0:POKE 54272,C0:TRAP 227:K$="D1:SAVE.DAT":IF N$="T" THEN K$="C:"
229 OPEN #C1,C4,C0,K$:TRAP 10000
230 FOR I=325 TO C1 STEP −81:INPUT #C1,M$:M$(I,I+80)=M$:NEXT I:M$(406,406)="":INPUT #C1,NOUN$:CLOSE #C1
231 ST$=M$(401,405):GOSUB 28:CL$=M$(Q,Q+C15):POKE 559,34:GOTO 11
232 DATA 0,0,1,2,4,5,6,7,8,9,10,12,14,15,16,709,710
233 DATA AEB?G???A,BABCG,CDCEB,DFCID,EEAFC,FFDGE???C,GHBAF,HKG?L,I?J?D
234 DATA JI??????NB,K?H?????D,L??H?M,M????NL?S,N?????M?I,O??MP???F,P??O????L,QURSTX??W,RQU?????M
235 DATA S???Q???PK,T??Q????VU,URQVW,VWVWU???O,WWVUV,X??Y??Q?W,Y???X???QR
236 DATA 104,104,133,206,104,133,205,104,133,204,104,133,203,169,0,133,213,162,21,202,240,49,24,165,205
237 DATA 105,5,133,205,165,206,105,0,133,206,24,160,0,177,203,209,205,208,231,200,177,203,209,205,208
238 DATA 224,200,177,203,209,205,208,217,200,177,203,209,205,208,210,200,177,205,133,212,96,169,0,133,212,96
239 DATA 104,104,133,206,104,133,205,104,133,204,104,133,203,169,0,168,133,213,177,203,133,207,104,104,168
240 DATA 136,48,10,165,207,209,205,208,247,200,132,212,96,169,0,133,212,96
241 DATA 104,104,141,1,2,104,141,0,2,173,48,2,133,203,173,49,2,133,204,160,24,169,130,145,203
242 DATA 169,0,141,243,2,96,0,72,138,72,169,0,162,10,141,10,212,141,24,208,142,23,208,230,208
243 DATA 165,208,41,16,74,74,74,141,1,212,104,170,104,64
244 DATA 104,104,104,170,165,88,133,203,165,89,133,204,216,24,202,48,15,165,203,105,40,133,203,165,204
245 DATA 105,0,133,204,24,144,238,160,159,169,0,145,203,136,208,251,96
246 DATA Morning paper
247 DATA $1 bill
248 DATA Stone
249 DATA Green battery
250 DATA Blue battery
251 DATA Broken portable radio
252 DATA Empty radio
253 DATA Spheroid with ^^^ symbol
254 DATA Alien spheroid
255 DATA Humming alien cube
256 DATA Alien cube
257 DATA Teabag
258 DATA Strange shimmering mass
259 DATA Alien symbol on wall
260 DATA Strange gloves
261 DATA 5-dimensional beast
262 DATA British soldier
263 DATA Bayonet
264 DATA Locked window
265 DATA Broken west window
266 DATA The Declaration
267 DATA Powerful force field
268 DATA Transdimensional duct

Assembly Language Listing

0100 ; NOUN/VERB DECODER
0105 ;
0110 ; Syntax: N=USR(ML,TL-5,NL)
0115 ; ML=addr of this routine
0120 ; TL=addr of lookup table
0125 ; NL=addr of current noun/verb
0130 ;
0135 ; Program equates
0140 ;
0145 NOUN=$CB  ; noun addr pointer
0150 TABLE=$CD ; table addr pointer
0155 NRET=$D4  ; BASIC return addr
0160 ;
0165      PLA           ; # arguments
0170      PLA           ; msb of table addr
0175      STA TABLE+1
0180      PLA           ; lsb
0185      STA TABLE
0190      PLA           ; msb of noun addr
0195      STA NOUN+1
0200      PLA           ; lsb
0205      STA NOUN
0210      LDA #$00
0215      STA NRET+1    ; zero msb
0220      LDX #$15      ; noun/verb count
0225 NEXT DEX
0230      BEQ NOPE      ; illegal entry
0235      CLC
0240      LDA TABLE     ; +5 to pointer
0245      ADC #$05
0250      STA TABLE
0255      LDA TABLE+1
0260      ADC #$00
0265      STA TABLE+1
0270      CLC
0275      LDY #$00      ; init index
0280      LDA (NOUN),Y  ; get 1st char
0285      CMP (TABLE),Y ; equal?
0290      BNE NEXT      ; no; next noun
0295      INY           ; in-line for speed
0300      LDA (NOUN),Y  ; try 2nd char
0305      CMP (TABLE),Y
0310      BNE NEXT
0315      INY
0320      LDA (NOUN),Y  ; try 3rd char
0325      CMP (TABLE),Y
0330      BNE NEXT
0335      INY
0340      LDA (NOUN),Y  ; last char!
0345      CMP (TABLE),Y
0350      BNE NEXT
0355      INY           ; must be legal
0360      LDA (TABLE),Y ; get iden #
0365      STA NRET      ; give to BASIC
0370      RTS           ; and return
0375 NOPE LDA #$00      ; 0=illegal entry
0380      STA NRET      ; give to BASIC
0385      RTS           ; and return
0100 ; CHARCTER SEARCH ROUTINE
0105 ;
0110 ; Syntax: X=USR(ML,SVT,V,R)
0115 ; ML=addr of this routine
0120 ; SVT=addr of $ to be searched
0125 ; V=addr of search character
0130 ; R=# bytes to search
0135 ;
0140 ; Program equates
0145 ;
0150 CADR=$CB  ; char addr pointer
0155 TABLE=$CD ; verb table pointer
0160 CHAR=$CF  ; character buffer
0165 BRET=$D4  ; BASIC return addr
0170 ;
0175      PLA             ; # arguments
0180      PLA             ; msb of table addr
0185      STA TABLE+1
0190      PLA             ; lsb
0195      STA TABLE
0200      PLA             ; msb of verb addr
0205      STA CADR+1
0210      PLA             ; lsb
0215      STA CADR
0220      LDA #$00
0225      TAY
0230      STA BRET+1      ; zero msb
0235      LDA (CADR),Y    ; get the char
0240      STA CHAR        ; save for later
0245      PLA             ; msb of range (ignore)
0250      PLA             ; lsb
0255      TAY             ; use as the index
0260 NEXT DEY
0265      BMI NOPE        ; must be illegal
0270      LDA CHAR        ; get char
0275      CMP (TABLE),Y   ; match?
0280      BNE NEXT        ; no; try another
0285      INY             ; yes; give position
0290      STY BRET        ; to BASIC
0295      RTS             ; and return
0300 NOPE LDA #$00        ; 0=char not found
0305      STA BRET        ; give to BASIC
0310      RTS             ; and return
0100 ; DLI/BLINK ROUTINE
0105 ;
0110 ; Syntax: USR(DLI,DLI+X)
0115 ; DLI=addr of this routine
0120 ; X=offset to DLI handler
0125 ;
0130 ; Program equates
0135 ;
0140 COLPF1=$D017
0145 COLPF2=$D018
0150 WSYNC=$D40A
0155 SDLSTL=$0230
0160 VDSLST=$0200
0165 CHACTL=$D401
0170 CHACT=$02F3
0175 BUFFER=$CB
0180 BLINCT=$D0
0185 ;
0190 ; First set up the DLI
0195 ;
0200      PLA            ; # arguments
0205      PLA            ; msb of DLI addr
0210      STA VDSLST+1
0215      PLA            ; lsb
0220      STA VDSLST
0225      LDA SDLSTL     ; find start of
0230      STA BUFFER     ; display list
0235      LDA SDLSTL+1
0240      STA BUFFER+1
0245      LDY #$18       ; mode line 20
0250      LDA #$82       ; DL instruction
0255      STA (BUFFER),Y
0260      LDA #$00       ; turn off
0265      STA CHACT      ; inverse video
0270      RTS
0275      BRK            ; mark end of init
0280 ;
0285 ; This is the actual DLI handler
0290 ;
0295      PHA            ; save accumulator
0300      TXA
0305      PHA            ; save X
0310      LDA #$00       ; black bkgrnd
0315      LDX #$0A       ; white chars
0320      STA WSYNC
0325      STA COLPF2
0330      STX COLPF1
0335      INC BLINCT     ; Blink cursor
0340      LDA BLINCT
0345      AND #$10
0350      LSR A
0355      LSR A
0360      LSR A
0365      STA CHACTL
0370      PLA            ; restore A and X
0375      TAX
0380      PLA
0385      RTI            ; back to BASIC
0100 ; SCREEN ERASE SUBROUTINE
0105 ; CLEARS IN 4-LINE BLOCKS
0110 ;
0115 ; Syntax: X=USR(ML,ST)
0120 ; ML=addr of this routine
0125 ; ST=starting line number
0130 ;
0135 ; PROGRAM EQUATES
0140 ;
0145 BUFFER=$CB ; scr address buffer
0150 SAVMSC=$58 ; screentop pointer
0155 ;
0160       PLA            ; # arguments
0165       PLA            ; msb of line#; ignore
0170       PLA            ; lsb
0175       TAX            ; save in x-register
0180       LDA SAVMSC     ; get screen
0185       STA BUFFER     ; address
0190       LDA SAVMSC+1
0195       STA BUFFER+1
0200       CLD            ; clear decimal mode
0205       CLC
0210 ADD40 DEX            ; find window addr
0215       BMI CLEAR
0220       LDA BUFFER     ; add 40
0225       ADC #$28
0230       STA BUFFER
0235       LDA BUFFER+1
0240       ADC #$00
0245       STA BUFFER+1
0250       CLC
0255       BCC ADD40
0260 CLEAR LDY #$9F       ; clear 4 lines
0265       LDA #$00       ; space char
0270 SPACE STA (BUFFER),Y
0275       DEY
0280       BNE SPACE
0285       RTS
A.N.A.L.O.G. ISSUE 12 / JULY 1983 / PAGE 102

A Warning to 1200XL Owners

If you own an ATARI 1200XL and typed in Adventure in the 5th Dimension from our last issue, you were in for a rude shock. The 1200XL operating system contains an insidious little bug which crashes the adventure every time you try to RUN it.

Unlike the ATARI 400 and 800 systems, the 1200XL is very picky about PRINTing to an OPENed screen device, especially when you’re in a “forced” split-screen mode. The entire screen goes wacky if your PRINT statement makes the cursor enter the bottom text window. Try it yourself!

10 GRAPHICS 0
11 REM * Open the screen device (S:)
12 OPEN #2,8,0,"S:"
13 REM * Invoke forced split-screen
14 POKE 703,4
15 REM * Cursor to bottom of window
16 POSITION 39,19
17 REM * Print to the window
18 PRINT #2;"COMPATIBILITY"

Fortunately, the adventure program violates this undocumented restriction only once, in line 12. Since the purpose of line 12 is purely cosmetic (it puts a fancy white border across the top of the response window), the simplest way to deal with it is to eliminate it altogether.

We apologize for not discovering this problem before The 5th Dimension went to press. Please let us know about any other compatibility problems you may discover in the 1200XL systems.