Game Internals › Alternate Reality: The Dungeon › How items work

How items work

Every item in The Dungeon, spells and diseases included, is one variable-length record. A small engine of timed "effects" does everything an item does to you. This page builds on the 2008 notes and fills in the parts they left open, from the game's own code.

Where items live

Dan Pinal remembered "a big block of memory in the character data where all items go", and that's exactly it. While you play, the character record starts at $0800, and every item sits in a heap after it.

AddressWhat it holds
$090B / $094BThe handle table: 64 items at most, each a low byte and a high byte of its address. A zero high byte means the handle is free.
$0E00–$19FFThe item records, packed end to end. Deleting an item slides the later ones down and fixes their handles.
$089C–$08A5Ten equipment slots, each a handle or $FF: primary weapon, secondary weapon, head, body, arms, legs, and four apparel slots.
$0A00–$0DFF64 effect slots of 16 bytes, where running effects live. A free slot starts with $80.
$0994…The floor: a ring of 16 slots for dropped items and their positions. Each drop takes the next slot in turn and deletes for good whatever is still lying in it, which is the item dropped 16 drops earlier.

Items you carry, items on the floor, spells you know and diseases you've caught all live in the same heap. What tells them apart is the type byte and its "carried" bit.

7338 allocate · 7402 create from template · 737E delete and compact · 7429 handle → address · 7757 unequip · 74C1 floor ring

The type byte

The low three bits pick the class. The code uses bits 3–4 to choose special handling for some classes:

ClassPlainBit 3 ($08)Bit 4 ($10)Both ($18)
0 chargedsome monster attacks ("dripping fangs")wand: each use costs one crystallimited uses: a counter at attribute byte 1special code: Repair, Location, or removing every running effect of one kind (Remove Curse)
1 spelleffects onlyruns the Location code tooruns the Repair code too—
2 ammoquarrels and rifle ammo; the code also treats ammo type 1 as a guild ring (see ammo)
3 weaponweapons and shieldsthe lit torch——
4 armourhelmets, body armour, gauntlets, leggings
5 apparelclothes, boots, cloaks, tiaras
6 potioneffects onlycure: removes every running effect of one kindHealing and Restoration have it; Use doesn't check it—
7 specialquest items, each with a number the quest code looks for (the Bloodstone is 8, the Goblin and Troll ring halves 3 and 4)

Bit 7 ($80) means "carried". Picking an item up sets it and dropping it clears it. That's why the same Dagger appears as $03 in a monster's hand and $83 in your pack.

7AAD class dispatch (table 7ADE/7AE6) · 7AEE charged sub-types (7B15) · 7CA3 spell specials · 7E2E potion sub-types

Triggers

Byte +2 is a to-do list. When something happens to an item, the game sets a bit there. The dispatcher then handles the lowest bit that's set and clears the whole byte, so in practice only one event is queued at a time. Each event first cancels the item's running effects for the opposite event, then starts the effects for this one.

BitEventWhat the game does
$01pick upSets the carried bit. Cancels "drop" effects, starts "pick up" effects.
$02dropClears the carried bit and unequips the item. Puts it in the next slot of the floor ring (deleting whatever is still in that slot) and queues "stop using". Cancels "pick up" effects, starts "drop" effects.
$04useMarks it in use. Cancels "stop using" effects, starts "use" effects.
$08stop usingIf it was in use: cancels "use" effects, starts "stop using" effects.
$10destroyedStarts its "drop" and "stop using" effects, then deletes the item. Set when a weapon or armour breaks, and by some items on themselves.

Dan Pinal's "Get", "Drop", "Use", "Unuse" and "Poof" are exactly these five. Two items use the mechanism on themselves:

  • Loadstone: when dropped, it queues its own "pick up", so it jumps straight back into your pack.
  • Golden Apple: when picked up, it gives +15 to hit points and maximum hit points, and queues its own "destroyed", so it's used up at once.

7468 dispatcher · handlers via table 7574: 7497 pick up, 74AA drop, 750F use, 7520 stop using, 7552 destroyed

Effects

Everything an item does to you is an effect. It's a 16-byte instruction stored after the name. When its trigger happens, the effect is copied into one of the 64 running slots, and a timer there fires it.

