MoHP The Museum of HP Calculators


The Castle, an Adventure Game for the HP-41C

This program is Copyright © November 25, 1985 by Philippe Legros & Philippe Maryssael and is used here by permission. This program was originally a part of their personal HP-41c library. This program was transcribed by Philippe Legros.

This program is supplied without representation or warranty of any kind. Philippe Legros, Philippe Maryssael and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Contents

  1. Preface
  2. Description
  3. Operating Limits & Warnings
  4. Example
  5. User Instructions
  6. Program Listing
  7. Software Information
  8. References

Preface

The olden days are no longer and no longer shall they be. The waves of Time have all engulfed. Is there still anyone remembereth these bygone days when our land was all covered with vast and dark forests and only vague and hazy footpaths gave evidence of some furtive presence of man, who feared the inhospitable world into which he was once brought?... For to protect himself against that hostile environment whereby he was surrounded, he used to build up inaccessible and inpregnable castles behind the high and thick walls whereof he sought some safety and peace. Small communities had scattered about all over the Earth's surface up to the remotest, most hostile and most arid places. Yet they eventually managed to survive and knew work, pain, love, boredom, and even the most terrific evil of all: War. These wars were wars fought with swords and suits of armour, wars during which Heroism was characteristic of those brave men fighting hand to hand in restless fights until the enemy's bloody death...

In this twilight of History man was helpless and his Destiny was dedicated upon him by Forces beyond his control. Indeed, Mystery and Magic were those Forces actually making the rules for man who could do nothing but abide by them on pain of being sentenced to eternal sufferings no medecines, drugs or curing Philtres of any sort whatsoever could possibly heal. Many a King had to bow his head to these rules whereof Sorcerers, Witches, Wizards, and Magicians were the only interpreters effectively reigning with their left hands and ruling with their right. Over and above these tyranous rulers man's land was constantly being fought over by Elves, Dragons, Trolls and many more other types of infernal creatures.

As Time went on by, it little by little altered this scenery: walls proudly said to be impenetrable had began to crack hither and thither, inviolate forests had been cleared for cultivation and habitation, Humanism was eventually born and Mysticism had finally dired up and come to be forgotten by all. Nothing had remained of that Past save a few gloomy ruins only visited at night by winter winds and rains. Strange stories, mutilated by long centuries of Obscurantism, were now and then narrated by some old man puffing his pipe beside the fire at night's noontime, stories that would come up against our present materialistic approach of Reality and were about some legendary people of non-humans fleeing for some safe remote places as some imminent catastrophe had been fortold, and, so doing, leaving us on our own with our machines, our dreams and hopes, and our nostalgia of those long-gone days...

The computer program that followeth shall be nothing but a pale reflection of those long-forgotten Quests by the Knights-errant of old, splendidly and chivalrously riding up hill and down dale on horseback at the risk of their lives, with as sole weapons against the evils lying in wait, their unwavering Faith, their Bravery and Gallantry, their Devotion to the weak, the helpless and the needy, and their Hopes in a better World to come. Many were called but very few were chosen, and high was the tribute of the Quest for the Holy Grail - one of the milestones paving the way for the Philosopher's Stone... Whereas thou, armed with a keyboard and looking for nothing but entertainment, thou havest not much at stake but some points thou mightst eventually hap to lose! Thou shalt have a furtive glimpse of the first step towards Initiation: a nameless Castle drowned in Nothern haze. No-one ever liveth there, yet the place is swarming with hordes of mysterious 'life-forms'. Many an intrepid Knight used to venture into the Castle but very few were those who came out of it alive. Yet all these Blest Survivors actually managed to gain control over the base impulses and motives of their animal natures and to come out transformed, dignified. The Castle, consisting in an infinite and lethal Maze, concealeth the Holy Golden Grail. So, Humility, Perserance, Patience and rigorous Logic shall be the four Essences constituting the Sacred Ring of thine ultimate Victory. Each time thou wilt start combating, each time thou wilt give up the ghost, each time thou wilt discover a treasure, please bear in mind that several centuries back young Valiant Knights used to experience it far more invensely...

Description

Your initiation starts when you wake up inside the Castle in a cold, damp and bare cell, cell 0. Then you can choose amongst three directions: three dark and narrow passages. At the very end of each of these three tunnels you know there are three new cells. About their contents you only hear vague rumours. And you can from time to time manage to find out what their actual contents are. Sometimes some pieces of information are to be found in the very cell you are in: an old, long-forgotten signpost torn apart and away and trampled underfoot reporting some lethal hazard (ACID BATH) or the nearness of a welcome help (WIZARD). Unfortunately, these signposts never show the accurate direction and rumours are echoed so many times by these dark places that it just is not possible to have a true idea of their actual meaning. Moreover some indications can be put aside by you and in this case the danger lurking you is greater...

Whatever the case may be, you came to move if only at least to find the exit. Waiting for death to come and take you away is no solution. So for your moves there are each time six possibilities: either take one of the three corridors leading to a new cell, by choosing amongst them the one presenting the smallest danger of course; or use the Magic Stone which you received when entering the Castle and by so doing move in a second's time upwards or downwards within a space of torus-shaped spirals making up one storey of one hunderd interconnected cells. Cell 0 is the lower point (DOWN is inefficient in this case) and cell 99 is the upper one (UP is not efficient in this case) - this might appear to be strange as cells 0 and 99 are connected to one another; yet it all is normal as the Castle does not belong to the three dimensional world in which man lives although its external appearance is that of a standard castle as there were many in the Middle Ages; and this combination of Earthly and Suprahuman features gives evidence of the Sapience of old. This Stone may appear to be very practical but unfortunately has its whims and vagaries: it will always rematerialize you randomly in one of the upper of lower cells (according to your choice - UP or DOWN). And you will have to bear all the consequences of your upwards or downwards random transportation: you may find yourself face to face with a dragon, a clique of rabid rats, or - which is more agreeable indeed - a sexy little witch coming to you to give you a helping hand. A sixth and last moving method is offered to you: go back to the last cell you were in (BACK - not available when you wake up in the Castle and have not made one move at least). This BACK option may reveal itself very useful especially after using the Magic Stone for moving up or down. Indeed, it is the only means at your disposal to move back to a safe 'home base'.

When you move to a new cell several possibilities are presented to you. You can end up in an empty cell with nothing at all threatening you and you can then proceed in any of the six possible directions. Note in connection with this that there are only five possible directions in the case of a FORK, in which the cell you are in has only two corridors leading to two cells randomly chosen and changing at each visit of the FORK cell. In the case of a FORK the BACK option is still available. Besides the two corridors, leading sometimes very remote cells in the Castle, are so dark and tortuous that no single indication about the cells they are leading to is available. So you move to them at your own risk.

You can also fall into a lethal trap (ACID BATH, GHOSTS, GUILLOTINE or PORTCULLIS). Unless you have the MAGIC ELIXIR in your equipment, you will die in an atrocious way and put a sad end to your Quest and end up in the Graveyard of the One Thousand Vanquished, save if you have been dissolved in the ACID BATH, in which case a grave is no longer necessary. Note that the MAGIC ELIXIR will bring you back to life only once, and you will consequently have to find another flask of this priecious liquid to render yourself immune to any of these lethal hazards.

