Skip to main content

Overlays

The game executable · Memory map · Routines · Data

In brief​

Part of the code of the DOS START.EXE identified in the file inventory is not loaded with the rest of the program. It is stored at the end of the file in thirteen overlays, numbered 244 to 256, each loaded when one of its routines is needed. The overlays hold whole features of the game: drawing the dungeon view, creating the party, the camp menu, resting, loading levels, saving, dialogues and the end of the game.

Overlay code has no fixed address once loaded: where the game places it at run time is not established. Its locations are therefore given as physical file offsets in START.EXE, and its anchors start with o-. See how addresses are written.

The thirteen overlay images of START.EXE drawn to scale, from file offset 0x3d6e0 to 0x51470, all documented
The thirteen overlays of START.EXE, drawn to scale.

The thirteen overlays​

Each documented overlay has its own page, with a diagram of how its routines fit together, its entry points and its routines.

OverlayWhat it holdsImage sizeStub entriesDocumented addresses
244Drawing the dungeon view: visible blocks, walls, objects, monsters, doors, compass8,497 bytes2226
245Creating a party: creation screen, race, class, attributes, portraits, names10,250 bytes2529
246Setting up the new party: starting items and spells, release of the creation images1,687 bytes89
247Camp menu and spells: menus, questions, memorize, pray, scrolls9,807 bytes819
248Resting: rest steps, recovery, Insal, DRANX5,357 bytes1114
249Start-up and start menu: item data, interface colours, start menu, protection3,418 bytes1111
250Loading a level: the INF loader, its sections, the play screen6,850 bytes2437
251Saved games and level records: LEVELS.TMP, save files, slot menus5,147 bytes1517
252Dialogues and scripted sequences: dialogue, NPCs, dream, sequences6,241 bytes2930
253Pixel dissolve: pictures revealed dot by dot432 bytes11
254Transferring an Eye of the Beholder I party: conversion, character choice4,200 bytes1212
255The introduction: scenes, animations, texts, music waits7,582 bytes1515
256The end of the game: FINAL.SAV, the ending, the credits9,088 bytes1019

Documented addresses count the anchored addresses on each page: routine starts and the parts of routines described with their own address. Two kept anchors are not counted: 0x3f659, an older anchor of the compass routine of overlay 244, and 0x431ec, a branch inside a routine of overlay 247. Every function prologue (55 8b ec) of the thirteen images has an entry. An overlay can hold more routines than its stub has entries: most are called only from inside the overlay.

When the game uses them​

The overlays follow the life of a game session. This diagram shows only the calls established on the overlay pages; dashed boxes are resident code.

How calls reach an overlay​

A call never jumps straight into an overlay. It goes through the overlay's stub, a small block kept in the resident image, whose entries hand the call to the overlay manager with the target's offset in the overlay image. How the overlay manager, reached by INT 3Fh, loads an image is outside the scope of this reference.

  • Stubs. The thirteen stubs are stored at file offsets 0x2dda0–0x2e35f, just before the data segment. Each starts with a 32-byte header, followed by its entries.
  • Resident callers call a stub's paragraph directly, for example 0x2ae3:0x7f for entry 19 of overlay 250.
  • Overlay callers use a portal segment 0x7a0 + 8n for stub n. The portal is an index into the segment table at file offset 0x2d520, whose entry holds the stub's paragraph. All 46 portal call sites land on function prologues, which corroborates this reading.
  • Images. The overlay images follow the FBOV marker at file offset 0x3d6d0, contiguous from 0x3d6e0 to 0x51470. Each image is followed by its fixups, then zero bytes up to the next image; the fixups of overlay 256 lie after the image area, at 0x51470–0x515ed, followed by 34 zero bytes up to the end of the file.

Inside a stub​

Byte offsets within a stub. Entry k sits at stub offset 0x20 + 5k as the five bytes cd 3f <word> 00; the word is the entry's offset in the overlay image. Bytes 10–11 give the size in bytes of the fixups that follow the image, for all thirteen overlays: each fixup is a word, the offset in the image of a segment word to adjust, that of a far call (9a) or of a segment loaded as an immediate operand. Overlay 244, for example, has 30 fixups: 28 far calls and two segment immediates in the teleporter drawing, at image offsets 0x1ceb and 0x1cc8 (file offsets 0x3f3cb, 0x3f3a8), which load the segment of the sparkle points. Together they name nine segments: 0x20, 0x90, 0xa8, 0xd8, 0xf0, 0x170, 0x178, 0x208 and 0x250.