ByteMeaning
0Kind. $81–$DF is an effect. The low 3 bits mark it as a disease (1), poison (2) or curse (3), which is what the status line and the cure potions look at. $E0 and up is a text label (see below).
1Group. With bit 7 set, it links the effect to its text label.
2Trigger: $01 pick up, $02 drop, $04 use, $08 stop using, $10 destroyed, $20 alignment mismatch. Plus two option bits:
$40 detached: the effect doesn't belong to the item, so it keeps running after the item is gone. Every potion, scroll and card uses this, since they're deleted when used.
$80 doesn't stack: it isn't started if an identical effect is already running.
3How many times it fires (0 = forever).
4–5Delay before the first firing, in time units.
6–7Interval between firings. One-shot effects leave filler here such as $F00D, $FEED or $DEAD.
8Chance of ending early. At each firing, 1 in 8 of the time, the game rolls against this value out of 256 and ends the effect if the roll is lower. This is how diseases wear off on their own.
9Action (below).
10–11Target address: an offset from the character record at $0800. With bit 15 set, it's an offset into the item itself instead.
12Count: how many targets.
13Step between targets.
14Value.
15The owning item's handle, filled in when the effect starts.

Actions

Byte 9Action
$01–$7FSet N bytes to the value (N is the action number).
$8NAdd the value to an N-byte big-endian number. Stops at all $FF instead of wrapping.
$9NSubtract. Stops at 0.
$AN, $BNNothing.
$CN / $DN / $ENExclusive-or, and, or with the value.

Each firing applies the action to count targets, step bytes apart. That's how one effect raises all eleven protections ($A6, 11 targets, step 1), or changes the same byte of all seven stats (step 8).

A worked example: Potion of Strength

84 FF C4 01 E0 01 ED FE 00 91 5B 00 01 00 14 00 subtract 20 from $085B, once, after 480 84 00 44 01 01 00 ED FE 00 81 5B 00 01 00 14 00 add 20 to $085B, once, after 1 EC 00 44 "Strength" … label shown under active magic

Both effects are detached ($40), so they outlive the potion. The subtraction is marked "doesn't stack" ($80) and comes first in the record. If an identical effect is already running, the game skips it and every effect after it. So a second, identical Potion of Strength drunk before the first one's 480-unit timer runs out does nothing (checked in the emulator). A +25 potion from Lucky's isn't identical to a +20 one, so the two do combine. The bonus byte at $085B is added to your base Strength ($085A) to give the strength the game uses ($0859). We checked this in the emulator: drinking the potion took the effective Strength from 20 to 40.

Timed bonuses, and a bug they cause

The game has no "lasts N turns" setting. A timed bonus is always two effects that fire on the same trigger: one gives the bonus straight away, and the other waits and takes it back. Fireblade, for example, sets the air damage added to weapon hits to 2d4, and a second effect sets it back to 0 after 61 time units. The Strength spell adds 25 to Strength and a second effect subtracts 25 after 360. The catalogue shows each pair as a single line, such as "weapon hits gain 2d4 air damage for 61 time units". One spell doesn't balance: Fury adds 2 to luck but takes back only 1 after 33 time units, so every cast leaves you 1 luck better off for good.

Potions, scrolls and cards mark both effects detached, so the timer runs on after the item is used up. Spells don't, so the take-back effect belongs to the spell. Remove the spell before the time is up and its pending effects are cancelled with it, take-back included. The bonus then stays for good. I've seen this in play, and Claude reproduced it in the emulator: cast Strength from the menu (Strength 20 → 45), then removed the spell with the game's own delete routine (737E, which cancels the item's effects through 7648). The take-back effect disappeared with it, and Strength was still 45 well after the 360 units had passed, while food and water ran down as normal. Left alone, the same cast wore off on time.

Labels

An effect whose kind is $E0 or more is a name such as "Strength", "Slow Death" or "Rabies" shown in a status list. Kinds $F0 and up take two slots. The 2008 notes found the low four bits choose the list: 1 diseases, $B curses, $C active magic.

Where effects point

Byte 10 names a place in the character record. The stats are seven 8-byte blocks: Stamina at $0849, then Charisma, Strength, Intelligence, Wisdom, Skill and Speed at $0879. Whenever anything changes, the game works out each stat afresh (6C9F):

