Main Program 7.1 Tour

From Eamon Wiki
Jump to navigation Jump to search
This is a Class B (silver star) article.

The Main Program 7.1 Tour is an annotated listing of the BASIC code for version 7.1 of the Eamon Main Program which explains the operation and purpose of each important line. The original tour was written by Tom Zuchowski and published serially in the September 1994, December 1994, March 1995, and June 1995 issues of the Eamon Adventurer's Guild Newsletter. It was later collected by Matthew Clark into a single page at the Eamon Adventurer's Guild Online website.

The version below is based on Zuchowski's original annotations along with some added explanations and syntax highlighting of the original code. It's followed by a list of the variables used in the program.

For the non-annotated source code, see Source:Main Program 7.1.

Introductory remarks

The opening remarks present the adventure number, the name of the adventure, and the author, and also identifies the Main Program version being used. The block also commonly lists the date the program was last modified and gives the (now obsolete) contact information for the Eamon Adventurer's Guild. (John Nelson introduced the revision date addition in the January '85 newsletter.)

1  REM    EAMON ADVENTURE #NNN
2  REM    (NAME OF ADVENTURE)
3  REM 
4  REM    BY (YOUR NAME HERE)
5  REM 
6  REM       VERSION 7.1

7  REM MP56 1/15/95
8  REM 

EAMON ADVENTURER'S GUILD
7625 HAWKHAVEN DR.
CLEMMONS, NC 27012

Begin

Before starting the game in earnest, the program uses the MAXFILES command to reserve three file buffers for disk input and output. ( CHR$(4) is the standard DOS command escape prefix.) The program then jumps to the fast start routine at line 33000.

10  PRINT  CHR$ (4)"MAXFILES 3"
20  GOTO 33000

Common routines

These are a few basic routines commonly called from elsewhere in the game.

The first is a string print routine. Line 45 notes the top of free memory and reads in A$ from the disk. Line 50 performs a screen pause calculation for A$ length, prints A$, then recovers the memory that A$ occupied.

45 F1 =  PEEK (111):F2 =  PEEK (112): PRINT D$"READ"ED$",R"R: INPUT A$: PRINT D$
50 LL = ( LEN (A$) + CP - 1) / CP:L = L + LL: GOSUB 58: PRINT A$:L = L + LL * (L = 0): IF ( PEEK (109) +  PEEK (110) * 256 +  LEN (A$)) < (F1 + F2 * 256) THEN  POKE 111,F1: POKE 112,F2

Next is a screen pause routine, used to suspend the display when a screen's worth of text has been shown and prevent the first lines from quickly scrolling out of sight. After printing a blank line, it increments the line counter (L). If the line count is less than 23 (a full screen), it does nothing; if it reaches 23, then it pauses and prompts the user to press a key to continue.

51  PRINT 
52 L = L + 1: GOTO 58
54 L = L + 1
56 L = L + 2: PRINT 
58  IF L < 23 THEN  RETURN 
59  PRINT "      (PRESS ANY KEY TO CONTINUE)     ";: GET Q$: PRINT : VTAB  PEEK (37): FOR L = 1 TO 39: PRINT " ";: NEXT : PRINT : VTAB  PEEK (37):L = 0: RETURN

And finally, some command error messages:

91  PRINT : PRINT "YOU AREN'T CARRYING IT.": GOTO 99
92  PRINT : PRINT "YOU MUST FIRST OPEN IT.": GOTO 99
94  PRINT : PRINT "YOU CAN'T "C$(C)" "S$: GOTO 98
96  PRINT : PRINT "NOBODY HERE BY THAT NAME!": GOTO 99
98  GOSUB 54: GOTO 310
99  GOSUB 54

Main loop

You see

This section builds the description of what the player sees.

First the program checks the light source (LS). If its counter has reached zero, it reports that it's gone out and sets the room's light level (LT) to its natural level (NL); if the counter is above zero but getting low, warning messages will appear.

100  REM 

YOU SEE

110  GOSUB 56: IF LS THEN A%(LS,5) = A%(LS,5) - 1: IF A%(LS,5) = 0 THEN  PRINT : PRINT "YOUR "A$(LS)" HAS GONE OUT!":LS = 0:LT = NL: GOTO 99
115  IF LS THEN  IF A%(LS,5) < 10 THEN  PRINT : PRINT "YOUR "A$(LS)" IS ALMOST OUT!": GOSUB 54: GOTO 120
117  IF LS THEN  IF A%(LS,5) < 20 THEN  PRINT : PRINT "YOUR "A$(LS)" GROWS DIM!": GOSUB 54

Next the program decrements the Speed counter (SP) and checks to see if it's reached zero; if so, the spell has expired and the adventurer's agility (previously increased here) is reduced. Current spell abilities (S2%) are compared to total spell abilities (SA%) and may increase slightly.

120  IF SP THEN SP = SP - 1: IF  NOT SP THEN M%(0,2) = M%(0,2) / 2: PRINT "YOUR SPEED SPELL HAS JUST EXPIRED!": GOSUB 56
122  FOR A = 0 TO 3: IF S2%(A) < SA%(A) THEN S2%(A) = S2%(A) * 1.1: IF S2%(A) > SA%(A) THEN S2%(A) = SA%(A)
123  NEXT

At this point the room name (RN$) for the current room number (RO) is displayed, assuming it's not too dark to see. If the room description flag (V%) hasn't yet been set, the description is also displayed, and the flag set to indicate it's been seen and need not be shown again.

125  IF  NOT LT THEN  PRINT : PRINT "IT'S TOO DARK TO SEE.": GOSUB 52: GOTO 210
130  PRINT "YOU ARE ": PRINT " "RN$: GOSUB 54
135  IF  NOT V%(RO) THEN R = RO: GOSUB 45:V%(RO) = 1

Next the program gets the number of monsters (NM) in the current room (RO) and checks each one's "seen" flag (M%(M,0)). For unseen monsters it gives the description. For those the adventurer has already seen, the program just displays that the monster (M$(M)) "is here"... or if there's more than one in the group (M%(M,3)), the monsters "are here". (And finally on line 156, if a description was printed, it adds a blank line.)

140 B% = NM:D% = RO: FOR M = 1 TO NM:C% = M: & A,D%,M%(C%,5),C%,B%: IF  NOT C% THEN M = 999: NEXT : GOTO 160
145 M = C%:M2 = 0: IF  NOT M%(M,0) THEN  GOSUB 51:M%(M,0) = 1:R = M + 600: GOSUB 45:M2 = 1: PRINT " - ";
150  IF M%(M,3) = 1 THEN  PRINT M$(M)" IS HERE.": GOSUB 52: GOTO 156
154  PRINT M%(M,3)" "M$(M)"S ARE HERE.": GOSUB 52
156  IF M2 THEN  GOSUB 51
159  NEXT

The program then does much the same for artifacts:

160  GOSUB 51:B% = NZ:D% = RO: FOR A = 1 TO NZ:C% = A: & A,D%,A%(C%,4),C%,B%: IF  NOT C% THEN A = 999: NEXT : GOTO 190
165 A = C%:M2 = 0: IF  NOT A%(A,0) THEN A%(A,0) = 1:R = A + 200: GOSUB 45:M2 = 1: PRINT " - ";
170  PRINT "YOU SEE "A$(A)".": GOSUB 52: IF M2 THEN  GOSUB 51
175 C% = C% + 1: NEXT

It also displays whether your personal-weapon is in the room:

190  FOR A = NZ + 1 TO NA: IF A%(A,4) = RO THEN  PRINT "YOUR "A$(A)" IS HERE.": GOSUB 52

Command parser

200  NEXT 
205  REM 

CMD