There exists another kind of trap you can also fall into: a kind of trap in which the ground is giving way beneath you. In this case you move to another storey of one hunderd cells (TRAP, HIDDEN HOLE). In order to move to another storey, you can be asked to enter the three-digit key given by the first WIZARD come across. Other traps may require that you use some pieces of your equipment (if you still have them at your disposal of course!): e.g. a LOCKED DOOR for which the KEYS are necessary. Hither and thither monsters may run at you, in which case you would need a weapon to drive 'em back. It is generally at that very moment that BATS turn out to snatch some piece of your equipment.

Remember that when in the situation in which a riposte from you with one of the pieces of equipment still at your disposal, you have only two attempts to react successfully. If you fail you just cannot take to your heels and have to bear all the - possibly lethal - consequences arising out of the situation. In the case of success your way is clear and you can proceed your Quest. In the case of aborted ripostes you will fall into another storey, be killed by your aggressor (if you have the MAGIC ELIXIR you will survive once), or be forced back whence you came (GO BACK).

In the course of your tumultuous peregrinations thru the Castle you will come across wizards and witches, whose services can be most helpful to you. Do not avoid visiting them! A wizard will give you indications on the contents of three cells of your choice, and a witch will reveal you the content of one cell. Yet their powers are limited and they can't see everything that's in a cell. Moreover, the first wizard you will come across will give you a vital information for he rest of your Quest: a key (three-digit secret number) allowing you to take the STAIRS and move to a new storey without any harm, and to take possession of the Holy GOLDEN GRAIL, the ultimate goal of your Quest. But do be on the qui vive when visiting a wizard or a witch because many a horrid creature is creeping in these cells to jump at you unawares. So watch out!

Apart from that you won't only make disagreeable and hostile encounters in the Castle. In certain cells you will come across pleasant little things, sometimes funny but never of great help to you (BARKING TREE, WOOING EYES, PEEPING GIRL, ...). You will also find useful things such as valuables and some piece of equipment. Take great care of their guardians who are often very near: traps, ferocious animals... The pieces of equipment you will find along your way will be added to your actual equipment for later use. They will also be at the mercy of the bats. At this stage a remark should be made about your equipment: when entering the Castle you have only four pieces of equipment (SWORD, TORCH, KEYS, and SPIRIT) which can only be used to riposte to some traps or attack by fierce animals; but four additional pieces of equipment (MAGIC ELIXIR - to bring you back to life once if you happen to die from a lethal hazard -, MAGIC ARMOR - also for ripostes -, MAGIC WAND - to return you the SWORD, TORCH and KEYS on request if they have been snatched by the bats -, and last but not least MAGIC EXIT - the only means to leave the Castle at any moment except during a riposte!) are scattered around for you to pick them during your Quest. Bear in mind that any of these eight pieces of equipment can be snatched by the bats, and that your final score is going to be calculated on the basis of the valuables and GOLDEN GRAIL picked up and of the time you wandered around in the Castle (if your calculator have the Time functions). So, before leaving the Castle, pick up a maximum of valuables and try and find the GOLDEN GRAIL!

A few words about these valuables you can pick up along your way: they are directly pickable after a possible riposte against their guardians. These valuables, ranging from sceptres to rings, originate from various human dynasties dating back to more or less remote areas and are hence a certain amount of points worth, this amount of points depending upon their age. Here follow these dynasties: Kish (3500 BC - 3000 BC, Sumerians), Our (2200 BC - 2000 BC, Sumerians), Mari (2000 BC - 1600 BC, Amorrites), Hia (2000 BC - 1500 BC, Chinese), Song (960 BC - 390 AD, Chinese) and Ming (1368 AD - 1432 AD, Chinese). Last but not least comes the most important valuable to pick up: the GOLDEN GRAIL for which the key given by the first wizard come across is necessary. So don't forget this key. Moreover, the GOLDEN GRAIL is ALWAYS accompanied by a guardian sometimes benevolent, sometimes malevolent, and lots of bats...

Now we've come to the end of this short description of what awaits you in the Castle, we shall conclude it with the way the score is calculated. First of all, you can, at any moment during your Quest, call your running score, except during a riposte. In this running score the points of all the valuables picked up along your way thru the Castle are added up (MING RING is 100 points worth while KISH SCEPTRE is 1800 points worth). As far as the GOLDEN GRAIL is concerned, it is 5000 points worth. The goal of the game, apart for staying alive and getting out safe, is to total up to 15,000 points. When you eventually leave the Castle with the MAGIC EXIT, this score will be used to compute your final score in percentage points (100 points being almost impossible to reach). This final score will reflect your dergree of aptitude and ability during your Quest. There are two different ways of computing your final score:

- Either the time elapsed is not taken into consideration: in this case your final score is calculated solely with your running score reduced to a portion of a total of 100 points.

- Or this time is taken into consideration: in this case your running score counts for 70% of your total of 100 points. The remaining 30% are allocated to your response time. If this time lies between 0 and 3 minutes, 30 points are added to your total; afterwards these 30% decreases on a linear basis to reach 0 point at time 4 min 48 sec. Over this time you will lose points from the 70% part. So you'd better not hang around idly.

We wish you "Good Luck, Chaps!!!"

Operating Limits & Warnings

Example

KEYSTROKES             OUTPUTS          COMMENTS

[XEQ] "SIZE" 020
[XEQ] "CASTLE"         Seed?
.1962 [CF] 25 [R/S]     THE CASTLE      Avoid using stopwatch by clearing flag 25
                       SAFE
                       NO WARNING
                       0* 99 1 9
1                      MOVING TO 1
                       SAFE
                       ADDER
                       1* 0 2 92
2                      MOVING TO 2
                       ADDER            Hazard
                       2* ?
[F]                    SWORD USED       Riposte
                       SAFE
                       NO WARNING
                       2* 1 3 11
3                      MOVING TO 3
                       MAGIC EXIT       Piece of equipment
                       MARSHY CELL      Hazard
                       BATS SNATCH      Bats action
                       TORCH
                       3* ?             Riposte
[J]                    SPIRIT USED
                       SAFE
                       ADDER
                       3* 2 4 94
4                      MOVING TO 4
                       OUR HEMLET       Valuable
                       SCORE : 800
                       SAFE
                       WIZARD
                       4* 3 5 13
5                      MOVING TO 5
                       MAGIC ARMOR
                       SAFE
                       PORTCULLIS
                       WIZARD
                       5* 4 6 96
[D]                    WIZARD           Back
                       KEY: 535         Key for Golden Grail, Stairs
                       CELL ?           Questions
14                     CELL 14 :
                       GHOSTS
                       CELL ?
15                     CELL 15 :
                       GOLDEN GRAIL
                       CELL ?
16                     CELL 16 :
                       EMPTY
                       PRISON CELL      Hazard
                       BATS SNATCH      Bats again
                       NOTHING
                       4* ?             Riposte
[H]                    KEYS USED
                       SAFE
                       WIZARD
                       4* 3 5 13