value in use (+0) = base (+1) + bonus (+2) − penalty slots 1 to 4 (+3 … +6)

The sum is capped at 255 and each subtraction stops at 0. Potions and spells add to the bonus and take it away again. Cards and tomes add to the base, permanently. Curses and items that weigh you down write to the penalty slots, and some magic clears them. The block's eighth byte (+7) isn't part of the sum. The curse cure clears it, so it looks meant as a curse slot, but nothing ever counts it (see curses that do nothing). We checked the formula in the emulator by setting each byte of the Skill block in turn and rerunning the routine. Other targets used by items:

OffsetWhat it isUsed by
$45Hit points (2 bytes, capped at the maximum at $47)Healing, Bloodstone, diseases
$A6–$B0Protection against the 11 damage types, subtracted from every hitProtection, High Priestess, the Inv. potions
$D2–$DCExtra dice added to every weapon hit, per damage typeClout, Razoredge, Fireblade, Frostblade
$DD–$E7Spell damage dice, per typeFire Balls, wands, eyes, Death card
$F0Combat special effect, applied when your combat action resolves. See combat spell effects.Temporal Fugue, Bewilder, Paralysis, Prism, Blinding, Magic Darts, Fear, the Hypnotic Eye and Eye of Vulnerability, the Paralysis Wand
$B1Gold coins (2 bytes). Silver follows at $B3.Ace of Pentacles (+100 gold)
$E8Non-zero: the spell hits every monster in the groupFire Balls, Cold Wand, Holy Hand Grenade
$84 / $85Luck (also added to every hit roll) / alignmentLuck, The Fool, Reforged Ring
$8DHard to hit: monsters get −1 to hit youShadowmeld, Elven Cloak
$99–$9BFood, water and energy. Energy also pays for spells.Fruit Juice, Endurance, Vigor, Reforged Ring
$BB–$BFFood packets, water flasks, crystals, keysConjure Food, The Star, Conjure Key
$20Forced encounter: a monster number here starts a fight with that monster on your next step, then resets to $FF.Sword of Demons (flame demons, every 60 units while carried), one of the two Gold Horns (berserkers; the other restores hit points), The Heirophant (a pauper)
$81Your chance to surprise monsters. At the start of a fight the game rolls this plus 0–40 (the sum wraps at 256) against 0–255. You only surprise the monsters if your roll works and theirs, on their own surprise byte, doesn't.Stealth Suit (+64)
$82Encounter rate, 128 = normal. Once per time unit, the game rolls against the area's chance plus the amount above or below 128, and a success brings the next encounter one step closer. Walking moves it closer too, separately.Elven Cloak (−4)
$88Quest flags. Bit 0: PAC card. Bit 1: Amethyst Rod. Bit 2: Solar Suit. See below.PAC card, Amethyst Rod, Solar Suit
$96 / $97Drink not yet absorbed / how drunk you are. Each tick moves one point from the first to the second; once nothing is left to absorb, drunkenness drops by one every other tick.Potion of Inebriation and Saurian Brandy (drunkenness 255), Temperance (both 0)
$C2–$D1Your standing with each guild. Bit 7: full member (becoming a full member of one guild clears it on all the others). Bit 0: member, full or associate. Bits 4–5: warnings. Each monster you kill from a guild you belong to adds one, and the fourth makes you an outcast and ends your membership; the guild tells you about new warnings on your next visit ("Thou shalt not kill fellow members", "This is your last warning!"). Bit 6: outcast. Guilds also throw you out if your alignment drifts too far from theirs. Guild monsters greet members with "Hail friend!" and outcasts with "Die, outcast!"Ace of Cups (clears outcast status and warnings with every guild)
$100–$10AYour bare-hand damage dice, one byte per type, used when no weapon is in hand. Normally $13 blunt (1d3) and nothing else. Adding to a dice byte adds dice (high half) and die size (low half).Panther Gloves (+2 dice and +2 size to blunt and sharp while worn). The Iron Palm Salve is meant to add 2 blunt dice, but see below.

Fireblade adds air damage. Both the Fireblade spell and the Fireblade Scroll write their 2d4 to $08D5, which is the air slot. Clout, Razoredge and Frostblade land on blunt, sharp and cold as their names say, and weapons such as the Flamesword confirm fire is the fifth type. So the data, at least, gives Fireblade air damage, which looks like a slip in the game data.