210  PRINT : GOSUB 56: INPUT "  YOUR COMMAND?";A$:L = 0
220  IF  LEFT$ (A$,1) = " " THEN A$ =  MID$ (A$,2): GOTO 220
230  IF A$ = "" THEN A$ = CZ$: VTAB  PEEK (37): HTAB 16: PRINT A$
235  PRINT : IF A$ = "" THEN 275
240 CZ$ = A$: FOR A = 2 TO  LEN (A$): IF  MID$ (A$,A,1) <  > " " THEN  NEXT 
250 V$ =  LEFT$ (A$,A - 1):S$ =  MID$ (A$,A + 1)
260  IF  LEFT$ (S$,1) = " " THEN S$ =  MID$ (S$,2): GOTO 260
270 SL =  LEN (V$): FOR A = 1 TO ND: IF  LEFT$ (C$(A),SL) = V$ THEN C = A:A = 999: NEXT : GOTO 290
272  NEXT :F = 0: FOR A = ND + 1 TO NC: IF  LEFT$ (C$(A),SL) = V$ THEN C = A:F = F + 1: IF C$(A) = V$ THEN F = 1:A = 999
273  NEXT 
275  IF F <  > 1 THEN  PRINT : PRINT "I ONLY UNDERSTAND THESE COMMANDS-- ": PRINT : FOR C = 1 TO CC: HTAB 2: POKE 1403,10: PRINT C$(C);: HTAB 15: POKE 1403,30: PRINT C$(C + CC);: HTAB 28: POKE 1403,50: PRINT C$(C + 2 * CC): NEXT : GOTO 210
290  ON C GOTO 3000,3000,3000,3000,3000,3000,4000,5000,6500,6000,7000,8000,9000,10000,11000,12000,13000,14000,15000,16000,23000,17000,18000,19000,20000,21000,22000,24000,25000,26000,27000,28000

Pick a foe

300  REM 

PICK FOE

305  GOSUB 51
310  IF  NOT T(1) THEN 500
320 B% = NM:D% = RO: FOR M = 1 TO NM:C% = M: & A,D%,M%(C%,5),C%,B%: IF  NOT C% THEN M = 999: NEXT : GOTO 500
330 M = C%: IF M%(M,11) = 2 THEN  NEXT : GOTO 500
333  IF M%(M,3) = 1 THEN  IF M%(M,13) / M%(M,1) *  RND (1) * 100 > M%(M,4) THEN  PRINT : PRINT M$(M)" FLEES!": GOSUB 54:M%(M,5) = 0:M2 = M: GOSUB 3600:M = M2: NEXT : GOTO 500
334  IF M%(M,3) = 1 THEN 340
335  IF (M%(M,12) - M%(M,3)) / M%(M,12) *  RND (1) * 100 > M%(M,4) THEN MR% =  RND (1) * M%(M,3) + 1: PRINT : PRINT MR%" "M$(M);
336  IF MR% THEN  PRINT  MID$ (" FLEES!S FLEE!",1 + (MR% > 1) * 7,7): GOSUB 54:M%(M,3) = M%(M,3) - MR%:M%(M,5) = M%(M,5) * (M%(M,3) > 0):M2 = M: GOSUB 3600:M = M2:MR% = 0: IF  NOT M%(M,5) THEN  NEXT : GOTO 500
340 MC = 1: IF M%(M,3) > 8 THEN MC = M%(M,3) - 8
350 OF = M:DF = 0: FOR MC = MC TO M%(M,3): IF M%(M,11) = 3 THEN 400
360  IF T(3) = M%(0,1) THEN 480
370 B% = NM:D% = RO: FOR M2 = 1 TO NM:C% = M2: & A,D%,M%(C%,5),C%,B%: IF  NOT C% THEN M2 = 999: GOTO 380
375 M2 = C%: IF M%(M2,11) = 3 AND  RND (1) < .25 THEN DF = M2:M2 = 999
380  NEXT : GOTO 480
400 C% = 1:B% = NM:D% = RO
410  & A,D%,M%(C%,5),C%,B%: IF M%(C%,11) <  > 1 THEN C% = C% + 1: GOTO 410
415 DF = C%: IF DF = NM THEN 480
420  FOR M2 = DF + 1 TO NM:C% = M2: & A,D%,M%(C%,5),C%,B%: IF  NOT C% THEN M2 = 999: GOTO 430
425 M2 = C%: IF M%(M2,11) = 1 AND  RND (1) < .25 THEN DF = M2:M2 = 999
430  NEXT 
480  GOSUB 7500
490  IF  NOT T(1) THEN M = 999:MC = 999
495  NEXT : NEXT

Every-round special programming

500  REM 

SPECIAL EVERY-ROUND STUFF

900  GOTO 100

Movement

Move

3000  REM 

MOVE

3010  IF T(1) THEN  PRINT : PRINT "YOU CAN'T TURN YOUR BACK HERE!": GOTO 99
3020 D = C
3030 R2 = RD%(D): IF R2 > 500 THEN 3400
3040  IF R2 > 0 AND R2 <  = NR THEN 3500
3050  REM    /// SPECIAL MOVES
3060  IF R2 =  - 99 THEN  PRINT : PRINT "YOU RETURN TO THE MAIN HALL.": GOTO 32000
3180  REM   /// INSERT HERE SPECIAL ROOM MOVE CHECKING
3390  PRINT : PRINT "YOU CAN'T GO THAT WAY!":V%(RO) = 0: GOTO 99

Gates and doors

3400  REM 

GATE/DOOR

3410 A = R2 - 500: IF A%(A,6) = 0 AND  NOT A%(A,8) THEN R2 = A%(A,5): GOTO 3040
3420  IF A%(A,8) THEN R2 = 0: GOTO 3390
3430  PRINT : PRINT "THE "A$(A)" BLOCKS THE WAY!": GOTO 99

Go

3500  REM 

GO

3530 R3 = RO:RO = R2: GOSUB 3600
3540  PRINT D$;"READ"ER$",R"RO:NX = 0: INPUT RN$: FOR X = 1 TO ND: INPUT RD%(X)
3550  IF RD%(X) > 0 AND RD%(X) <  = NR THEN NX = NX + 1
3560  NEXT : INPUT NL: PRINT D$:LT = NL OR LS
3590  GOTO 100

Enemies

3600  REM 

ENEMY?

3610 T(1) = 0:T(3) = M%(0,1):F(1) = 0:F(3) = M%(0,13)
3620  FOR M = 1 TO NM
3630  IF M%(M,5) = R3 THEN  IF (M%(M,11) = 3 OR (M%(M,11) = 1) AND 200 *  RND (1) < M%(M,4)) THEN M%(M,5) = RO: GOTO 3670
3640  IF M%(M,5) <  > RO THEN  NEXT : RETURN 
3650  IF M%(M,11) > 100 THEN FR = M%(M,11) - 100 + (CH - 10) * 2:M%(M,11) = 1: IF FR > 100 *  RND (1) THEN M%(M,11) = 2: IF FR > 200 *  RND (1) THEN M%(M,11) = 3
3670 A = M%(M,11):F(A) = F(A) + M%(M,13) * M%(M,3):T(A) = T(A) + M%(M,1) * M%(M,3): NEXT : RETURN

Objects

Get

4000  REM 

GET

4010  GOSUB 4900: IF S$ = "ALL" THEN 4200
4020 HA = RO: GOSUB 4805: IF  NOT F THEN 94
4030  PRINT : IF A%(A,3) > 900 THEN  PRINT "DON'T BE ABSURD.": GOTO 98
4040  IF WT + A%(A,3) > 10 * M%(0,1) THEN  PRINT "IT IS TOO HEAVY.": GOTO 98
4050  IF A%(A,2) = 10 THEN  PRINT A$(A)" IS TIED DOWN!": GOTO 98
4140  PRINT "GOT IT.": GOSUB 54:A%(A,4) =  - 1:WT = WT + A%(A,3): IF M%(0,8) =  - 1 THEN  IF A%(A,2) = 2 OR A%(A,2) = 3 THEN 17100
4150  GOTO 300
4200  GOSUB 51:B% = NA:D% = RO: FOR A = 1 TO NA:C% = A: & A,D%,A%(C%,4),C%,B%: IF  NOT C% THEN A = 999: NEXT : GOTO 300
4210 A = C%: PRINT A$(A);: IF A%(A,2) = 10 THEN  PRINT " IS TIED DOWN!": GOTO 4240
4215  IF A%(A,3) > 900 THEN  PRINT ": DON'T BE ABSURD.": GOTO 4240
4220  IF WT + A%(A,3) > 10 * M%(0,1) THEN  PRINT " IS TOO HEAVY.": GOTO 4240
4230  PRINT " TAKEN.":A%(A,4) =  - 1:WT = WT + A%(A,3)
4240  GOSUB 52: NEXT : GOTO 98

