Skip to main content

Spell name entry

SpellNamePointer · 4-byte runtime structure

The engine in ten minutes · Magic · Mage and cleric spells

In brief​

The names the interface shows for spells come from two tables built into the executable, one for mage spells and one for cleric spells. Each entry is a far pointer to a zero-terminated name; the entry's index is the spell's ID within its table. A name entry says nothing about what the spell does.1

Layout​

The game only reads the tables; no code writing them was found.

/* One entry of a spell-name table (4 bytes, little-endian). */
typedef struct SpellNamePointer {
uint16_t offset; /* Offset of the zero-terminated name. */
uint16_t segment; /* Segment of the name, adjusted when DOS loads the program. */
} SpellNamePointer;

There is no padding. The tables are part of the executable's initial data, not a separate file. The stored segment is relocated at load time, so it is not a fixed memory address.

TableData-segment offsetEntriesUsed by
Mage namesDS:0x1fe1Index 0 is empty; IDs 1–32 are names.Scroll copying and spell selection.
Cleric namesDS:0x2065Index 0 is empty; IDs 1–29 are names.Another spell-selection path.

For example, mage ID 1 is Armor. When copying scrolls, mage ID i + 1 corresponds to bit i of the known-spells mask of CharacterRuntime. The full list is in the mage and cleric spells.2

Sources​

Locations refer to the game executable reference.

Footnotes​

  1. The spell-name tables. ↩

  2. Mage or cleric table selection, scroll copying and spell-name and slot pairing. ↩