(This is the "Dungeon Designs" column from the June 1995 issue of the Eamon Adventurer's Guild newsletter.  Copyright 1995 Eamon Adventurer's Guild, 7625 Hawkhaven Dr., Clemmons, NC 27012-9408.  You may reproduce this freely as long as this credit remains attached to the article.)


A Tour of the MAIN PGM 7.1    (Part IV)

22000-22190 DRINK routine
22010 check for object S$; check if object is
      available; if not found then exit through
      error message at 94 (YOU CAN'T...)
22020 if object not drinkable then exit through
      error message at 94 (YOU CAN'T...)
22030 if not open then exit through error
      message at 92 (YOU MUST FIRST OPEN IT)
22110 if #uses less than one then print NONE
      LEFT; exit to PICK FOE through line
      counting routine
22130 decrement #uses; reduce/increase hits by
      Heal Amt; print FEEL BETTER or WORSE
      message; if hits reduced below zero then
      set to zero
22140 update line counter; proceed to DO BATTLE
      subroutine to print state of health
22190 exit to PICK FOE routine

23000-23210 READ routine
23010 check for object S$; check to see if
      object is available; if not then exit
      through error message at 94 (YOU CAN'T...)
23020 if not drinkable then exit through error
      message at 94 (YOU CAN'T...)
23030 if not open then exit through error at 92
23040 print IT SAYS:; update line count
23210 print Effects defined by artifact data;
      exit to PICK FOE routine

24000-24150 FREE routine
24010 check for object S$; check to see if
      object is available; if not then exit
      through error message at 94 (YOU CAN'T...)
24020 if not Bound Monster then exit through
      error message at 94 (YOU CAN'T...)
24030 set some temporary variables
24120 if guard is present then print WON'T LET
      YOU DO THAT message; exit to PICK FOE
      through line counting routine
24130 if key exists and not available then print
      DON'T HAVE KEY message; exit to YOU SEE
24150 print FREED message; put freed monster in
      room, remove bound monster; update
      monster alignments and group totals; exit
      to PICK FOE through line counting routine

25000-25090 REQUEST routine
25010 if object is named then run object through
      PARSE routine to see if it parses into
      full command (REQUEST XX FROM YY)
25040 if not full command then get object
      requested S$ and monster name B$
25050 check for monster named; if not present
      then exit through error message at 96
25060 if monster is enemy then exit through
      SMILE routine
25070 check to see if monster has it; if not
      print DOESN"T HAVE IT message; exit to
      PICK FOE through line counting routine
25080 print OKAY; update line count; transfer
      object from monster to player; increase
      weight carried WT by object's weight; if
      object was monster's ready weapon then
      mark him as unarmed
25090 exit through DROP routine to check for
      effects of object acquisition

26000-26100 WEAR routine
26010 check for object S$; check to see if
      object is available; if not then exit
      through error message at 94 (YOU CAN'T...)
26015 if object already worn then proceed to
      error message at 26100
26020 if not wearable then then exit through
      error message at 94 (YOU CAN'T...)
26030 if armor then proceed to 26080
26040 if armor and already carrying shield then
      proceed to error message at 26100
26050 if armor then update player data to show
      that shield is carried if armor class is
      odd number (eg: PLATE AND SHIELD)
26060 if already armored then proceed to error
      message at 26100
26070 set player's armor data to this artifact
26080 mark object as worn; print WORN; exit to
      PICK FOE through line count
26100 print ALREADY WEARING message; exit to
      PICK FOE through line counting routine

27000-27040 REMOVE routine
27010 check for object S$; check to see if
      object is available; if not then print
      AREN'T WEARING IT message; exit to YOU SEE
      through line counting routine
27020 if object is player's shield then remove
      shield from player data
27030 if object if player's armor then remove
      armor from player
27040 mark object as carried by player; print
      REMOVED message; exit to PICK FOE through
      line counting routine

28000-28900 USE routine
28900 print TRY ANOTHER COMMAND message; exit to
      PICK FOE through line counting routine

29000-29070 RESUME GAME routine
29005 turn off ONERR
29010 ask RESUME GAME?
29020 get answer
29030 if "N" then delete saved game and restart
      program
29040 BLOAD saved game variables and pointers
29050 set screen to 40-col.; if saved game was
      80-col. then set screen to 80-col.
29060 OPEN data files used during play
29070 preset command variables to no command;
      exit to YOU SEE routine

31000-31950 INIT routine
31005 set string variables to file names
31010 turn off ONERR; open EAMON.DESC; input
      database parameters; close file
31015 set # of Artifacts NA to number in
      database plus six for player's stuff;
      dimension all arrays
31020 input artifact data
31030 input monster data
31035 set up multiple monster numbers and group
      weight
31039 temporarily go to FAST.START code to save
      FAST.START info
31040 input player data from FRESH.MEAT file
31050 input player weapons into artifact array
31052 check for player weapons (name not
      "NONE"); increase # of artifacts variable
      NA for each one found; set weapon
      artifact type to "magic" if dice times
      sides exceeds 25; set weapon weight to 2;
      add weight to WT carried
31054 close open files
31055 delete FRESH.MEAT (disabled by REM)
31060 open EAMON.DESC and EAMON.ROOMS; set
      player Ready Weapon; set player dice and
      sides to that of Ready Weapon
31080 check player weapons for duplicate names
31090 if artifact name matches name of player's
      weapons then add "#" to front of artifact
      name; if rename is required then make
      second pass to ensure that no fresh name
      matches were generated
31100 check player's armor class AC and generate
      armor artifact to match; make wearable;
      set armor weight based on class of armor;
      mark as "worn"; add to weight carried; set
      armor class of artifact
31110 check player's armor class for shield and
      generate shield artifact if present; make
      it wearable; set weight to 10; mark as
      "worn"; add to weight carried; set armor
      class of artifact
31111 set player's armor to that of armor worn;
      mark player as "friendly"
31120 calculate effect of Armor Expertise and
      Armor Class
31130 read number of commands NC from data; dim
      command list array; read commands from
      data; calculate line breaks for listing
      commands; set next room R2 to 1
31140 set room to 1; set number of exit
      directions to 6; assign FF$ to the
      linfeed character (used by II+ 80-col.
      video cards to clear screen for HOME
      command)
31410 read SMILE responses into array
31420 read attack verbs into array; read attack
      result verbs into array
31430 set line counter to 50 to force HIT ANY
      KEY TO CONTINUE pause when game is ready
      to begin; set line length variable CP
      (used by line counter routine) to number
      held in memory location 768; if not 80
      then set CP to 40 (note: the intro
      program pokes 80 into location 768 if
      80-col. display was chosen)
31440 determine weapon type of Ready Weapon
31900 proceed to GO routine to set up Room 1
      and begin game
31910 DATA: number of commands
31920 DATA: commands
31930 space for additional commands
31940 SMILE responses
31945 attack verbs
31950 attack result verbs

32000-32900 DONE routine
32010 clear keyboard strobe so no keypress is
      pending; execute screen pause
32020 close open files; reset SPEED spell
32030 if dead then exit game
32040 compile list of weapons carried
32050 if fewer than 5 weapons carried then
      proceed to sell stuff
32060 print "TOO MANY WEAPONS" message
32070 list weapons carried; get number of weapon
      to sell
32080 put cursor on "sell" input line; get
      player input; if invalid weapon number
      than repeat this line
32090 remove "sold" weapon from list; if still
      more than 4 weapons then relist weapons

32300 assemble retained-weapon data in
      preparation for return to Main Hall
32310 print SELL GOODS message
32315 remove shield and armor from artifact data
32320 compute value of artifacts carried
32350 print computed value
32360 add value to gold carried; if value is
      less than zero then set to zero
32370 execute screen pause

32500 set up ONERR vector to recover if Master
      disk is not inserted as prompted
32505 turn off II+ (Videx) 80-col. mode
32506 turn off IIe 80-col. mode
32510 print INSERT EAMON MASTER message; clear
      keyboard strobe
32520 get keypress; if not "C" then again
32530 print keypress to screen
32540 if player is dead then delete THE
      ADVENTURER from Master disk to tell the
      Main Hall that no one is returning from
      an adventure
32550 open CHARACTERS and write player data
32555 write more player data to file
32560 write player weapons to file
32570 write player name and record number in THE
      ADVENTURER
32900 run MAIN HALL to exit program

33000-33540 FAST.START routine
33005 lower the top of free memory to make a
      protected place for the search routine
      code; BLOAD the search routine
33010 set ONERR vector to recover if no saved
      game is found
33015 check for presence of saved game
33020 set ONERR vector to recover if no
      FAST.START file is found
33025 check for presence of FAST.START PARMS;
      input memory freespace parms
33030 if current memory free space matches parms
      then BLOAD FAST.START info; reset ONERR
      flag; proceed to INIT routine at 31040 to
      set up and start game
33035 (this line will be run only if present
      memory setup does not match FAST.START
      parms) delete FAST.START parms info;
      proceed to start of INIT routine to load
      artifact and monster info

33500 generate current memory free space info
      and save as FAST.START parms info; close
      all files
33510 BSAVE FAST.START variable pointers
33520 BSAVE FAST.START variables
33530 BSAVE FAST.START strings
33540 proceed to INIT routine at 31040 to set up
      and begin game