5                      MOVING TO 5
                       PEEPING EYES
                       SAFE
                       PORTCULLIS
                       5* 4 6 96
[D]                    RUNNING GIRL     Back
                       SAFE
                       WIZARD
                       4* 3 5 13
13                     MOVING TO 13
                       MING SCEPTRE     New valuable
                       SCORE : 1200
                       WEB              Hazard
                       13* ?            Riposte
[I]                    ARMOR USED
                       SAFE
                       GHOSTS
                       13* 12 14 4
12                     MOVING TO 12
                       MING VASE        New valuable
                       SCORE : 1300
                       SAFE
                       NO WARNING
                       12* 11 13 21
21                     MOVING TO 21
                       FORK
                       21* 98 -- 3      Fork: only 2 directions
3                      MOVING TO 3
                       WIZARD           2nd wizard
                       CELL ?           Questions
13                     CELL 13 :
                       EMPTY
                       CELL ?
12                     CELL 12 :
                       PORTCULLIS
                       CELL ?
11                     CELL 11 :
                       EMPTY
                       SAFE
                       ADDER
                       3* 2 4 94
[D]                    FORK             Back to Fork
                       21* 55 -- 66
55                     MOVING TO 55
                       HIA JEWELS       New valable
                       SCORE : 2200
                       SAFE
                       NO WARNING
                       55* 54 56 46
54                     MOVING TO 54
                       LOCKED DOOR      Hazard
                       54* ?            Risposte
[F]                    SWORD USED
                       SAFE
                       PORTCULLIS
                       54* 53 55 63
[C]                    PEEPING EYES     Down
                       SAFE
                       PORTCULLIS
                       5* 4 6 96
4                      MOVING TO 4
                       RUNNING GIRL
                       SAFE
                       NO WARNING
                       4* 3 5 13
13                     MOVING TO 13
                       SAFE
                       GHOSTS
                       PORTCULLIS
                       13* 12 14 4
[B]                    MING KNIFE       Up
                       SCORE : 2400
                       SAFE
                       GHOSTS
                       63* 62 64 54
54                     MOVING TO 54
                       SAFE
                       PORTCULLIS
                       54* 53 55 63
63                     MOVING TO 63
                       SAFE
                       GHOSTS
                       63* 62 64 54
[C]                    COBRA            Down
                       BATS SNATCH
                       MAGIC EXIT
                       39* ?
[F]                    SWORD USED
                       SAFE
                       COBRA
                       39* 38 40 30
38                     MOVING TO 38
                       SAFE
                       COBRA
                       38* 37 39 47
37                     MOVING TO 37
                       SAFE
                       NO WARNING
                       37* 36 38 28
36                     MOVING TO 36
                       MING JEWELS
                       SCORE : 2700
                       COBRA
                       36* ?
[F]                    SWORD USED
                       SAFE
                       DARK PIT
                       36* 35 37 45
35                     MOVING TO 35
                       MARI SCEPTRE
                       SCORE : 4100
                       SAFE
                       NO WARNING
                       35* 35 36 26
36                     MOVING TO 36
                       SAFE
                       DARK PIT
                       36* 35 37 45
35                     MOVING TO 35
                       TORCH
                       SAFE
                       NO WARNING
                       35* 34 36 26
34                     MOVING TO 34
                       KISH SCEPTRE
                       SCORE : 5900
                       GOLDEN GRAIL     At last !
                       KEY?
535                    SCORE : 10900
                       DARK PIT
                       34* ?
[G]                    TORCH USED
                       SAFE
                       WITCH
                       34* 33 35 43
33                     MOVING TO 33
                       MAGIC EXIT
                       SAFE
                       NO WARNING
                       33* 32 34 24
[d]                    MAGIC EXIT
                       -THRU ALIVE-
                       POINTS : 73+

User Instructions

1: Load the program and set the adequate SIZE format to run the program.
FUNCTION KEYS: [XEQ] "SIZE" 020

2a: Initialize the program.
FUNCTION KEYS: [XEQ] "CASTLE"
OUTPUT: Seed?

2b: Key in a numeric seed s between 0 and 1 exclusive (keying in a seed is optional. If no seed is input, the actual value of the seed register is used as a default seed).
INPUT: s

2c: OPTIONAL: If you do not want the time factor to be taken into account in the final score even if the Time functions are available.
FUNCTION KEYS: [CF] 25

2d: OPTIONAL: To turn off the buzzer (no TONEs).
FUNCTION KEYS: [CF] 26

2e: To start the Quest. You will enter CELL 0 of one storey.
FUNCTION KEYS: [R/S]
OUTPUT: THE CASTLE

3: When safe and sound in cell p (p standing for position).
OUTPUT: SAFE ... warnings (ø)... p* d1 d2 d3
(ø) The warnings are all the hazards (some hazards, which are never lethal, are not reported, nor are the valuables, the pieces of equipment to be collected and the distractors) to be found in cells d1, d2 or d3.
Then go to point: 4, 5, 6, 7, 8, 9, 10, 11 or 12a.

4: To visualize the warnings when not in case of a FORK.
FUNCTION KEYS: [a]
OUTPUT: warnings ... pø d1 d2 d3
Then go to point 4, 5, 6, 7, 8, 9, 10, 11 or 12a.

5: To know the running score.
FUNCTION KEYS: [A]
OUTPUT: SCORE : xxx ... p* d1 d2 d3
Then go to point 4, 5, 6, 7, 8, 9, 10, 11 or 12a.

6: To randomly move to a new cell the p' code of which is superior to the p code (p<p'<=99).
FUNCTION KEYS: [B]
Then go to point 12b.

7: To randomly move to a new cell the p' code of which is inferior to the p code (0<=p'<p).
FUNCTION KEYS: [C]
Then go to point 12b.

8: To move back to the cell whence you came.
FUNCTION KEYS: [D]
Then go to point 12b.

9: If you want to put an end to your Quest, and if you have the MAGIC EXIT, leave the Castle.
FUNCTION KEYS: [d]
Your performance in the Castle during your Quest is globally estimated between 0 and 100 points. If you picked up the GOLDEN GRAIL the + sign is appended to your points.
OUTPUT: -THRU ALIVE- ... POINTS: xx
To start a new Quest:
FUNCTION KEYS: [R/S]
OUTPUT: Seed?
Then go to point 2b.

10: To visualize the available pieces of equipment.
FUNCTION KEYS: [E]
OUTPUT: EQUIPMENT : ... p* d1 d2 d3
Then go to point 4, 5, 6, 7, 8, 9, 10, 11 or 12a.

11: If you lost your SWORD, LAMP and/or KEYS, and if you have the MAGIC WAND, use the WAND key to get them back.
FUNCTION KEYS: [e]
OUTPUT: MAGIC WAND ... EQUIPMENT: ... p* d1 d2 d3
Then go to point 4, 5, 6, 7, 8, 9, 10, 11 or 12a.

12a: To go from cell p to any of the three adjacent cells d1, d2 or d3.
FUNCTION KEYS: d1 or d2 or d3
OUTPUT: MOVING TO ...

12b: When moving to a new cell you are confronted with various possibilities.