Synonyms

This section supports adding synonyms for artifacts or other objects of commands.

4600  REM 

SYNONYMS

4610 SL =  LEN (S$)
4620  REM PUT YOUR OWN SYNONYMS HERE.  SEE MANUAL FOR DETAILS
4675  RETURN 
4680  IF  LEFT$ (SY$,SL) = S$ OR  RIGHT$ (SY$,SL) = S$ THEN S$ = A$(SY): POP 
4690  RETURN

Set SY$ to be the synonym, and SY to the number of the artifact that you are checking for. The Dungeon Designer's Manual gives the following example: if a secret panel that happens to be artifact #3 is hidden in room #2, and a hint in the room description says that the wall looks funny, you can put a line like this in your program:

4620 IF RO = 2 THEN SY$ = "WALL":SY = 3: GOSUB 4680

With this line in place, the player can enter the command EXAMINE WALL and the secret panel will appear in the room.

Monster search

4700  REM 

MONS SEARCH

4705 WH = RO:HA =  - 1
4710 F = 0:C% = 0:D% = 0: & S,S$,M$,C%: IF  NOT C% THEN  IF  LEN (S$) > 1 THEN  IF  RIGHT$ (S$,1) = "S" THEN S$ =  LEFT$ (S$, LEN (S$) - 1): GOTO 4710
4715  IF  NOT C% THEN  RETURN 
4720 D% = C%:X = C%: IF M%(X,5) <  > HA AND M%(X,5) <  > WH THEN 4770
4750 F = F + 1: IF F = 1 THEN M = X
4760  IF S$ = M$(X) THEN M = X: RETURN 
4770  & R: IF C% <  > D% THEN 4720
4780  RETURN

Artifact search

4800  REM  

ARTIF SEARCH

4801 HA =  - 1:WH = HA:EM = HA: GOTO 4810
4804 HA =  - 1
4805 WH = RO:EM = RO + 200
4810  GOSUB 4600:F = 0:C% = 0:D% = 0: & S,S$,A$,C%: IF  NOT C% THEN  RETURN 
4820  FOR X = 1 TO NA
4830 D% = C%:A2 = A%(C%,4): IF A2 = WH OR A2 = HA OR A2 = EM THEN F = F + 1:A = C%: IF S$ = A$(C%) THEN X = 999: NEXT : RETURN 
4850  & R: IF C% <  > D% THEN  NEXT : RETURN 
4860 X = 999: NEXT : IF F > 1 THEN  PRINT : PRINT "WHICH "S$" DO YOU WANT?":F = 0: POP : GOTO 99
4870  RETURN

Get S$

4900  REM 

GET S$

4905  IF  NOT LT THEN  POP : GOTO 100
4910  IF S$ = "" THEN  PRINT : PRINT C$(C)" WHO OR WHAT";: INPUT S$: GOTO 4900
4920  RETURN

Drop

5000  REM 

DROP

5010  GOSUB 4900: IF S$ = "ALL" THEN 5100
5030  GOSUB 4801: IF  NOT F THEN 91
5040 WT = WT - A%(A,3):A%(A,4) = RO: PRINT : PRINT A$(A)" DROPPED.": GOSUB 54
5042  IF A = LS THEN LS = 0:LT = NL: PRINT : PRINT "THE "A$(A)" GOES OUT.": GOSUB 54
5050  IF WT > 10 * M%(0,1) THEN  PRINT "YOU SUDDENLY FIND YOU CANNOT CARRY ALL  OF THE ITEMS YOU ARE CARRYING, AND THEY ALL FALL TO THE GROUND.":L = L + 3: GOTO 5100
5060  IF A = M%(0,8) THEN M%(0,8) =  - 1
5070  GOTO 300
5100  GOSUB 51:B% = NA:D% =  - 1: FOR A = 1 TO NA:C% = A: & A,D%,A%(C%,4),C%,B%: IF  NOT C% THEN A = 999: GOTO 5150
5110 A = C%: PRINT A$(A)" DROPPED.":A%(A,4) = RO: GOSUB 52
5150  NEXT :WT = 0:M%(0,8) =  - 1: GOTO 300

Descriptions

Examine

6000  REM 

EXAMINE

6010  GOSUB 4900: GOSUB 4804: IF  NOT F THEN 6040
6020  IF A%(A,4) = EM THEN A%(A,4) = RO
6032  IF A > NZ THEN  PRINT : PRINT "THIS IS YOUR "A$(A)".": GOTO 98
6033  IF A%(A,2) = 8 THEN A%(A,8) = 0
6034  IF A%(A,2) = 6 THEN  PRINT "  - THERE ARE "A%(A,6)" SWALLOWS LEFT.": GOSUB 56
6035 R = A + 200: GOSUB 45:A%(A,0) = 1: GOTO 300
6040  GOSUB 4700: IF  NOT F THEN  PRINT : PRINT "YOU SEE NOTHING SPECIAL.": GOTO 98
6050 R = M + 600: GOSUB 45:DF = M: IF M%(M,3) > 1 AND M%(M,13) = 0 THEN  PRINT "THEY ARE ";: GOSUB 7652: GOTO 300
6060 DF = M:D2 = 0: GOSUB 7637: GOTO 300

Look

6500  REM 

LOOK

6510 V%(RO) = 0: GOTO 300

Combat

Attack

7000  REM 

ATTACK

7010  IF M%(0,8) =  - 1 THEN  PRINT : PRINT "YOU HAVE NO WEAPON READY!": GOTO 100
7020 TA = 0: GOSUB 4900: GOSUB 4700: IF F THEN 7300
7030 HA = RO: GOSUB 4805: IF  NOT F THEN 94
7040  IF A%(A,2) <  > 8 AND A%(A,2) <  > 4 THEN  PRINT : PRINT "WHY WOULD YOU DO THAT?": GOTO 99
7050 D = M%(0,9):S = M%(0,10): IF TA = 1 THEN D = 2:S = 5
7060 SX = 7:K = 6: IF A%(A,2) = 4 THEN SX = SX - 1:K = K - 1
7070 D2 = 0: FOR X = 1 TO D:D2 = D2 +  RND (1) * S - 1: NEXT :A%(A,SX) = A%(A,SX) - D2: IF A%(A,SX) < 1 THEN A%(A,SX) = 0:A%(A,K) = 0:A%(A,7) = 1: PRINT : PRINT "THE "A$(A)" SHATTERS!": GOTO 98
7075  IF A%(A,2) = 8 THEN A%(A,8) = 0
7080  PRINT : PRINT "WHAM!! YOU "; MID$ ("HITBLAST",TA * 3 + 1,3 + TA * 2);" THE "A$(A);"!": GOTO 98
7300 OF = 0:DF = M: GOSUB 7500: IF  NOT HI THEN 7360
7310  IF HI THEN  IF UP THEN WA%(W2) = WA%(W2) + 2
7360  IF M%(DF,11) = 1 OR DF = 0 THEN 300
7370  IF M%(DF,11) > 1 THEN M%(DF,11) = 1 + (M%(DF,11) = 3) * 150:R3 = RO: GOSUB 3600: GOTO 300