The quest flags at $0888

  • Bit 0, the PAC card. Using the card sets it. At Death's Door, choosing "Use an item" with the bit set moves you to level 4 (map 6, position 2,1).
  • Bit 1, the Amethyst Rod. Using the rod sets it, and the rod's second effect clears it 4 time units later. While it's set, walking into one of three special wall types (8–10 in the movement table at $5D7A) lets you through and uses the bit up. One special place on level 2 also checks it and sends you to level 1.
  • Bit 2, the Solar Suit. Spellcasting checks it. In places flagged as magic-dead ($1B99 bit 1), a spell normally fails with "Something is odd here.", and this bit was meant to let you cast anyway. But both of the suit's flag effects fire on use, the clearing one straight after the setting one, so the bit never stays set. We watched it in the emulator: $0888 was written $04 and then $00 in the same tick. The second effect was probably meant to fire on "stop using".

The first two are read from the code, not played through.

Curses and penalties that do nothing

  • Four weapon curses. The skeleton's Sword and the Stilletto (Clumsiness), the Thunder Hammer (Loki's Wrath) and the Unholy Mace each subtract 1, again and again, from a stat's eighth byte. That byte starts at 0, can't go below 0, and isn't in the stat sum, so these curses only show their name in the status list. In the emulator we picked up the skeleton's Sword: the curse fired every 30 units, its repeat count ran down, and Skill stayed at 14. The other weapon curses work: the novice's Dagger lowers base Strength, and the Slow Death and Thirst curses drain hit points and water.
  • Snowshoes. They're meant to cost 10 Speed while worn, but both of their effects fire on use: one adds 10 to Speed's first penalty slot and the next takes it off again. In the emulator the slot was written 10, then 0, as soon as they were put on. Their warmth still works.

The Iron Palm Salve does nothing. Its one effect adds 2 dice to your bare-hand blunt damage, but unlike every potion and scroll, the effect isn't marked detached ($40). The salve has one use, so using it deletes it, and deleting an item cancels its effects before they fire. We checked this in the emulator through the game's own use routine: the salve vanished and the bare hand stayed at 1d3.

7584 start effects · 7648 cancel by trigger · 70A7 timer tick · 71B1 action dispatch (8BEE add, 8C14 subtract, 720E logic) · 6C7E HP cap · 5274 forced encounter · D217 surprise · 69FE encounter rate · 6A70 drink · guild code on disk 1B · 5580 barrier walls · 7BF7 magic-dead check · E781 bare hand

Combat spell effects

Combat spells, wands and eyes don't act on monsters themselves. Their effect writes a code to $08F0 (and dice to the spell-damage slots), and the combat code reads it when your action for the round resolves (D9AE → DA64, a jump table of nine handlers). Everything is cleared at the start of every round. We ran each code in the emulator against a group of 8 berserkers, and Fear against a great bat and an Undead Knight.

CodeUsed byWhat it doesHow
1Temporal FugueTwo free rounds. The monsters lose their turns, and in those rounds you get +3 to hit and four times the blunt and sharp damage.Adds 2 to $A9. While it's above 0, the round skips the monsters (D3F3), sets your to-hit bonus $B8 to 3 and the damage doubling count $B3 to 2 (doubled twice), and counts down. Also sets the flee countdown to 0, as Fear does. In the emulator, 2 player actions came before the monsters' next turn, against 0 without it.
3Bewilder, Hypnotic EyeBewilders each monster that fails a resistance roll. A bewildered monster does nothing until it passes an intelligence roll ("… breaks the spell") or you attack it. Monsters with no intelligence are immune.Sets bit 7 of the monster's state byte. On each of its turns the monster rolls its intelligence ($A027) and clears the bit on a pass. Every attack you make clears the front monster's bit, hit or miss (DC2F). In the emulator, 7 of 8 berserkers were bewildered, and some broke free each round.
4, 6Paralysis, BlindingStuns the front monster: 2 rounds if it fails a resistance roll, 1 if it passes, none on a critical pass ("… is stunned").Adds 2, 1 or 0 to the monster's stun counter, which is counted down each round. A stunned monster skips its turn. Monsters with flag $A020 bit 4 are immune. The two codes run the same handler.
5Paralysis Wand, PrismThe same stun, on every monster in the group.The same handler, looping over every monster. In the emulator the berserkers got 1 or 2 rounds each.
7Magic Darts(your level + 1)d4 sharp damage, at most 15d4.Writes the dice to the sharp spell-damage slot ($08DE): level, capped at 14, in the high half and 4 in the low half, then adds a die.
8FearFrom their next turn the monsters may run away, and each time one tries and fails, it loses its turn.Sets the group's flee countdown to 0 (see below).
9Eye of VulnerabilityStrips the monsters' protection dice. The special values monsters actually use (immune $FF, absorb $F0, double $0F) stay.Zeroes every one of the 11 protection bytes except $FF, $F0 and $0F. Other absorb or double values would be wiped too, but no monster record we found uses them. In the emulator the berserkers' 1d2 ($12) blunt, sharp and fire protection went to 0.