Stub, portal and image of each overlay
OverlayStub (file offset)Stub paragraphPortalImage startLengthFixups after imageEntries
2440x2dda00x2aba0x7a00x3d6e00x21310x3c at 0x3f81122
2450x2de300x2ac30x7a80x3f8600x280a0x180 at 0x4206a25
2460x2ded00x2acd0x7b00x422100x6970x20 at 0x428a78
2470x2df200x2ad20x7b80x428d00x264f0x190 at 0x44f1f8
2480x2df700x2ad70x7c00x450e00x14ed0x170 at 0x465cd11
2490x2dfd00x2add0x7c80x467600xd5a0x8c at 0x474ba11
2500x2e0300x2ae30x7d00x475500x1ac20xc6 at 0x4901224
2510x2e0d00x2aed0x7d80x490e00x141b0xda at 0x4a4fb15
2520x2e1400x2af40x7e00x4a5f00x18610x136 at 0x4be5129
2530x2e2000x2b000x7e80x4bf900x1b00x4 at 0x4c1401
2540x2e2300x2b030x7f00x4c1500x10680x8e at 0x4d1b812
2550x2e2900x2b090x7f80x4d2500x1d9e0xe4 at 0x4efee15
2560x2e3000x2b100x8000x4f0f00x23800x17e at 0x5147010

Image starts and lengths are file offsets and byte counts; fixup sizes are byte counts, from bytes 10–11 of the stub.

Resolved entries​

The stub entries whose target is resolved are listed under Entry points on each overlay's page. Two overlays are entered from a single place:

  • Entry 3 of overlay 249, the start menu, is called only by the resident program start-up, as 0x2add:0x2f at 0x18c55; no portal call 0x7c8:0x2f exists.
  • Overlay 256 is entered only from kill a monster (0x1abde, 0x1abe3), and calls entry 8 of overlay 251 from 0x4f0f0.

The resident call 0x2ae3:0x66 at 0x27320, in the level-change command, is entry 14 of overlay 250: the stub bytes cd 3f 0c 05 00 at file offset 0x2e096 lead to release monster shapes, 0x47a5c.

Calls into resident code​

Overlay code calls resident routines through segments fixed up at load time: the encoded segment is an index into the segment table at file offset 0x2d520, whose entry gives the paragraph. These calls are resolved:

Calling overlayEncodedResident targetRole
247, 2520x50:0x148, 0x50:0x212, 0x50:0x43c, 0x50:0x686, 0x50:0x6e9, 0x50:0x8690x1e388, 0x1e452, 0x1e67c, 0x1e8c6, 0x1e929, 0x1eaa9Inventory, party and string helpers
2480x50:0x1be, 0x50:0xbf9, and the six above except 0x50:0x2120x1e3fe, 0x1ee39Ring search, remove items from the party
249, 250, 2510xf8:0x107, 0xf8:0x406, 0xf8:0x44e, 0xf8:0x5de0x2dde7, 0x2e0e6, 0x2e12e, 0x2e2beFile open, close, read and write
250 at 0x4822b0x00a8:0x03800x2aa00Colour-table fill
250 at 0x48d0f—0x1afb2Monster slot initialization
251 at 0x491a7, 0x492e0segment 0x01f80x33744Far copy
249 at 0x474310x20:0x0ac30x19833Program exit
252 at 0x4b3cesegment 0x00x17540String compare
253 at 0x4bfea, 0x4c0410x138:0x40x30644Random number in a range
244, 249, 2510x170:0x90x310c9Set a text window's bounds
247, 249, 250, 251, 2560xd8:0xa0x2d92aCopy a page area
245, 247, 2510xe0:0x30x2d9b3Wait for screen refreshes
252 at 0x4b196, 0x4b3410x50:0xb880x1edc8Rebuild the play screen
251, end of 0x49b600x18:0x197, 0x40:0x1d40x18c77, 0x1cdb4Unidentified call; item-chain insertion

Sources​

The executable is identified in the file inventory; its layout is described on the memory map. Comparative sources are listed in the technical references.