Pick up weapon

7400  REM 

MONS P/U WEAP

7410 M2 =  ABS (M%(OF,8) + 1): IF A%(M2,4) = RO THEN 7440
7420 M2 = 0: FOR A = 1 TO NA: IF A%(A,4) = RO THEN  IF A%(A,2) = 2 OR A%(A,2) = 3 THEN A2 = A%(A,7) * A%(A,8): IF A2 > M2 THEN M2 = A
7430  NEXT 
7440  IF M2 THEN  PRINT M$(OF)" PICKS UP "A$(M2)".": PRINT :A%(M2,4) =  - OF - 1:M%(OF,8) = M2
7450  GOTO 56

Do battle

7500  REM 

DO BATTLE

7505 HI = 0:W = M%(OF,8): IF W < 0 THEN 7400
7507 WM = 50 + 2 * (M%(OF,2) - M%(DF,2) - M%(OF,7) + M%(DF,7)): IF W > 0 THEN WM = WM + A%(W,5) / 2: IF OF = 0 THEN WM = WM + WA%(W2) / 4 + EA
7510 A = A%(W,6) * (W > 0): PRINT M$(OF)" "BV$(A, RND (1) * 3)" AT "M$(DF)
7511  GOSUB 52:RL = 100 *  RND (1): IF (RL < 5 OR RL < WM) AND RL < 97 THEN HI = 1: GOTO 7600
7515 A2 = 0: IF M%(DF,8) > 0 THEN A2 = A%(M%(DF,8),6)
7520  IF RL < 97 OR  NOT W THEN  PRINT " --"RB$(A2, RND (1) * 2)"!": GOTO 56
7525  PRINT " ..A FUMBLE!": GOSUB 52:R = 100 *  RND (1): IF R < 41 THEN  PRINT "  FUMBLE RECOVERED.": GOTO 56
7530  IF R < 81 THEN  PRINT "  WEAPON DROPPED!":WT = WT - ((OF = 0) * A%(W,3)):A%(W,4) = RO:M%(OF,8) =  - OF - 1: GOTO 56
7532  IF A%(W,2) = 3 THEN  PRINT "SPARKS FLY FROM "A$(W)"!": GOTO 56
7535  IF R > 95 THEN 7545
7537  IF R < 91 THEN  PRINT "  WEAPON DAMAGED!":A%(W,8) = A%(W,8) - 1: IF A%(W,8) THEN 56
7540  PRINT "  WEAPON BROKEN!":WT = WT - ((OF = 0) * A%(W,3)):A%(W,4) = 0::M%(OF,8) =  - 1: IF  RND (1) > .5 THEN 54
7545  PRINT "  WEAPON HITS USER!": GOSUB 54:DF = OF: ON (R = 100) + 1 GOTO 7605,7610
7600  IF  NOT OF THEN UP = (100 *  RND (1) > WM + WA%(W2)): IF  RND (1) * 100 < WA%(W2) THEN  IF  ABS (EA) > 10 *  RND (1) AND AE < AC * AC THEN AE = AE + 2:EA = AE - AC * AC
7605 D = M%(OF,9):S = M%(OF,10): IF W THEN D = A%(W,7):S = A%(W,8)
7607 A = 1: PRINT  MID$ (" ** ++",(DF > 0) * 3 + 1,3);: IF RL > 5 THEN  PRINT "A HIT!": GOTO 7633
7610  PRINT "WELL STRUCK!": GOSUB 52:R2 = 100 *  RND (1): IF R2 < 51 THEN A = 0: GOTO 7633
7615 RL = 1.5: IF R2 > 85 THEN RL = 2
7620  IF R2 > 95 THEN RL = 3
7625  IF R2 = 100 THEN RL = M%(DF,1)
7630 S = RL * S
7633  GOSUB 52:D2 = 0: FOR D3 = 1 TO D:D2 = D2 + S *  RND (1): NEXT :D2 =  INT (D2 - A * M%(DF,7)): IF D2 < 1 THEN  IF  NOT M%(DF,7) THEN  PRINT "   BLOW TURNED!": GOTO 56
7635  IF D2 < 1 THEN  PRINT "   BLOW GLANCES OFF ARMOR!": GOTO 56
7636  GOSUB 51
7637  GOSUB 52: IF M%(DF,3) > 1 THEN  PRINT "ONE ";
7638  PRINT M$(DF)" IS ";
7640 A = M%(DF,11):F(A) = F(A) + D2:M%(DF,13) = M%(DF,13) + D2: IF M%(DF,13) >  = M%(DF,1) THEN 7700
7650  ON M%(DF,13) * 5 / M%(DF,1) + 2 - (M%(DF,13) = 0) GOTO 7652,7655,7660,7665,7670,7675
7652  PRINT "IN PERFECT HEALTH.": GOTO 56
7655  PRINT "OK.": GOTO 56
7660  PRINT "HURT.": GOTO 56
7665  PRINT "BADLY HURT.": GOTO 56
7670  PRINT "GRAVELY INJURED.": GOTO 56
7675  PRINT "DYING.": GOTO 56
7700  REM 
MONSTER DIES
7710  PRINT "DEAD!":F(A) = F(A) + M%(DF,1) - M%(DF,13): IF M%(DF,3) > 1 THEN M%(DF,3) = M%(DF,3) - 1:M%(DF,13) = 0: GOTO 56
7720 M%(DF,5) = 0:M%(DF,3) = M%(DF,12): FOR A2 = 1 TO NA: IF A%(A2,4) =  - DF - 1 THEN A%(A2,4) = RO
7730  NEXT :M%(DF,8) =  - 1
7735  REM A%(DF+X-1,4)=RO:REMREPLACE 'X' WITH ART. # OF FIRST DEAD MONS. IF YOU ARE USING DEAD MONS.
7740  IF DF = 0 THEN DI = 1: POP : GOTO 32000
7750  IF F(1) =  > T(1) THEN T(1) = 0
7900  GOTO 56

Flee

8000  REM 

FLEE

8010  IF  NOT T(1) THEN  PRINT : PRINT "THERE'S NOTHING TO FLEE FROM!": PRINT : GOTO 100
8020  IF NX = 0 THEN  PRINT : PRINT "THERE'S NO PLACE TO GO!": GOTO 100
8030  IF S$ = "" THEN 8500
8040 SL =  LEN (S$): FOR X = 1 TO ND: IF S$ =  LEFT$ (C$(X),SL) THEN D = X:X = 99
8050  NEXT : GOTO 3030
8500 R2 = RD%(ND *  RND (1) + 1): IF R2 < 1 OR R2 > NR THEN 8500
8510  GOTO 3500

Give

9000  REM 

GIVE

9010  IF S$ THEN Q$ = " TO ":Q = 4: GOSUB 9800
9040  IF A$ = "" THEN  INPUT "GIVE WHAT?";A$
9050  IF  VAL (A$) = 0 THEN S$ = A$: GOSUB 4801: IF  NOT F THEN 91
9060  IF B$ = "" THEN  INPUT "TO WHOM?";B$
9070 S$ = B$: GOSUB 4700: IF  NOT F THEN 96
9080  PRINT : PRINT "OKAY.": IF  VAL (A$) > 0 THEN 9500
9090  IF A = M%(0,8) THEN M%(0,8) =  - 1
9095  IF A%(A,2) = 6 THEN  IF M%(M,13) AND A%(A,6) AND A%(A,7) THEN 9300
9100 WT = WT - A%(A,3):A%(A,4) =  - M - 1
9110  IF M%(M,8) < 0 THEN  IF A%(A,2) = 2 OR A%(A,2) = 3 THEN M%(M,8) = A
9115  IF M%(M,11) < 3 THEN M%(M,11) = 100 + M%(M,11) * (30 + A%(A,1) / 100)
9120 R3 = RO: GOSUB 3600: GOTO 5050
9300  PRINT : PRINT M$(M)" DRINKS THE "A$(A): PRINT "  THEN RETURNS IT TO YOU.":L = L + 3: GOSUB 51: IF M%(M,11) < 3 THEN M%(M,11) = 140 + 60 * M%(M,13) / M%(M,1):A%(A,6) = A%(A,6) - 1
9320 M%(M,13) = M%(M,13) - A%(A,5):M%(M,13) = M%(M,13) * (M%(M,13) > 0):DF = M:D2 = 0: GOSUB 7637: GOTO 9120
9500 SL =  VAL (A$): IF SL > GO THEN 91
9540 GO = GO - SL: IF M%(M,11) < 3 THEN M%(M,11) = 101 + M%(M,11) * SL / 100
9550  GOTO 9120