Code 2 exists (it gives a round with +1 to hit and doubled damage while the monsters wait) but no item uses it.

The resistance roll

For codes 3 to 6 the game makes one roll per monster (ECF0). It uses (the monster's byte $0D + its seven stats) ÷ 8 as the monster's strength in the game's usual skill roll (E918, the same routine as your hit roll), so a strong monster passes more often. A critical pass (a roll under a sixteenth of the target) means the monster isn't affected at all.

How monsters flee

Monster header byte $0F, unknown in the 2008 notes, is a flee countdown. It's one byte for the whole group ($A00F), and it drops by 1 every time any monster in the group takes a turn, so a big group runs it down fast. On disk it ranges from 10 (the alien sentry) to 255 (the Undead Knight, among others). Once it reaches 0, each monster considers running on every turn. 48 times in 256 (128 in 256 in some situations, when $AB is set) it tries, by rolling its speed ($A02A). If that roll fails, the monster loses its turn. If it passes, the monster gets away ("… flies away!" for fliers, "… flees!" for the rest), unless it's one that never runs (flag $A020 bit 6 or $A021 bit 3). Late in a long fight (round counter $9D47 at 128 or more) the countdown and the dice are skipped (E2B3–E323).

So Fear works two ways: monsters that can run, run, and every failed attempt costs a monster its turn. That second effect works even on monsters that can never run. In the emulator, with Fear, the Undead Knight tried 14 times in 90 turns, passed its speed roll 4 times and stayed, but lost 10 turns. The great bat, without Fear, only began to consider running on its 20th turn. With Fear it ran on its 9th.

Before the dice, the code compares the monster's stun and bewilder bytes with its base hit points and, if they match, doesn't let it run. Current hit points live elsewhere ($CA), and a similar check in another monster behaviour does compare current hit points with base, so this looks like a slip for "don't run while unhurt". As written it almost never matches. In the emulator a great bat that hadn't been touched ran.

DA64 effect dispatch · DA96 Fugue · DABA bewilder · DADB/DADF stun · DB28 darts · DB3E fear · DB44 vulnerability · ECF0 resistance roll · D41D stunned · D42B bewildered · E2B3 flee

Weapons and shields

Weapons and shields share one layout, as the 2008 notes suspected. Shields just tend to have low damage and high parry. Attribute bytes, counted from the 00 after the name and any effects:

ByteMeaning
000 (marks the end of the effects)
1Ammo type, or $FF for melee
2Shots loaded. Each shot uses one, and the [NN] in the name is rewritten to match.
3–13Damage dice for blunt, sharp, earth, air, fire, water, power, magic, good, evil, cold
14Minimum strength
15Minimum skill
16 / 17Durability now / when repaired. $FF never wears down.
18Flags: bits 0–2 attack verb, bits 3–5 to-hit modifier, bit 6 −1 to hit, bit 7 bonus when charging
19Parry

To hit

Each attack compares an attack value of 2 × level + Skill + 16 (at most 255) with a random roll, adjusted by a set of modifiers that includes your luck. The ones that come from the weapon and your choice of attack are:

  • Flag bits 3–5 are a signed modifier: 0–3 give +0 to +3, and 4–7 give −0 to −3. Razor Ice has +2, Sword of the Adept +3.
  • Flag bit 6 gives −1 to hit.
  • Skill below the weapon's minimum gives −1.
  • Charge (battle option 2) gives +2 to hit with weapons that have flag bit 7, but lowers your defence by 2 for the round.
  • Aimed Attack (option 3) raises your defence by 1 for the round and sets up +2 to hit with blunt and sharp damage doubled. Then 1 time in 4 you find no opening and don't attack at all.

Damage

  • Every die is rolled: N dice of 1 to M each, for each type. Then any extra weapon dice from spells ($08D2…) are added. The blunt and sharp extras (Clout, Razoredge) only count if the weapon already rolled some damage of that type. Equipping a weapon clears all these extras and ends the spells that set them.
  • Strength bonus. (Strength − minimum strength) ÷ 16 is added to blunt and to sharp, but never more than that type's roll. Bare-handed, it's Strength ÷ 16.
  • Critical hits. If the random number in the hit roll is below a sixteenth of what you needed (and below 16), the hit is critical: blunt and sharp damage are doubled, or a too-weak halving is cancelled.
  • Too weak. Strength below the minimum halves blunt and sharp damage. The code waives this when the weapon doesn't have flag bit 6, your Strength is at least half the minimum, and your secondary slot holds something. That last condition is the opposite of a "both hands free" rule, so it may be a bug, but that's what the code does.
  • The monster's resistances are applied last (immune, double, absorb), exactly as for your armour.

Wear and breaking

When you hit, your weapon may lose a point of durability. That's a quarter of the time (always once it's down to 1), and then on a further 50% roll, so 1 in 8 overall. When you parry a monster's attack (chance from your parry plus Skill), or a monster parries yours, the weapon loses a point on a straight 50% roll. At 0 the weapon breaks ("has broken") and is destroyed, and from 4 down you get a warning. The Whetstone and the Renew Scroll repair every weapon and armour piece in use.