12b.1: The new cell is empty: nothing to report. Go to point 3.

12b.2: The new cell contains a hazard.
OUTPUT: hazard

12b.2.1: This hazard is lethal and no riposte is possible.
OUTPUT: - DEAD -

12b.2.1.1: If you haven't got the MAGIC ELIXIR, you are definitely dead and your calculator shuts off. For a new Quest, turn it on again.
OUTPUT: Seed?
Then go to point 2b.

12b.2.1.2: If you have the MAGIC ELIXIR, you come back to life but loose the MAGIC ELIXIR.
OUTPUT: MAGIC ELIXIR
Then go to point 3.

12b.2.2: The hazard requires your riposting. In this case BATS may come and snatch some piece of your equipment.
OUTPUT: BATS SNATCH ...
Then a riposte is being waited for.
OUTPUT: p* ?

12b.2.2.1: Select the most adequate riposte.
FUNCTION KEYS: [Key]
Key is F for SWORD, G for TORCH, H for keys, I for ARMOR and J for SPIRIT. Then go to point 12b.2.2.2.

12b.2.2.2: Reaction.

12b.2.2.2a: If you haven't got the piece of equipment used to riposte and if it is your first riposte.
OUTPUT: NO ... p* ?
Then go to point 12b.2.2.

12b.2.2.2b: If you haven't got the piece of equipment used to riposte and it is your second and last riposte.
OUTPUT: NO ... MISSED
Then go to point 12b.2.3.

12b.2.2.2c: If you have the piece of equipment used to riposte and if your riposte is efficient.
OUTPUT: ... USED
Then go to point 3.

12b.2.2.2d: If you have the piece of equipment used to riposte, if your riposte is not efficient and if it is your first riposte.
OUTPUT: ... USED ... MISSED ... p* ?
Then go to point 12b.2.2.

12b.2.2.2e: If you have the piece of equipment used to riposte, if your riposte is not efficient and if it is your second and last riposte.
OUTPUT: ... USED ... MISSED
Then go to point 12b.2.2.3.

12b.2.2.3: Neither of your ripostes has been efficient.

12b.2.2.3a: The hazard was lethal.
OUTPUT: - DEAD -
Then go to point 12b.2.1.1. or 12b.2.1.2.

12b.2.2.3b: The hazard was not lethal. So you have to go back whence you came.
OUTPUT: GO BACK
Then go to point 12b.

12b.2.2.3c: The hazard makes you move to the same cell in another storey of cells.
OUTPUT: YEEIII...
Then go to point 12b.

12b.2.3: The hazard does not require your riposting but makes you move to another storey.

12b.2.3a: In the case of a HIDDEN HOLE you sometimes end up in cell 0 of the new storey.
OUTPUT: HIDDEN HOLE
Then go to point 3.

12b.2.3b: You can also end up in cell p of the new storey.
OUTPUT: YEEIII...
Then go to point 12b.

12b.2.4: You are in the case of a FORK and two directions are possible (d1 and d2) but you cannot know what their contents are.
OUTPUT: FORK ... p* d1 -- d2
Then go to point 5, 6, 7, 8, 9, 10, 11 or 12a.

12b.2.5: It's a hit, you've found the GOLDEN GRAIL.
OUTPUT: GOLDEN GRAIL ... KEY?
Now you have to key in the three-digit key given by the first WIZARD you came across.
INPUT: 3-digit key

12b.2.5a: The key is correct and the GOLDEN GRAIL is yours.
OUTPUT: SCORE : xxx
You win 5,000 points and a new hazard is presented to you. Then go to point 12b.2.

12b.2.5b: The key is wrong and you can't have the GOLDEN GRAIL. Go to point 3.

12b.2.6: You come across a WIZARD. If it is the first WIZARD you come across, he gives you a three-digit key. You can then ask him to show you the contents of three cells (but mind WIZARDs can't see everything that's in a cell!). Enter three value for xx (between 0 and 99 inclusive) in a row each time the question "CELL ?" is asked.
OUTPUT: WIZARD ... (KEY: xxx ...) CELL ? (thrice)
INPUT: xx
OUTPUT: CELL xx : ... (thrice)
Then go to point 12b.

12b.2.7: You come across a WITCH. You can ask her to show you the contents of one cell (xx) but she can't see everything that's in a cell either.
OUTPUT: WITCH ... CELL ?
INPUT: xx(once)
OUTPUT: CELL xx : ... (once)
Then go to point 12b.

12b.2.8: You are in front of a flight of STAIRS. To be allowed to use it, you have to key in the three-digit key given by the first WIZARD came across.
OUTPUT: STAIRS ... KEY?
INPUT: 3-digit key

12b.2.8a: The key is correct. You move to cell 0 in a new storey.
OUTPUT: ...
Then go to point 3.

12b.2.8b: The key is wrong. In this case go to point 12b.1. or 12b.2. for a non-lethal hazard.

12b.3: The new cell contains a valuable.
OUTPUT: Valuable ... SCORE : xxx
If there is a new non-lethal hazard, go to point 12b.2. If there is no new hazard, go to point 3.

12b.4: The new cell contains one piece of equipment. It is added to your equipment for later use.
OUTPUT: Equipment
Then go to point 3 if no new hazard or to point 12b.2. if new, non-lethal hazard.

12b.5: The new cell contains a funny little distractor.
OUTPUT: Distractor
Then go to point 3.

Program Listing