Parse

9800  REM 

PARSE

9810 A$ = "":B$ = "": FOR X = 1 TO  LEN (S$): IF  MID$ (S$,X,Q) = Q$ AND X > 2 THEN B$ =  MID$ (S$,X + Q):A$ =  LEFT$ (S$,X - 1):X = 999
9820  NEXT : RETURN

Inventory

10000  REM 

INVEN

10010  IF S$ = "" THEN M = 0:X =  - 999: GOTO 10060
10020  IF  NOT LT THEN 100
10030  GOSUB 4700: IF  NOT F THEN 96
10040  IF M%(M,11) <  > 3 THEN  FOR M = M TO M: GOTO 15030
10050 X =  - M - 1: GOTO 10100
10060 M2 = 0:B% = NA:D% =  - 999: FOR A = 1 TO NA:C% = A: & A,D%,A%(C%,4),C%,B%: IF  NOT C% THEN A = 999: GOTO 10090
10070  IF  NOT M2 THEN M2 = 1: PRINT : PRINT M$(M)" IS WEARING:": GOSUB 54
10080 A = C%: PRINT " "A$(A)
10090  NEXT :X =  - 1
10100  PRINT : PRINT M$(M)" IS CARRYING:": GOSUB 54
10110 LK = 0:B% = NA:D% = X: FOR A = 1 TO NA:C% = A: & A,D%,A%(C%,4),C%,B%: IF  NOT C% THEN A = 999: GOTO 10130
10120 LK = 1:A = C%: PRINT " "A$(A);: IF A = M%(M,8) THEN  PRINT " (READY WEAPON)";
10130  GOSUB 51: NEXT : IF  NOT LK THEN  PRINT " (NOTHING)": GOSUB 51
10140  IF  NOT M THEN  PRINT " ";GO;" GOLD PIECES.": GOSUB 54:DF = M:D2 = 0: GOSUB 7638
10150  GOTO 300

Magic spells

Blast

11000  REM 

BLAST

11010 S = 0: GOSUB 11500: GOSUB 4900: GOSUB 4700: IF  NOT F THEN TA = 1: GOTO 7030
11050  PRINT : PRINT "DIRECT HIT!": PRINT :L = L + 3:S = 5:D = 2:DF = M:A = 0: GOSUB 7635: PRINT : GOTO 300
11500 SU = 0: IF SA%(S) THEN RL = 100 *  RND (1):SU = (((RL < S2%(S)) OR (RL < 5)) AND (RL < 95))
11505  IF RL = 100 THEN  PRINT : PRINT "SPELL BACKLASH!!  YOUR ABILITY TO CAST  THIS SPELL TEMPORARILY DIMINISHES!":S2%(S) = S2%(S) / 10: POP : GOTO 98
11510  IF  NOT SU THEN  PRINT : PRINT "NOTHING HAPPENED.": POP : GOTO 98
11520 RL = 100 *  RND (1): IF RL > S2%(S) THEN S2%(S) = S2%(S) + 2:SA%(S) = SA%(S) + 2
11530 S2%(S) = S2%(S) * .8
11540  RETURN

Heal

12000  REM 

HEAL

12010 S = 1: GOSUB 11500:M = 0: IF S$ <  > "" THEN  GOSUB 4700
12040  GOSUB 56: IF M%(M,13) THEN  PRINT M$(M)"'S HEALTH IMPROVES!"
12050 M%(M,13) = M%(M,13) - 3 - 10 *  RND (1): IF M%(M,13) < 0 THEN M%(M,13) = 0
12060 DF = M:D2 = 0: GOSUB 7637: GOTO 300

Power

13000  REM 

POWER

13010 S = 3: GOSUB 11500:RL =  RND (1) * 100: IF RL < 11 AND M%(0,13) THEN  PRINT : PRINT "YOUR WOUNDS HEAL!":M%(0,13) = 0: GOTO 98
13050  IF RL < 91 THEN  PRINT : PRINT "YOU HEAR A VERY LOUD SONIC BOOM": PRINT "   THAT ECHOES THROUGH THE TUNNELS.": PRINT : GOSUB 52: GOTO 98
13070  FOR M = 1 TO NM: IF M%(M,5) = RO THEN  PRINT M$(M)" HEALS!": GOSUB 51:M%(M,13) = 0
13080  NEXT :R3 = RO: GOSUB 3600: GOTO 300

Speed

14000  REM 

SPEED

14010 S = 2: GOSUB 11500
14020  IF SP THEN  PRINT : PRINT "NOTHING HAPPENED": GOTO 98
14040 M%(0,2) = M%(0,2) * 2:SP = SP + 25 *  RND (1) + 10: PRINT : PRINT "YOUR MOVEMENTS QUICKEN!": GOTO 98

Other commands

Smile

15000  REM 

SMILE

15005  IF  NOT LT THEN 100
15010  PRINT : FOR M = 1 TO NM: IF M%(M,5) <  > RO THEN  NEXT : GOTO 300
15030  GOSUB 52: PRINT M$(M);: IF M%(M,3) > 1 THEN  PRINT "S";
15040  PRINT " "SM$(M%(M,11));: IF M%(M,3) = 1 THEN  PRINT "S";
15050  PRINT " AT YOU."
15100  NEXT : GOSUB 51: GOTO 300

Say

16000  REM 

SAY

16010  GOSUB 4900
16900  PRINT : PRINT "OKAY, " CHR$ (34)S$ CHR$ (34): PRINT : GOTO 98

Ready

17000  REM 

READY

17010  GOSUB 4900: GOSUB 4801: IF  NOT F THEN 91
17030  IF A%(A,2) < 2 OR A%(A,2) > 3 THEN  PRINT : PRINT "THAT ISN'T A WEAPON!": GOTO 99
17100 M%(0,8) = A:M%(0,9) = A%(A,7):M%(0,10) = A%(A,8):W2 = A%(A,6): PRINT : PRINT A$(A)" READIED.": GOTO 98

Save

18000  REM 

SAVE

18010  PRINT : PRINT "DO YOU WANT TO SAVE THIS GAME? ": PRINT "(Y/N) :";
18020  GET A$: IF A$ <  > "Y" AND A$ <  > "N" THEN 18020
18030  PRINT A$: IF A$ = "N" THEN 100
18040  PRINT D$"CLOSE":X =  FRE (0): PRINT D$"BSAVE GAME.PTRS,A$69,L8"
18060  PRINT D$"BSAVE GAME.SVAR,A" PEEK (105) +  PEEK (106) * 256",L" PEEK (109) +  PEEK (110) * 256 -  PEEK (105) -  PEEK (106) * 256 + 1
18070  PRINT D$"BSAVE GAME.STR,A" PEEK (111) +  PEEK (112) * 256",L" PEEK (115) +  PEEK (116) * 256 -  PEEK (111) -  PEEK (112) * 256 + 1
18080  PRINT : PRINT "THE GAME IS NOW SAVED. YOU CAN BOOT THISDISKETTE, OR RUN THE PROGRAM 'MAIN PGM' TO RESTART THE GAME."
18090  PRINT : PRINT : INPUT "RESUME PLAY? ";A$: IF  LEFT$ (A$,1) <  > "N" THEN 29060
18100  END