DC2D critical hit (E918 returns 0) · DC64 monster parry · DB63 player attack · DC15 attack value · E918 hit roll · E991 dice · DD0E strength bonus · DDDA damage doubling/halving · E834 weapon wear · D8E9 battle options · E0C3 parry

Armour

ByteMeaning
1Where it's worn: 0 head, 1 body, 2 arms, 3 legs
2–12Protection for the 11 damage types
13 / 14Durability now / when repaired ($FF never wears down)

The protection bytes are dice, like weapon damage, with three special values. The same codes appear in the 2008 notes on monster armour:

  • $00: no protection.
  • $FF: immune. That damage type does nothing.
  • $01–$0F: weak. That damage type is doubled.
  • $10, $20 … $F0: absorbs. The damage heals you instead ("You feel strengthened from the attack!").
  • Anything else: roll the dice and subtract.

When a monster hits you, the game rolls the monster's damage, then subtracts your flat protection ($08A6…, from spells and cards). Then it picks where you were hit (usually the body, though some attacks land on a random place) and applies the armour worn there. If any damage gets through, then 1 time in 4 the armour loses 0–3 points of durability (0–6 on a heavy blow), and it's destroyed at 0.

E0B8 monster attack · ED87 armour · EE31 armour wear · 7D9E wear by location

Other classes

Spells (class 1)

Attributes: 00, cost, your skill %, backfire, spell number. To cast, the game first takes the cost from a guild ring in your pack, then from your energy at $089B (the byte Vigor and the Potion of Endurance raise), and anything still missing from your hit points. It then rolls 0–100. If the roll is below your skill, the spell works (so the chance is skill ÷ 101) and its "use" effects run. A working spell may also raise your skill by 1, to a cap of 95%. The chance of that is (Wisdom ÷ 2, rounded up, + 33) out of 256 during combat, and a quarter of that outside it. Otherwise the spell fails and the backfire value comes off your hit points. A Location or Repair spell also runs its special code.

7B78 cast · 7BDD pay · 7C10 roll · 7C1A learning · 7C7A backfire

Ammo (class 2)

Same first bytes as a weapon: 00, ammo type, count, 11 damage dice. Using ammo with a matching weapon in hand copies all twelve bytes into the weapon: the count and the damage. So Flame Quarrels make the crossbow do 2d10 sharp plus 2d4 fire until you load something else. The code treats ammo type 1 as a guild ring: "using" one turns a crystal into 10 charges, up to 99, and spells are paid from its charges first. No ring record is stored among the items on the disks, so rings are presumably built by the guild code.