LINE  KEYS           COMMENTS

 01<>LBL"CASTLE"     Title label
 02<>LBL 46          Loop
 03  .029
 04<>LBL 57          Reset flags routine
 05  CF IND X
 06  ISG X
 07  GTO 57         (step 04)
 08  SF 10          No 3-digit key
 09  SF 13          Sword
 10  SF 14          Torch
 11  SF 15          Keys
 12  SF 17          Spirit
 13  SF 25          Error flag (for time functions)
 14  SF 26          Tones on
 15  SF 27          A-J, a-e local labels enabled
 16  SF 28          Decimal point
 17  FIX 0          Display setting
 18  CLST           Clear stack
 19  STO 19         Initialize score
 20  RCL 05         Previous seed
 21  "Seed?"
 22  PROMPT         Ask for seed
 23  STO 05         Store new seed
 24  " THE CASTLE"  Program title
 25  FS? 25         Timer used?
 26  STOPSW         Stop stopwatch
 27  CLX
 28  FS? 25
 29  SETSW          Reset stopwatch to zero
 30<>LBL 47          New storey
 31  FS? 07         Same cell?
 32  "YEEIII..."
 33  AVIEW          Display message
 34  18.008
 35<>LBL 51          Generate cells
 36  23             Upper limit for random generator
 37  E^X
 38  XEQ 33         (steps 798-807)
 39  STO IND Y      Store cells
 40  X<>Y
 41  DSE X          Decrement index
 42  GTO 51         (step 35)
 43  RCL 05         Recall seed
 44  STO 06         Storey factor
 45  1 E3
 46  *              1000 * storey factor
 47  INT            Integer part
 48  FS? 10         Key not yet known
 49  STO 07         Store key
 50  RCL 01         Player's position
 51  FC?C 07        Return to cell 0?
 52  CLX            Yes
 53  TONE 8         New storey OK
 54  GTO 50         (step 295)
 55<>LBL 40          Player's reaction 
 56  FC? 08         No reaction?
 57  GTO 39         (step 337)
 58  STO 08         Reaction code
 59  SF 05          1st reaction
 60  XEQ 37         (steps 837-843)
 61<>LBL 52          2nd and last reaction
 62  PI             Frequency of bats
 63  FS?C 11        Special cells?
 64  SQRT           Increase frequency
 65  XEQ 33         (steps 798-807)
 66  X!=0?          No bats?
 67  GTO 48         (step 88)
 68  TONE 9         Bats' tones
 69  TONE 9
 70  "BATS SNATCH"
 71  AVIEW          Display message
 72  8              Possible snatchings
 73  XEQ 33         (steps 798-807)
 74  12             Select adequate flag
 75  +
 76  FC?C IND X     Snatch equipment or nothing if already absent
 77  20             Code for NOTHING
 78  XEQ 38         (steps 844-...)
 79  PSE            Delay
 80  AVIEW          Display snatching
 81  19.011
 82  SF 20          Set NOTHING flag
 83<>LBL 53
 84    FS? IND X      Test if equipment still available for snatching
 85  CF 20          Yes, clear NOTHING flag
 86  DSE X          Decrement index
 87  GTO 53         (step 83)
 88<>LBL 48          Reaction loop
 89  CLST           Clear stack
 90  CLA            Clear Alpha
 91  ARCL 01        Append position
 92  "|-* ?"         Ask for reaction
 93  FS? 25         Timer used?
 94  RUNSW          Run stopwatch
 95  PROMPT         Display message and wait for reaction
 96  GTO 48         (step 88)
 97<>LBL F           Sword
 98  CLX            Code for sword
 99  GTO 00         (step 111)