Light

19000  REM 

LIGHT

19010  GOSUB 4910: GOSUB 4801: IF  NOT F THEN 91
19040  PRINT :LT = NL: IF A%(A,2) <  > 5 OR A%(A,5) < 1 THEN  PRINT "IT WON'T LIGHT!": GOTO 98
19050 LT = 1:LS = A: PRINT "YOU'VE MANAGED TO LIGHT THE "A$(A)".": GOTO 98

Open

20000  REM 

OPEN

20010  GOSUB 4900: GOSUB 4804: IF  NOT F THEN 20060
20020  IF A%(A,4) = RO + 200 THEN A%(A,4) = RO
20030  GOSUB 51:X = A%(A,2): IF X = 4 OR X = 6 OR X = 7 THEN 20100
20050  IF X = 8 THEN 20300
20060  IF S$ = "DOOR" OR S$ = "GATE" THEN  PRINT "TRY GOING IN THAT DIRECTION.": GOTO 99
20070  PRINT "IT WON'T OPEN.": GOTO 99
20100  REM 
OPENABLE
20110  IF A%(A,7) THEN  IF X = 6 OR X = 7 THEN  PRINT : PRINT "IT IS ALREADY OPEN.": GOTO 98
20120  IF X = 4 THEN A%(A,8) = 0: IF A%(A,5) AND A%(A%(A,5),4) <  >  - 1 THEN  PRINT "IT'S LOCKED!": GOTO 99
20130 A%(A,7) = 1: PRINT : PRINT "OPENED.": IF X = 6 OR X = 7 THEN  GOTO 98
20200  REM 
CONT.
20220  GOSUB 54:LK = 0: FOR X = 1 TO NA: IF A%(X,4) = A + 500 THEN A%(X,4) = RO:LK = 1
20230  NEXT : PRINT "YOU FIND " MID$ ("NOSOME",LK * 2 + 1,2 + 2 * LK)"THING INSIDE.": GOTO 98
20300  REM 
DOOR
20310  IF A%(A,6) > 0 THEN  IF A%(A%(A,6),4) <  >  - 1 THEN  PRINT "IT'S LOCKED!": GOTO 99
20330 A%(A,8) = 0:A%(A,6) = 0:A%(A,4) = RO: PRINT "YOU'VE OPENED THE "A$(A)".": FOR X = 1 TO ND: IF RD%(X) = A + 500 THEN RD%(X) = A%(A,5)
20340  NEXT : GOTO 98

Put

21000  REM 

PUT

21010  IF S$ THEN Q$ = " IN ":Q = 4: GOSUB 9800: IF A$ = "" THEN Q$ = " ON ":Q = 4: GOSUB 9800
21040  IF A$ = "" THEN  PRINT : INPUT "PUT WHAT?";A$: INPUT "PUT IN/ON WHAT?";B$
21100 S$ = A$:M = 0: GOSUB 4804: IF  NOT F THEN 21150
21110 Z = A:S$ = B$: GOSUB 4804: IF A = Z OR  NOT F THEN 21150
21120  IF A%(A,2) <  > 4 THEN 21150
21130  IF  NOT A%(A,7) THEN 92
21140 A%(Z,4) = A + 500: PRINT : PRINT "OKAY.": GOTO 98
21150  PRINT : PRINT "YOU CAN'T DO THAT.": GOTO 98

Drink

22000  REM 

DRINK

22010  GOSUB 4900: GOSUB 4804: IF  NOT F THEN 94
22020  IF A%(A,2) <  > 6 THEN 94
22030  IF  NOT A%(A,7) THEN 92
22110  IF A%(A,6) < 1 THEN  PRINT : PRINT "THERE'S NONE LEFT.": GOTO 98
22130 A%(A,6) = A%(A,6) - 1:M%(0,13) = M%(0,13) - A%(A,5): PRINT : PRINT "YOU FEEL " MID$ ("BETTERWORSE",(A%(A,5) < 0) * 6 + 1,6)"!": IF M%(0,13) < 0 THEN M%(0,13) = 0
22140  GOSUB 54:DF = 0:D2 = 0: GOSUB 7638
22190  GOTO 300

Read

23000  REM 

READ

23010  GOSUB 4900: GOSUB 4804: IF  NOT F THEN 94
23020  IF A%(A,2) <  > 7 THEN 94
23030  IF  NOT A%(A,7) THEN 92
23040  PRINT : PRINT "IT SAYS:":L = L + 2
23210  PRINT : FOR X = 1 TO A%(A,6):R = A%(A,5) + 399 + X: GOSUB 45: NEXT : GOTO 300

Free

24000  REM 

FREE

24010  GOSUB 4900: GOSUB 4804: IF  NOT F THEN 94
24020  IF A%(A,2) <  > 10 THEN 94
24030 M = A%(A,5):K = A%(A,6):G = A%(A,7)
24120  IF M%(G,5) = RO THEN  PRINT : PRINT M$(G)" WON'T LET YOU DO THAT!": GOTO 98
24130  IF A%(K,4) <  >  - 1 AND K <  > 0 THEN  PRINT : PRINT "YOU DON'T HAVE THE KEY!": GOTO 100
24150  PRINT : PRINT "YOU HAVE FREED "M$(M)".":M%(M,5) = RO:A%(A,4) = 0:R3 = RO: GOSUB 3600: GOTO 98

Request

25000  REM 

REQUEST

25010  IF S$ THEN Q$ = " FROM ":Q = 6: GOSUB 9800
25040  IF A$ = "" THEN  GOSUB 4900:A$ = S$: INPUT "FROM WHOM?";B$
25050 S$ = B$: GOSUB 4700: IF  NOT F THEN 96
25060  IF M%(M,11) < 2 THEN  FOR M = M TO M: GOTO 15030
25070 S$ = A$:HA = ( - M - 1):WH = HA:EM = HA: GOSUB 4810: IF  NOT F THEN  PRINT : PRINT M$(M)" DOESN'T HAVE IT.": GOTO 98
25080  PRINT : PRINT "OKAY.": GOSUB 54:A%(A,4) =  - 1:WT = WT + A%(A,3): IF A = M%(M,8) THEN M%(M,8) =  - M - 1
25090  GOTO 5050

Wear

26000  REM 

WEAR

26010  GOSUB 4900:HA =  - 1:WH = RO:EM =  - 999: GOSUB 4810: IF  NOT F THEN 94
26015  IF A%(A,4) = EM THEN 26100
26020  IF A%(A,2) <  > 11 THEN 94
26030  IF  NOT A%(A,5) THEN 26080
26040  IF A%(A,5) = 1 AND SH THEN 26100
26050  IF A%(A,5) = 1 THEN SH = A:M%(0,7) = M%(0,7) + 1: GOTO 26080
26060  IF AR THEN 26100
26070 AR = A:M%(0,7) = M%(0,7) + AC / 2
26080 A%(A,4) =  - 999: PRINT : PRINT A$(A)" WORN.": GOTO 98
26100  PRINT : PRINT "YOU'RE ALREADY WEARING ONE!": GOTO 98

Remove

27000  REM 

REMOVE

27010  GOSUB 4900:HA =  - 999:EM = HA:WH = HA: GOSUB 4810: IF  NOT F THEN  PRINT : PRINT "YOU AREN'T WEARING IT.": GOTO 99
27020  IF A = SH THEN M%(0,7) = M%(0,7) - 1:SH = 0
27030  IF A = AR THEN M%(0,7) = M%(0,7) - A%(A,5) / 2:AR = 0
27040 A%(A,4) =  - 1: PRINT : PRINT A$(A)" REMOVED.": GOTO 98

Use

28000  REM 

USE

28010  REM ///INSERT YOUR OWN SPECIAL STUFF HERE
28900  PRINT : PRINT "TRY ANOTHER COMMAND.": GOTO 98

Resume game