Ammo types found on the disks: type 3 (Quarrels, Flame Quarrels and Thunder Quarrels) loads the crossbows, and type 4 (Pulse Rifle Ammo) loads the Pulse Rifle. The Beam Weapon (type 5) and the Gauss Rifle (type 6) have no ammo record. The catalogue links each weapon to its ammo and back.

7CBF

Apparel (class 5)

Two values, as in the 2008 notes. The second (warmth) is added up across your four apparel slots into $0895, which the cold check reads. The first (the 2008 notes' "dapper" value) is added up into $1BC3, and it helps you Bluff (and lowers shop prices, see Shops). Choose Transact, then Bluff, against a monster with intelligence 10 or more, and the game rolls your Charisma plus this total (and your luck). If it works, the encounter ends, and 4 times in 256 your base Charisma also goes up by 1. Monsters with intelligence below 10 don't fall for it. Two items have a negative style: Sackcloth and Ashes (−8) and the Stealth Suit (−15), stored as 248 and 241. Bluff treats them as negative, but the shoppe reads them as large numbers, so wearing either gets you its best price. Clothes with powers, such as the Elven Cloak and Winged Sandals, do it all through use/stop-using effects.

6AD2 apparel totals · E6DB bluff

Potions (class 6)

Drinking runs the "use" effects and deletes the potion, unless your stomach is too full. With the cure flag ($08), the attribute byte names what it cures: the Potion of Cleansing ($81) removes every disease and the Potion of Antidote ($82) every poison. A curse cure (3) also clears the curse bytes in your stats. Most potions found as treasure come unidentified: their name is cut after "Potion" (see Treasure).

7E1E drink · 7E51 cure · 7E67 remove effects by kind

Charged items (class 0)

  • Wands ($08) cost a crystal per use and do nothing without one.
  • Cards, eyes, horns, scrolls, tomes ($10) count down attribute byte 1 and vanish at 0. Most have 1 use, the Six Pack 6, Saurian Brandy 10.
  • Whetstone, Renew Scroll, Map Stone, Remove Curse ($18) count down byte 2, where 0 means unlimited. If byte 3 is 1, byte 4 picks special code: $10 repairs, $08 shows your location. Otherwise, a byte 4 of $08 removes every running effect of the kind in byte 1: the Remove Curse Scroll names $83, curses. The Whetstone and the Map Stone never run out.
  • Monster attacks such as "freezing breath" or "sharp claws" are stored in the item format inside each monster, with type $00 or $FF.

7AEE · 7B18 wands · 7B37 uses · 7B48 special code

Diseases, poisons and cursed weapons

Dan Pinal guessed that a disease is an invisible item, and it is. There are two routes:

  • On a hit. If a monster's attack record has 01 in byte 2 and the hit does damage, then half the time the game copies the attack into your pack as a hidden type-7 item, and its pick-up effects start. The attacks that do this are the giant rat's teeth (Rabies), the zombie's rotting arm (Living Death), the mold's spores (Green Lung), the werewolf's fangs (Lycanthropy), and the imp's and big snake's poison.
  • Cursed weapons. Some monster weapons carry a curse that starts when you pick them up: the goblin's Battle Axe, the berserker's Kukri and others (Slow Death), the novice's Dagger (Weakness), the acolyte's Dagger (Thirst), the skeleton's Sword (Clumsiness), and the dwarf's Thunder Hammer (Loki's Wrath). Monsters drop the weapon they fought with, so this is a real trap. We checked it in the emulator with the apprentice's Dagger. The curse is detached, so dropping the weapon doesn't end it.

The effect kind decides what cures it. Rabies, Living Death, Green Lung and Lycanthropy are diseases (kind 1, the Potion of Cleansing). The imp's and snake's poisons are kind 2 (the Potion of Antidote). The weapon curses are kind 3 (the Remove Curse Scroll).

E1E8 infection on hit · D4E0 weapon drop

Shops and guilds

Each shop module keeps a table of pointers to its item records and, beside it, one price byte per item. The catalogue shows these prices under "Comes from".

  • The shoppe (battle gear and apparel) lists a price in silvers for each of its 27 items. The asking price is that plus a small adjustment. Take your Charisma ÷ 16 plus the style total of the clothes you wear (at most 7): 0 or 1 gives +0, 2 gives −1, 3–4 give −2, then −3, −4, −5. Then add +3, +1, 0 or −2, depending on the shopkeeper's mood, unless the shopkeeper is in a bad mood, when the adjustment is a flat +2 whatever your Charisma. The result never drops below 1. You can agree to the price or make an offer. An offer at or above the asking price is taken. One of at least half gets a counter-offer about halfway between. Below half, the reply depends on the mood: in one, the item is taken off sale; in another, the shopkeeper makes a one-off cut to about three quarters of the price. After that cut, any offer below the asking price gets you thrown out of the shoppe.
  • Lucky's Potion Brewery sells 21 potions at fixed prices in silvers and shows what's in stock four at a time. The stock changes from day to day, and after you buy a potion there's a 51 in 256 (about 20%) chance it's sold out. Lucky also sells unknown "experimental" potions for 20 silvers and identifies a potion for 2.
  • The dwarven smithy sells 11 items, priced in gems or jewels rather than coins, and shows its stock four at a time.
  • The guilds share one table of 50 spells, each with a price in silvers and a minimum character level. Each of the eight guilds has its own list of the spells it teaches. A guild only offers a spell once your level reaches the minimum and you don't already know it.

Prices are in silvers unless shown otherwise. At Lucky's, if you're short of silvers, the game breaks gold coins into 10 silvers each.

shoppe D3E0 price, D1A0 adjustment, D5C9 offers · Lucky's D29D · smithy D4C0 · guilds D862 (lists at $EC48)

Weight

Header byte 4 of every carried item is added up, along with your food, water, torches and coins (scaled down), to decide when you're Burdened or Encumbered.

6AF9–6B60

What's new since 2008

  • Header byte +2 (2008: byte 3, unknown) is the pending-trigger list.
  • Effect byte 8 (2008: byte 9, unknown) is the chance of ending early, and byte 15 (2008: byte 16, unknown) is the owning item, filled in when the effect starts. The low bits of byte 0 mark diseases, poisons and curses.
  • Effect triggers: $10 is "destroyed", $20 alignment mismatch, $40 detached (2008 guessed "drain charge"), and $80 doesn't stack (2008 guessed "set timer").
  • Actions go well beyond add ($81) and subtract ($91): set N bytes, multi-byte add and subtract, and the three logic operations. The Amethyst Rod's $D1/$E1 are an AND and an OR.
  • Weapon flags: the to-hit modifier is three bits, signed (bits 3–5, not two). Bit 6 costs 1 to hit, bit 7 helps when charging, and bits 0–2 are the verb, as the 2008 notes said.
  • Weapon bytes 15–16 (1-based, as in 2008) really are minimum strength and skill. Durability $FF means unbreakable.
  • Armour protection is dice plus the three special codes, and armour wears and breaks like weapons.
  • Spell bytes: cost, skill, backfire, then a spell number.
  • Wands burn crystals. Guild rings turn crystals into spell charges. Ammo replaces the weapon's damage when loaded.

Sources and confidence

The Dungeon disks have no DOS file system. The game boots its own loader, stores every byte XORed with $87, and lays files down tracks in descending order, reading each track in DOS 3.3 logical order from sector 15 down to 0. We decoded the four .nib images, extracted all 400 item records, and booted the game in a purpose-built Apple II emulator (its 6502 core passes Klaus Dormann's functional test). We put items into a character's pack and logged which instructions read each item byte while equipping, fighting, casting and drinking. The code addresses on this page come from those traces.

Directly confirmed in the emulator: the treasure odds (the game's own code rolled 3,000 items per list), the Strength potion bonus, catching a disease from a dropped weapon, equipment slots by location, the forced encounters behind $0820, the Solar Suit's flag being cleared as soon as it's set, the Iron Palm Salve doing nothing, a timed spell's bonus staying for good when the spell is removed early, the combat spell effects, monsters fleeing, the stat formula, and the curses and Snowshoes that do nothing. Everything else comes from reading the code, with the addresses given. Things we didn't trace: where on the map each special treasure is placed, and exactly how far your alignment can drift before a guild throws you out.

Apple II version 2.1 (Datasoft, 1987). The 2008 notes, with material from Guilherme de Sousa, Dan Pinal and Jason Frear, are on the overview page.