100<>LBL G           Torch
101  1              Code for torch
102  GTO 00         (step 111)
103<>LBL H           Keys
104  2              Code for keys
105  GTO 00         (step 111)
106<>LBL I           Armor
107  3              Code for armor
108  GTO 00         (step 111)
109<>LBL J           Spirit
110  4              Code for spirit
111<>LBL 00          Branch
112  FC? 08         Illegal key pressed?
113  GTO 49         (step 161)
114  FS? 25         Timer used?
115  STOPSW         Stop stopwatch
116  13             Select adequate flag
117  +
118  SF 11          Drop "MAGIC"
119  XEQ 38         (step 844-...)
120  FS? IND X      Test if equipment is present
121  GTO 00         (step 129)
122  ASTO L         Store Alpha
123  "NO "          Equipment used is not present
124  ARCL L
125  XEQ 37         (steps 837-843)
126  FS?C 05        1st reaction?
127  GTO 52         (step 61)
128  GTO 01         (step 148)
129<>LBL 00          Branch
130  "|- USED"       Equipment present
131  AVIEW          Display message
132  RCL 08         Reaction code
133  6              Extract efficiency factor of equipment used
134  LASTX
135  12
136  -
137  Y^X
138  /
139  FRC
140  6
141  *
142  INT
143  X=0?           Efficiency factor=0?
144  GTO 01         (step 148)
145  XEQ 33         (steps 798-807)
146  X=0?           Reaction OK?
147  GTO 39         (step 337)
148<>LBL 01          Branch
149  "MISSED"       Wrong reaction
150  XEQ 37         (steps 837-843)
151  FS?C 05        1st reaction?
152  GTO 52         (step 61)
153  FS?C 06        Lethal hazard?
154  GTO 41         (step 603)
155  FS? 07         New storey?
156  GTO 47         (step 30)
157  "GO BACK"
158  AVIEW          Display message
159  RCL 00         Recall position
160  GTO 50         (step 295)
161<>LBL 49          Branch
162  CLA            Clear Alpha
163  ARCL 01        Append position
164  "|-* "
165  ARCL 02        Append left cell
166  "|- "
167  FS? 06         Fork?
168  "|---"
169  FC? 06         No fork?
170  ARCL 03        Append right cell
171  "|- "
172  ARCL 04        Append up/down cell
173  CF 22          Clear numeric entry flag
174  AVIEW          Display message
175  FS? 25         Timer used?
176  RUNSW          Run stopwatch
177<>LBL 54          Entry loop
178  PSE            Entry pause
179  FC?C 22        No entry?
180  GTO 54         (step 177)
181  FS? 25         Timer used?
182  STOPSW         Stop stopwatch
183  RCL 02         Left cell
184  X=Y?           Left cell chosen?
185  GTO 00         (step 197)
186  X<>Y           Recall choice
187  RCL 03         Right cell
188  X=Y?           Right cell chosen?
189  GTO 00         (step 197)
190  X<>Y           Recall choice
191  RCL 04         Up/down cell
192  X=Y?           Up/down cell chosen?
193  GTO 00         (step 197)
194  "ILLEGAL CELL" Illegal cell chosen
195  XEQ 37         (steps 837-843)
196  GTO 49         (step 161)
197<>LBL 00          Branch
198  "MOVING TO "   Moving to...
199  ARCL X         ... chosen cell
200  AVIEW          Display message
201  GTO 50         (step 295)
202<>LBL A           Score
203  XEQ 44         (steps 792-797)
204  XEQ 35         (steps 827-836)
205  GTO 49         (step 161)
206<>LBL B           Up
207  XEQ 44         (steps 792-797)
208  1 E2           Generate up-cell
209  RCL 01
210  -
211  XEQ 33         (steps 798-807)
212  RCL 01
213  +
214  GTO 50         (step 295)
215<>LBL C           Down
216  XEQ 44         (steps 792-797)
217  RCL 01         Generate Down-cell
218  XEQ 33         (steps 798-807)
219  GTO 50         (step 295)
220<>LBL d           Exit
221  XEQ 44         (steps 792-797)
222  FC? 19         No Magic Exit?
223  GTO 49         (step 161)
224  19             Code for Magic Exit
225  XEQ 38         (steps 844-876)
226  AVIEW          Display message
227  BEEP           Beep tones
228  PSE            Delay
229  "-THRU ALIVE-" Exit the Castle
230  AVIEW          Display message
231  BEEP           Beep tones
232  PSE            Delay
233  8              Compute points taking into consideration the
234  FS? 25         use of the stopwatch or not
235  RCLSW
236  HR
237  1 E2
238  *
239  -
240  3
241  /
242  1
243  X>Y?
244  X<>Y
245  30
246  *
247  RCL 19
248  FS? 25
249  214
250  FC? 25
251  150
252  /
253  FS? 25
254  +
255  X<0?           Standardize points between 0 and 100
256  CLX
257  1 E2
258  X>Y?
259  X<>Y
260  "POINTS : "    Set display
261  ARCL X         Append points
262  FS? 09         Golden Grail?
263  "|-+"           Append Golden Grail
264  PROMPT         Display message
265  GTO 46         (step 02)
266<>LBL e           Wand
267  XEQ 44         (steps 792-797)
268  FC? 18         No Magic Wand?
269  GTO 49         (step 161)
270  18             Code of Magic Wand
271  XEQ 38         (steps 844-873)
272  XEQ 36         (steps 830-836)
273  SF 13          Sword
274  SF 14          Torch
275  SF 15          Keys
276<>LBL E           Equipment
277  XEQ 44         (steps 792-797)
278  "EQUIPMENT :"
279  AVIEW          Display message
280  PSE            Delay
281  12.02
282<>LBL 55          Loop
283  FC? IND X      No equipment
284  GTO 00         (step 288)
285  XEQ 38         (steps 844-...)
286  AVIEW          Display message
287  PSE            Delay
288<>LBL 00          Branch
289  ISG X          Increment index
290  GTO 55         (step 282)
291  GTO 49         (step 161)
292<>LBL D           Back
293  XEQ 44         (step 792-797)
294  RCL 00         Previous position
295<>LBL 50          Superbranch
296  CF 22          Clear numeric entry flag
297  X<> 01         Store new position
298  STO 00         And previous one
299  RCL 01         Recall position
300  1
301  -
302  1 E2
303  MOD
304  STO 02         Store left cell
305  2
306  +
307  1 E2
308  MOD
309  STO 03         Store right cell
310  2
311  MOD
312  X!=0?
313  SF 11
314  RCL 01
315  9
316  FC?C 11
317  CHS
318  +
319  1 E2
320  MOD
321  STO 04         Store up/down cell
322  RCL 01         Recall position
323  SF 08          Set reaction flag
324<>LBL 45          Branch
325  STO 08         Save cell code
326  X!=0?          Not cell 0?
327  XEQ 34         (steps 808-826)
328  RCL X
329  5
330  MOD
331  X!=0?          Hazard present?
332  GTO 00         (step 364)
333  FC? 27         Wizard?
334  GTO 39         (step 337)
335  FC? 08         No reaction?
336  RTN            Return to call routine
337<>LBL 39          Branch
338  FS? 08         Reaction?
339  "SAFE"
340  AVIEW          Display Alpha
341  FC? 27         Wizard?
342  PSE            Delay
343  CF 05          Reset reaction-related flags
344  CF 06
345  CF 07
346  CF 11
347  FC?C 08        No reaction?
348  RTN            Return to call routine
349<>LBL a           Warnings
350  XEQ 44         (steps 792-797)
351  FS? 06         Fork?
352  GTO 49         (step 161)
353  RCL 03         Right cell
354  XEQ 45         (steps 324-...)
355  RCL 04         Up/down cell
356  XEQ 45         (steps 324-...)
357  RCL 02         Left cell
358  XEQ 45         (steps 324-...)
359  "NO WARNING"
360  FC?C 22        No warning?
361  AVIEW          Display message
362  PSE            Delay
363  GTO 49         (step 161)
364<>LBL 00          Branch
365  RCL 08         Recall cell code
366  PI             Compute cell content
367  /
368  RCL 06
369  +
370  X^2
371  FRC
372  STO 08         Partial cell code
373  R^             Compute hazard, valuable, equipment, distractors
374  6
375  MOD
376  X=0?
377  SIGN
378  FC? 27         Wizard?
379  GTO IND X      (step ...)
380  FS? 08         Reaction?
381  GTO IND X      (step ...)
382  1
383  X!=Y?          No hazard?
384  RTN            Return to call routine
385  5              End of cell content computation
386  RCL 08
387  29
388  *
389  X<Y?           No display?
390  RTN            Return to call routine
391  SF 22          Warning flag set
392  GTO 00         (step 426)
393<>LBL 04          Distractors
394  GTO 32         (step 716)
395<>LBL 03          Valuables
396  GTO 31         (step 637)
397<>LBL 02          Equipment
398  GTO 30         (step 621)
399<>LBL 01          Hazards
400  RCL 08         End of cell content calculation
401  29
402  *
403  GTO 00         (step 426)
404<>LBL 29          New cell content
405  RCL 01         Recall position
406  XEQ 34         (steps 808-826)
407  CHS
408  10
409  XEQ 33         (steps 798-807)
410  +
411  RCL 01         Recall position
412  SF 11
413  XEQ 34         (steps 808-819)
414  R^             Store new cell content
415  *
416  ST+ IND Y
417  PI             Compute hazard propensity
418  FS?C 05
419  SIGN
420  XEQ 33         (steps 798-807)
421  X!=0?          No new hazard?
422  GTO 39         (step 337)
423  LASTX          Select new hazard
424  24
425  *
426<>LBL 00          Branch
427  GTO IND X      (step ...)
428<>LBL 00          Web
429  "WEB"
430  4765           Reaction code
431  GTO 40         (step 55)
432<>LBL 01          Locked door
433  "LOCKED DOOR"
434  4808           Reaction code
435  GTO 40         (step 55)
436<>LBL 02          Rabid rats
437  "RABID RATS"
438  5416           Reaction code
439  GTO 40         (step 55)
440<>LBL 03          Fork
441  FC?C 08        Wizard?
442  GTO 39         (step 337)
443  "FORK"
444  XEQ 37         (steps 837-843)
445  1 E2
446  XEQ 33         (steps 798-807)
447  STO 02         Store "left" cell
448  STO 03         Duplicate
449  1 E2
450  XEQ 33         (steps 798-807)
451  STO 04         Store "right" cell
452  SF 06          Fork flag set
453  GTO 49         (step 161)
454<>LBL 04          Hidden hole
455  FC?C 08        Wizard?
456  GTO 39         (step 337)
457  "HIDDEN HOLE"
458  2
459  XEQ 33         (steps 798-807)
460  X!=0?          New storey, cell xx?
461  XEQ 37         (steps 837-843)
462  X!=0?          New storey, cell xx?
463  SF 07          Same cell flag set
464  GTO 47         (step 30)
465<>LBL 05          Golden Grail
466  FS? 09         Golden Grail already kept?
467  GTO 08         (step 498)
468  "GOLDEN GRAIL"
469  FC? 08         No reaction?
470  GTO 39         (step 337)
471  XEQ 43         (steps 776-791)
472  SF 27          A-J,a-e enabled
473  X!=Y?          Wrong key?
474  TONE 3         Wrong tone
475  X!=Y?          Wrong key?
476  GTO 39         (step 337)
477  5 E3           Add points for Golden Grail
478  ST+ 19
479  XEQ 35         (steps 827-836)
480  SF 05          New hazard OK
481  SF 09          Golden Grail kept
482  GTO 29         (step 404)
483<>LBL 06          Wizard
484<>LBL 07          (bis)
485  "WIZARD"
486  FC?C 08        No reaction?
487  GTO 39         (step 337)
488  XEQ 36         (steps 830-836)
489  FC?C 10        3-digit key given?
490  GTO 00         (step 494)
491  KEY: "         Display 3-digit key for Golden Grail, Stairs
492  ARCL 07
493  XEQ 36         (steps 830-836)
494<>LBL 00          Branch
495  XEQ 42         (steps 762-348)
496  XEQ 42         (steps 762-348)
497  GTO 00         (step 503)
498<>LBL 08          Witch
499  "WITCH"
500  FC?C 08        No reaction?
501  GTO 39         (step 337)
502  XEQ 36         (steps 830-836)
503<>LBL 00          Branch
504  XEQ 42         (steps 762-348)
505  SF 08          Reset reaction flag
506  SF 27          A-J,a-e enabled
507  GTO 29         (step 404)
508<>LBL 09          Stairs
509  "STAIRS"
510  FC? 08         No reaction?
511  GTO 39         (step 337)
512  XEQ 43         (steps 776-791)
513  SF 27          A-J,a-e enabled
514  CLA            Clear ALPHA
515  X=Y?           Key OK?
516  GTO 47         (step 30)
517  TONE 3         Wrong tone
518  GTO 29         (step 404)
519<>LBL 10          Adder
520  "ADDER"
521  4339           Reaction code
522  GTO 40         (step 55)
523<>LBL 11          Fire
524  "FIRE"
525  1763           Reaction code
526  GTO 40         (step 55)
527<>LBL 12          Water
528  "WATER"
529  2843           Reaction code
530  GTO 40         (step 55)
531<>LBL 13          Spiders
532  "SPIDERS"
533  6819           Reaction code
534  GTO 40         (step 55)
535<>LBL 14          Prison cell
536  "PRISON"
537  59 E2          Reaction code
538  GTO 00         (step 550)
539<>LBL 15          Fridge cell
540  "FRIDGE"
541  5948           Reaction code
542  GTO 00         (step 550)
543<>LBL 16          Dark cell
544  "DARK"
545  3428           Reaction code
546  GTO 00         (step 550)
547<>LBL 17          Marshy cell
548  "MARSHY"
549  1924           Reaction code
550<>LBL 00          Branch
551  "|- CELL"      Append Alpha
552  SF 11          Special cells flag set
553  GTO 40         (step 55)
554<>LBL 18          Vampire
555  "VAMPIRE"
556  4507           Reaction code
557  GTO 00         (step 573)
558<>LBL 19          Big Worms
559  "BIG WORMS"
560  4441           Reaction code
561  GTO 00         (step 573)
562<>LBL 20          Cobra
563  "COBRA"
564  7081           Reaction code
565  GTO 00         (step 573)
566<>LBL 21          Dragon
567  "DRAGON"
568  4267           Reaction code
569  GTO 00         (setp 573)
570<>LBL 22          Dogs
571  "DOGS"
572  7101           Reaction code
573<>LBL 00          Branch
574  SF 06          Lethal flag set
575  GTO 40         (step 55)
576<>LBL 23          Dark pit
577  "DARK PIT"
578  4760           Reaction code
579  SF 07          New storey flag set
580  GTO 40         (step 55)
581<>LBL 24          Trap
582  "TRAP"
583  FC?C 08        No reaction?
584  GTO 39         (step 337)
585  XEQ 37         (steps 837-843)
586  SF 07          New storey flag set
587  GTO 47         (step 30)
588<>LBL 25          Acid bath
589  "ACID BATH"
590  GTO 00         (step 599)
591<>LBL 26          Ghosts
592  "GHOSTS"
593  GTO 00         (step 599)
594<>LBL 27          Guillotine
595  "GUILLOTINE"
596  GTO 00         (step 599)
597<>LBL 28          Portcullis
598  "PORTCULLIS"
599<>LBL 00          Branch
600  FC? 08         No reaction?
601  GTO 39         (step 337)
602  XEQ 37         (steps 837-843)
603<>LBL 41          Branch
604  "  - DEAD -"
605  AVIEW          Display message
606  TONE 2         Lethal tones
607  TONE 2
608  TONE 0
609  PSE            Delay
610  FS?C 12        Magic elixir?
611  GTO 00         (step 616)
612  SF 11          Auto start flag set
613  CLST           Clear stack
614  OFF            Shut off
615  GTO 46         (step 02)
616<>LBL 00          Branch
617  12             Magic elixir code
618  XEQ 38         (steps 844-873)
619  XEQ 36         (steps 830-836)
620  GTO 39         (step 337)
621<>LBL 30          Equipment
622  RCL 08         End of cell content computation
623  8
624  *
625  12
626  +              Select equipment flag
627  FS? IND X      Equipment already present?
628  19             Yes: magic exit instead
629  FC? IND X      Equipment not present?
630  XEQ 38         (steps 844-...)
631  FC? 08         No reaction?
632  GTO 39         (step 337)
633  FC? IND X      Equipment absent?
634  XEQ 36         (steps 830-836)
635  SF IND X       Equipment flag set
636  GTO 29         (setp 404)
637<>LBL 31          Valuables
638  RCL 08         End of cell content computation: prefix
639  6
640  *
641  XEQ IND X      (steps ... - ...)
642  X<>Y
643  FRC            End of cell content computation: postfix
644  8
645  *
646  6
647  +
648  X<>Y           Value of prefix
649  "|- "
650  XEQ IND Y      (steps ... - ...)
651  FC? 08         No reaction?
652  GTO 39         (step 337)
653  XEQ 36         (steps 830-836)
654  *              Value of prefix * Value of postfix * 10
655  10
656  *
657  ST+ 19         Added to the running score
658  XEQ 35         (steps 827-836)
659  GTO 29         (step 404)
660<>LBL 00          Kish (prefix)
661  "KISH"
662  45             Prefix value
663  RTN
664<>LBL 01          Our (prefix)
665  "OUR"
666  40             Prefix value
667  RTN
668<>LBL 02          Mari (prefix)
669  "MARI"
670  35             Prefix value
671  RTN
672<>LBL 03          Hia (prefix)
673  "HIA"
674  30             Prefix value
675  RTN
676<>LBL 04          Song (prefix)
677  "SONG"
678  20             Prefix value
679  RTN
680<>LBL 05          Ming (prefix)
681  "MING"
682  10             Prefix value
683  RTN
684<>LBL 06          Sceptre (postfix)
685  "|-SCEPTRE"
686  4              Postfix value
687  RTN
688<>LBL 07          Chalice (postfix)
689  "|-CHALICE"
690  4              Postfix value
691  RTN
692<>LBL 08          Jewels (postfix)
693  "|-JEWELS"
694  3              Postfix value
695  RTN
696<>LBL 09          Statue (postfix)
697  "|-STATUE"
698  3              Postfix value
699  RTN
700<>LBL 10          Knife (postfix)
701  "|-KNIFE"
702  2              Postfix value
703  RTN
704<>LBL 11          Hemlet (postfix)
705  "|-HEMLET"
706  2              Postfix value
707  RTN
708<>LBL 12          Vase (postfix)
709  "|-VASE"
710  1              Postfix value
711  RTN
712<>LBL 13          Ring (postfix)
713  "|-RING"
714  1              Postfix value
715  RTN
716<>LBL 32          Distractors
717  FC? 08         No reaction?
718  GTO 39         (step 337)
719  RCL 08         End of cell content computation: prefix
720  5
721  *
722  XEQ IND X      (steps ... - ...)
723  FRC            End of cell content computation: postfix
724  5
725  *
726  LASTX
727  +
728  "|-ING "        Append verb ending
729  XEQ IND X      (steps ... - ...)
730  XEQ 36         (steps 830-836)
731  GTO 39         (step 337)
732<>LBL 00          Bark (prefix)
733  "BARK"
734  RTN
735<>LBL 01          Runn (prefix)
736  "RUNN"
737  RTN
738<>LBL 02          Peep (prefix)
739  "PEEP"
740  RTN
741<>LBL 03          Cry (prefix)
742  "CRY"
743  RTN
744<>LBL 04          Woo (prefix)
745  "WOO"
746  RTN
747<>LBL 05          Tree (postfix)
748  "|-TREE"
749  RTN
750<>LBL 06          Girl (postfix)
751  "|-GIRL"
752  RTN
753<>LBL 07          Ice (postfix)
754  "|-ICE"
755  RTN
756<>LBL 08          Eyes (postfix)
757  "|-EYES"
758  RTN
759<>LBL 09          Pit (postfix)
760  "|-PIT"
761  RTN
762<>LBL 42          Cell subroutine
763  "CELL "        Alpha message
764  ASTO X         Store it
765  XEQ 00         (steps 780-791)
766  99             Upper limit test
767  X>Y?
768  X<>Y
769  CLA            Clear Alpha
770  ARCL Z         Build message
771  ARCL X
772  "|- :"
773  AVIEW          Display message
774  "EMPTY"        Default cell content
775  GTO 45         (step 324)
776<>LBL 43          Key subroutine
777  XEQ 36         (steps 830-836)
778  "KEY"          Alpha message
779  RCL 07         Recall key
780<>LBL 00          Subroutine
781  "|-?"
782  CF 22          Clear entry flag
783  CF 27          A-J,a-e disabled
784  AVIEW          Display message
785<>LBL 56          Loop
786  PSE            Entry pause
787  FC?C 22        No entry?
788  GTO 56         (step 785)
789  ABS            Standardize entry
790  INT
791  RTN            End of routine
792<>LBL 44          Illegal key routine
793  FS? 08         Reaction?
794  GTO 48         (step 88)
795  FS? 25         Timer used?
796  STOPSW         Stop stopwatch
797  RTN            End of routine
798<>LBL 33          Random number generator routine
799  RCL 05         Current seed
800  PI
801  +
802  X^2
803  FRC
804  STO 05         New seed
805  *
806  INT            Compute requested integer value
807  RTN            End of routine
808<>LBL 34          Extract content of cell routine
809  RCL X
810  10
811  /
812  9
813  +
814  X<>Y
815  10
816  MOD
817  10^X
818  FS?C 11        Short return?
819  RTN            End of routine
820  RCL IND Y
821  X<>Y
822  /
823  INT
824  10
825  MOD
826  RTN            End of normal routine
827<>LBL 35          Score display routine
828  "SCORE : "     Alpha message
829  ARCL 19        Append running score
830<>LBL 36          Good tones routine
831  AVIEW          Display message
832  TONE 7         Good tones sequence
833  TONE 8
834  TONE 9
835  PSE            Delay
836  RTN            End of routine
837<>LBL 37          Bad tones routine
838  AVIEW          Display message
839  TONE 2         Bad tones sequence
840  TONE 1
841  TONE 0
842  PSE            Delay
843  RTN            End of routine
844<>LBL 38          Equipment routine
845  6              Extract code of equipment
846  X<>Y
847  -
848  LASTX          Reset code
849  "MAGIC "
850  FS?C 11        Delete "magic" message?
851  ASHF
852  GTO IND Y      (step ...)
853<>LBL 06          Elixir
854  "|-ELIXIR"
855  RTN
856<>LBL 07          Sword
857  "SWORD"
858  RTN
859<>LBL 08          Torch
860  "TORCH"
861  RTN
862<>LBL 09          Keys
863  "KEYS"
864  RTN
865<>LBL 10          Armor
866  "|-ARMOR"
867  RTN
868<>LBL 11          Spirit
869  "SPIRIT"
870  RTN
871<>LBL 12          Wand
872  "|-WAND"
873  RTN
874<>LBL 13          Exit
875  "|-EXIT"
876  RTN
877<>LBL 14          Nothing message
878  "NOTHING"
879  END