29000  REM 

RESUME GAME

29005  POKE 216,0
29010  PRINT : PRINT "DO YOU WANT TO RESUME THE SAVED GAME?": PRINT "  Y OR N:";
29020  GET A$: IF A$ <  > "Y" AND A$ <  > "N" THEN 29020
29030  PRINT A$: IF A$ = "N" THEN  PRINT D$"DELETE GAME.PTRS": PRINT D$"DELETE GAME.SVAR": PRINT D$"DELETE GAME.STR": RUN 
29040  PRINT  CHR$ (4)"BLOAD GAME.PTRS": PRINT  CHR$ (4)"BLOAD GAME.SVAR": PRINT  CHR$ (4)"BLOAD GAME.STR"
29050  PRINT  CHR$ (26)"1": PRINT  CHR$ (21): HOME : IF CP = 80 THEN  PRINT D$;"PR#3": PRINT  CHR$ (12): HOME 
29060  PRINT D$"OPEN"ED$",L242": PRINT D$"OPEN"ER$",L"LR
29070 F = 0:A$ = "":CZ$ = "": GOTO 100

Initialize

31000  REM 

INIT

31005 ER$ = "EAMON.ROOMS":ED$ = "EAMON.DESC"
31010  POKE 216,0: PRINT D$"OPEN"ED$: PRINT D$"READ"ED$: INPUT NR,NZ,NE,NM,LR,LM,LA: PRINT D$"CLOSE"
31015 NA = NZ + 6: DIM A$(NA),A%(NA,8),M$(NM),M%(NM,13),V%(NR),SA%(3),S2%(3),SM$(3),BV$(5,2),RB$(5,1),WA%(5)
31020  PRINT D$"OPEN EAMON.ARTIFACTS,L"LA: FOR A = 1 TO NZ: PRINT D$"READ EAMON.ARTIFACTS,R"A: INPUT A$(A): FOR A2 = 1 TO 8: INPUT A%(A,A2): NEXT 
31030  NEXT : PRINT D$"OPEN EAMON.MONSTERS,L"LM: FOR A = 1 TO NM: PRINT D$;"READ EAMON.MONSTERS,R"A: INPUT M$(A): FOR A2 = 1 TO 11: INPUT M%(A,A2)
31035  NEXT :M%(A,12) = M%(A,3):M = M%(A,6) * M%(A,3):M%(A,6) = 31000: IF M < M%(A,6) THEN M%(A,6) = M
31038  NEXT 
31039  REM GOTO 33500:REMFAST.START
31040  PRINT D$"OPEN FRESH MEAT": PRINT D$"READ FRESH MEAT": INPUT RE: INPUT M$(0),M%(0,1),M%(0,2),CH: FOR A = 0 TO 3: INPUT SA%(A):S2%(A) = SA%(A): NEXT : FOR A = 1 TO 5: INPUT WA%(A): NEXT : INPUT AE,SE$,GO,BA,AC
31050 NA = NZ: FOR A = NZ + 1 TO NZ + 4: INPUT A$(A),A%(A,6),A%(A,5),A%(A,7),A%(A,8)
31052  IF A$(A) <  > "NONE" THEN NA = NA + 1:A%(A,2) = 2 + (A%(A,7) * A%(A,8) > 25):A%(A,3) = 2:A%(A,4) =  - 1:WT = WT + 2
31054  NEXT : PRINT D$"CLOSE"
31055  REM ?D$"DELETE FRESH MEAT"
31060  PRINT D$"OPEN"ED$",L242": PRINT D$"OPEN"ER$",L";LR:M%(0,8) = NZ + 1:M%(0,9) = A%(NZ + 1,7):M%(0,10) = A%(NZ + 1,8)
31080  FOR W2 = NZ + 1 TO NA
31090  FOR A = 1 TO NZ: IF A$(A) = A$(W2) THEN A$(A) = A$(A) + "#":A = 999: NEXT : GOTO 31090
31100  NEXT : NEXT :B% = AC / 2: IF B% THEN NA = NA + 1:AR = NA:A$(NA) =  MID$ ("LEATHER    CHAIN MAIL PLATE ARMOR",B% * 11 - 10,7 + 3 * (B% > 1) + B%( > 2)):A%(NA,2) = 11:A%(NA,3) = B% * 7:A%(NA,4) =  - 999:WT = WT + B% * 7:A%(NA,5) = B% * 2
31110 SH = ( INT (AC / 2) <  > AC / 2): IF SH THEN NA = NA + 1:SH = NA:A$(NA) = "SHIELD":A%(NA,2) = 11:A%(NA,3) = 10:A%(NA,4) =  - 999:WT = WT + 10:A%(NA,5) = 1
31111 M%(0,7) = B% + (SH > 0):M%(0,11) = 3
31120 EA = 0: IF AE < AC * AC THEN EA = AE - AC * AC
31130  READ NC: DIM C$(NC + 3): FOR C = 1 TO NC: READ C$(C): NEXT :CC =  INT (NC / 3) + 1:R2 = 1
31140 W2 = 0:RO = 1:ND = 6:FF$ =  CHR$ (12)
31410  FOR A = 1 TO 3: READ SM$(A): NEXT 
31420  FOR A = 0 TO 5: FOR A2 = 0 TO 2: READ BV$(A,A2): NEXT : NEXT : FOR A = 0 TO 5: FOR A2 = 0 TO 1: READ RB$(A,A2): NEXT : NEXT 
31430 L = 50:CP =  PEEK (768): IF CP <  > 80 THEN CP = 40
31440 W2 = A%(M%(0,8),6)
31900  GOTO 3500
31910  DATA 32
31920  DATA NORTH,SOUTH,EAST,WEST,UP,DOWN,GET,DROP,LOOK,EXAMINE,ATTACK,FLEE,GIVE,INVENTORY,BLAST,HEAL,POWER,SPEED,SMILE,SAY,READ,READY,SAVE,LIGHT,OPEN,PUT,DRINK,FREE,REQUEST,WEAR,REMOVE,USE
31930  REM (INSERT ADDITIONAL COMMANDS HERE)
31940  DATA GROWL,LOOK,SMILE
31945  DATA LUNGES,TEARS,CLAWS,SWINGS,CHOPS,SWINGS,SHOOTS,SHOOTS,SHOOTS,SWINGS,SWINGS,SWINGS,STABS,LUNGES,JABS,SWINGS,CHOPS,STABS
31950  DATA MISSED,MISSED,PARRIED,MISSED,MISSED,MISSED,PARRIED,MISSED,PARRIED,MISSED,PARRIED,MISSED

Closing routines

32000  REM 

DONE