Software Information

System configuration

HP-41C + Quadram + (Time Module  - optional) or
HP-41CV + (Time Module - optional) or
HP-41CX

Program status

SIZE 020
Trig mode: DEG
User mode: ON (under program control)
Number of program steps: 879
Number of program bytes: 2068
Total number of registers (program+data): 316
Number of mag sides (card reader): 19

Overlay

WARNINGS [a]                           EXIT [d]     WAND [e]
SCORE [A]    UP [B]       DOWN [C]     BACK [D]     EQUIPMENT [E]
SWORD [F]    TORCH [G]    KEYS [H]     ARMOR [I]    SPIRIT [J]

Data Registers

R00 = Previous cell
R01 = Position
R02 = Adjacent call (left)
R03 = Adjacent call (right)
R04 = Adjacent call (up/down)
R05 = Seed (bats, 2nd hazard, etc)
R06 = Storey factor (storey & key)
R07 = Key
R08 = Reaction code (riposte)
R09 = Cells 00 through 09
R10 = Cells 10 through 19
R11 = Cells 20 through 29
R12 = Cells 30 through 39
R13 = Cells 40 through 49
R14 = Cells 50 through 59
R15 = Cells 60 through 69
R16 = Cells 70 through 79
R17 = Cells 80 through 89
R18 = Cells 90 through 99
R19 = Score