32010  PRINT : POKE  - 16368,0: GOSUB 59: PRINT 
32020  PRINT D$"CLOSE": IF SP THEN M%(0,2) = M%(0,2) / 2
32030  IF DI THEN 32500
32040  DIM WP%(NA),WP$(NA): FOR W = 1 TO 4:WP$(W) = "NONE": NEXT :W2 = 0: FOR A = 1 TO NA: IF A%(A,4) =  - 1 THEN  IF A%(A,2) = 2 OR A%(A,2) = 3 THEN W2 = W2 + 1:WP$(W2) = A$(A):WP%(W2) = A:A%(A,4) = 0
32050  NEXT : IF W2 < 5 THEN 32300
32060  PRINT FF$: HOME : PRINT "AS YOU ENTER THE MAIN HALL, LORD WILLIAM CRANKHANDLE APPROACHES AND SAYS, 'YOU  HAVE TOO MANY WEAPONS -- 4 IS THE LEGAL LIMIT.": PRINT : PRINT "YOUR WEAPONS ARE:"
32070  FOR W = 1 TO W2: PRINT  SPC( 4);W;"--";WP$(W): NEXT : PRINT : PRINT "ENTER THE NUMBER OF THE WEAPON TO SELL     (1-";W2;") "
32080  VTAB  PEEK (37) + 1: INPUT A$:W5 =  VAL (A$): IF W5 < 1 OR W5 > W2 THEN 32080
32090 A%(WP%(W5),4) =  - 1:WP$(W5) = WP$(W2):WP%(W5) = WP%(W2):W2 = W2 - 1: IF W2 > 4 THEN 32060
32300  DIM WD%(4,4): FOR W = 1 TO 4: IF WP%(W) THEN A = WP%(W):WD%(W,1) = A%(A,6):WD%(W,2) = A%(A,5):WD%(W,3) = A%(A,7):WD%(W,4) = A%(A,8):A%(A,4) = 0
32310  NEXT : PRINT FF$: HOME : PRINT " YOU SELL YOUR GOODS TO THE LOCAL BUYER OF TREASURE (UNDER THE SIGN OF 3 BALLS).  HE PAYS YOU ";
32315 A%(SH,4) = 0:A%(AR,4) = 0
32320 TP = 0: FOR A = 1 TO NA: IF A%(A,4) =  - 1 THEN TP = TP + A%(A,1) * ((A%(A,2) <  > 0) * CH / 10 + (A%(A,2) = 0))
32350  NEXT :TP =  INT (TP): PRINT TP;" GOLD PIECES.": PRINT 
32360 GO = GO + TP: IF GO < 0 THEN GO = 0
32370  PRINT : GOSUB 59: PRINT 
32500  ONERR  GOTO 32510
32505  PRINT  CHR$ (26)"1": REM   TURN OFF VIDEX 80-COL
32506  PRINT  CHR$ (21): REM  TURN OFF //E 80-COL
32510  HOME : VTAB 5: PRINT "(INSERT EAMON MASTER DISKETTE, THEN": PRINT "   HIT THE 'C' KEY)  ";: POKE  - 16368,0
32520  GET A$: IF A$ <  > "C" THEN 32520
32530  PRINT A$
32540  IF DI THEN  PRINT D$"OPEN THE ADVENTURER": PRINT D$"DELETE THE ADVENTURER": GOTO 32900
32550  PRINT D$"OPEN CHARACTERS,L150": PRINT D$"WRITE CHARACTERS,R";RE: PRINT M$(0): PRINT M%(0,1): PRINT M%(0,2): PRINT CH: FOR A = 0 TO 3: PRINT SA%(A): NEXT 
32555 AC = M%(0,7) * 2: IF SH THEN AC = AC - 1
32560  FOR A = 1 TO 5: PRINT WA%(A): NEXT : PRINT AE: PRINT SE$: PRINT GO: PRINT BA: PRINT AC: FOR A = 1 TO 4: PRINT WP$(A): FOR M = 1 TO 4: PRINT WD%(A,M): NEXT : NEXT 
32570  PRINT D$"OPEN THE ADVENTURER": PRINT D$"WRITE THE ADVENTURER": PRINT M$(0): PRINT RE: PRINT D$"CLOSE"
32900  PRINT D$"RUN MAIN HALL"

Fast start

33000  REM 

FAST START

33005 HM =  PEEK (115) +  PEEK (116) * 256:A = HM - 290:A2 =  INT (A / 256): POKE 1014,A + 1 - A2 * 256: POKE 1015,A2: HIMEM: A:D$ =  CHR$ (4): PRINT D$"BLOAD EAMON 7.1 SEARCH ROUTINE,A"A + 1
33010  ONERR  GOTO 33020
33015  PRINT D$"VERIFY GAME.PTRS": GOTO 29000
33020  ONERR  GOTO 31000
33025  PRINT D$"VERIFY FS.PARMS": PRINT D$"OPEN FS.PARMS": PRINT D$"READ FS.PARMS": INPUT A: INPUT B: PRINT D$"CLOSE"
33030  IF  PEEK (105) +  PEEK (106) * 256 = A AND  PEEK (115) +  PEEK (116) * 256 = B THEN  PRINT  CHR$ (4)"BLOAD FS.PTRS": PRINT  CHR$ (4)"BLOAD FS.SVAR": PRINT  CHR$ (4)"BLOAD FS.STR": POKE 216,0: GOTO 31040
33035  PRINT  CHR$ (4)"DELETE FS.PARMS": GOTO 31000
33500 X =  FRE (0):A =  PEEK (105) +  PEEK (106) * 256:M =  PEEK (115) +  PEEK (116) * 256: PRINT D$"OPEN FS.PARMS": PRINT D$"WRITE FS.PARMS": PRINT A: PRINT M: PRINT D$"CLOSE"
33510  PRINT D$"BSAVE FS.PTRS,A$69,L8"
33520  PRINT D$"BSAVE FS.SVAR,A"A",L" PEEK (109) +  PEEK (110) * 256 - A + 1
33530  PRINT D$"BSAVE FS.STR,A" PEEK (111) +  PEEK (112) * 256",L"M -  PEEK (111) -  PEEK (112) * 256 + 1
33540  GOTO 31040

Variables

Per the revised Eamon Dungeon Designer's Manual, the following are the variables used throughout the Main Program:

Variable Description
A%(x,y) Artifact data. x is the artifact number and y is one of the following:
0 = "Seen" flag
1 = Artifact's value
2 = Artifact's type, from 0 to 11
3 = Artifact's weight
4 = Room where the artifact is located
5 through 8 = Additional data; see manual for list
AC Armor. Initialized on line 32555.
AR Armor worn
AE Armor expertise
A$(*) Artifact names
BA Gold in bank
BV$(*) Battle verbs
C Number of command given
C$(*) Valid commands
CH Charisma
CP Columns (40 or 80)
CZ$ Last command
D2 Damage to defender
DF Defender
Dl 1=Adventurer died
D$ Control-D. Whenever the program runs a disk command, DOS requires that it be preceded by Control-D, invoked using CHR$(4). Initialized on line 33005.
EA Player armor factor
ED$ "EAMON.DESC"
ER$ "EAMON.ROOMS"
F "Found" flag used by search routines
F(*) Damage to each side in combat
FlF2 Top of free memory
FR Fumble roll/friend rating
GO Player's gold
HI Hit in combat
L Line counter for screen pause
LA Record length of EAMON.ARTIFACTS
LM Record length of EAMON.MONSTERS
LR Record length of EAMON.ROOMS
LL String length
LS Artifact number of current light source
LT Light level of room (includes artificial light)
M%(x,y) Monster data: "x" is monster number, 2nd is:
0="Seen" flag
1=Hardiness
2=Agility
3=# members in group
4=Courage
5=Room
6=Weight
7=Armor
8=Weapon #
9=# Dice
10=# Dice sides
11=Friendliness
12=Original size of group
13=Damage
M$(*) Monster names
MC Counter for group monsters in battle
MR% Monster morale
NA Number of artifacts
NC Number of commands
NE Number of effects
NL Natural light level of room
NM Number of monsters
NR Number of rooms
NW Number of weapons
NZ Number of artifacts in EAMON.ARTIFACTS
OF Attacker
R2 Room being moved to
R3 Room just exited
RB$(*) Battle response verbs
RD%(*) Room connections
RE Adventurer record in char file on Master disk
RL Random number from 1 to 100
RN$ Name of current room
RO Number of room the adventurer is in
S$ Object of command
S2%(*) Current spell ability
SA%(*) Total spell ability
SE$ Sex (M/F)
SH Shield worn
SL String length
SM$(*) Smile verbs
SP Counter for speed spell
SU Spell succeeded
SY Artifact number of synonym match
SY$ Synonym
T(*) Hardiness of each side in combat
TP Value of loot
UP Logical flag if weapon ability up
V$ Verb of command
V%(*) Flag to print room description
WA%(*) Adventurer's weapon ability
WA$(*) Adventurer's weapons (exiting program)
WD%(*,*) Weapon data (exiting program)
WP%(*) Weapon pointer (exiting program)
WT Weight adventurer is carrying

External links