Flags (S=Set,C=Clear)

F00 = C = not used
F01 = C = Not used
F02 = C = Not used
F03 = C = Not used
F04 = C = Not used
F05 = C = 2nd riposte;
          2nd hazard after Golden Grail
F06 = C = Lethal hazard;
          Fork
F07 = C = New storey, same cell after hazard
F08 = C = Hazard, 'F' to 'J' available when S
F09 = C = GOLDEN GRAIL already in pack if S
F10 = S = KEY for GOLDEN GRAIL already given if C
F11 = C = propensity of bats (50%);
          delete 'MAGIC' on display for 'ARMOR', 'EXIT' and 'WAND';
          3rd adjacent cell;
          RCL/(STO) subroutine (LBL 34) control;
          auto-start if calculator turned off to on after death occurence
F12 = C = MAGIC ELIXIR if S
F13 = S = SWORD if S
F14 = S = TORCH if S
F15 = S = KEYS if S
F16 = C = MAGIC ARMOR if S
F17 = S = SPIRIT if S
F18 = C = MAGIC WAND if S
F19 = C = MAGIC EXIT if S
F20 = C = NOTHING if S
F21 = C = No printing
F22 = C = Numeric entry (cell and key) if S
          NO WARNING if S
F23 = C = Not used
F24 = C = Not used
F25 = S = Time taken into accound if S
F26 = S = Tones beeping if S
F27 = S = User mode for overlay ('A'-'E', 'a'-'e', 'F'-'J') if S;
          WIZARD if C
F28 = S = Decimal point used
F29 = C = No separator

References

Go back to the HP-41 software library
Go back to the general software library
Go back to the main exhibit hall