Loading a level
Overlay 250 · image 0x47550–0x49011 (6,850 bytes) · 24 stub entries
All overlays · ← 249 · Start-up and start menu · 251 · Saved games and level records →
In brief
Overlay 250 loads a level from its LEVEL<n>.INF file. Its routines select the sublevel and read the map, walls, doors, decorations, monsters and their shapes, the palettes and colour tables and the script timers; the loader ends by copying the scripts and applying the cell bindings. The overlay also redraws the whole play screen after a load, a removed character or a monster-resource change. The loader checks no offset, count or index read from the file. The player-visible result is described in level data; the file in the INF format.
Every address on this page is a file offset in START.EXE; calls into resident code are given as analysis addresses. See how addresses are written.
How it fits together
The four callers of the INF level loader and its main steps. The other routines of the overlay read the sections of the file it reaches. Dashed boxes are outside this overlay.
Entry points
Stub entries whose target is resolved, from the stub bytes or another independent anchor, or through the portal reading.
| Encoded entry | Target | Role |
|---|---|---|
0x7d0:0x3e (entry 6) | 0x478eb | Release the door shapes |
0x7d0:0x43 (entry 7) | 0x47550 | Release the decoration shapes |
0x7d0:0x48, 0x2ae3:0x48 (entry 8) | 0x4811e | VCN name build and load |
0x7d0:0x61, 0x2ae3:0x61 (entry 13) | 0x48f69 | Redraw the play screen |
0x7d0:0x66, 0x2ae3:0x66 (entry 14) | 0x47a5c | Release monster shapes; 0x2ae3:0x66 is the call of 0x27236 at 0x27320 |
0x7d0:0x7f, 0x2ae3:0x7f (entry 19) | 0x48d45 | INF level loader |
All 24 targets are read from the stub bytes (entry k at stub offset
0x20 + 5k): 0 0x486e9, 1 0x4847b, 2 0x47dfa, 3 0x47f36, 4
0x47af0, 5 0x47e98, 6 0x478eb, 7 0x47550, 8 0x4811e, 9 0x48bea,
10 0x47c50, 11 0x476fa, 12 0x4839c, 13 0x48f69, 14 0x47a5c, 15
0x47975, 16 0x48329, 17 0x47718, 18 0x480bc, 19 0x48d45, 20
0x487a7, 21 0x47fcb, 22 0x48769, 23 0x475a0. Entries 2, 3 and 5 are
also stored as far pointers in the monster image loaders.
Routines at a glance
| Routine | Address |
|---|---|
| Release the decoration shapes | 0x47550 |
| Read decoration records | 0x475a0 |
| Assign a wall mapping | 0x47718 |
| Release the door shapes | 0x478eb |
| Load the shapes of a door graphic | 0x47975 |
| Release monster shapes | 0x47a5c |
| Load DCR descriptors | 0x47af0 |
| Monster colour variants | 0x47c50 |
| Load monster shapes | 0x47dfa, 0x47e98, 0x47f36 |
| Colour the VCN blocks for the EGA mode | 0x47fcb |
| Build the EGA block masks | 0x480bc |
| Load a VCN file | 0x4811e |
| Copy VCN colour maps | 0x48176 |
| Rebuild the block item chains | 0x48329 |
| Read the level map | 0x4839c |
| Read monster properties | 0x48497 |
| Load script timers | 0x486e9 |
| Toggle a wall group | 0x48769 |
| Select a sublevel | 0x487a7 |
| Load the level palette and colour tables | 0x48876 |
| Read the door records | 0x48a4d |
| Read the monster graphics slots | 0x48afe |
| Set the step script limit | 0x48ae7 |
| Read the wall section | 0x48b49 |
| Read initial monster states | 0x48bea |
| INF level loader | 0x48d45 |
| Copy scripts and apply cell bindings | 0x48e81 |
| Redraw the play screen | 0x48f69 |
| Test a bit | 0x476fa |
Routines
Release the decoration shapes
| Address | Range |
|---|---|
0x47550 | 0x47550–0x4759f |
Frees and clears the first 300 decoration shapes
(cmp si,0x12c at 0x47591) and sets the count of copied decoration records
(DS:0xe5c0) to 0 (0x47597). Called once for each sublevel record read, at
0x48a4a, before its decoration section.
Anomaly: ANOMALY-157:
the selectors of references that the new record does not map are not touched,
while the count restarts at 0 and every shape is released, so a kept selector
names a record that the new mappings may overwrite and rectangles that
may not be cut again.
Used by: Run a sequence › Portal animation, Doors, teleporters and temporary walls › Released shapes, Level 8: reference tables, Anomalies and bugs
Read decoration records
| Address | Range |
|---|---|
0x475a0 | 0x475a0–0x476f9 |
0x475a0(image name, DEC name) loads the decoration image with
the CPS image loader, then reads the DEC file: the
count and the 52-byte records into the shared buffer at
offset 0x3e80, then the count and the 8-byte rectangles, whose address it
keeps at DS:0xd1c0. The records stay in file form until
wall mappings copy them.
Used by: Level data (INF) › What it becomes in memory, Wall decorations (DEC) › Organization
Assign a wall mapping
| Address | Range |
|---|---|
0x47718 | — |
Stores a wall mapping of the level: its flags, with bit 0x04
inverted, in the wall properties, and its type in the
wall special types. For a decoration number other
than −1, it sets the decoration selector of the wall to
the count of copied records plus one, then copies the decoration's chain:
each 52-byte file record goes to the next runtime record
(0x47752–0x4777f); each of its ten rectangle numbers other than 0xff
whose shape is not cut yet is checked (four signed words;
error "Error trying to make decoration %d", DS:0x1266) and cut with the
shape encoder (0x47787–0x47845); the count is
incremented; the copied link, read sign-extended (0x47860), ends the
chain when zero and is otherwise rewritten as the 1-based number of the
next runtime record (0x4787c). The error "Too many decoration types
loaded!" (DS:0x12c3) follows a count above 60 (0x478af). The
rectangle and link roles are also supported by
REF-MW-009.
Anomaly: ANOMALY-78: the check
for "Too many decoration shapes loaded!" (DS:0x129f) at
0x47887–0x47891 compares with 300 only the rectangle number of the tenth
position, left in si by the loop (0x47797), after every shape has been
stored at 0x47841.
Anomaly: ANOMALY-157:
a mapping sets only the selector of its own reference, from the count that
0x47550 restarted (0x4772a–0x4772f). Nothing updates the selectors
of the references that the current record leaves unmapped.
Used by: Level 8: reference tables, Wall decorations (DEC) › Flags and links, Wall decorations (DEC), Level data (INF) › What it becomes in memory, Walls and doors › Faces that the level does not map, Walls and doors › What a wall lets through, Wall decorations (DEC) › Organization, Wall interaction types, Wall mapping flags, Wall properties, Wall references with built-in effects › In the original levels, Images, palettes and fonts, Screen coordinates, pixel by pixel, Compressed containers (CPS), Decoration, door and monster images, Dungeon graphics, Wall layouts (VMP), Scenes and sequence pictures, Level maps, Anomalies and bugs
Release the door shapes
| Address | Range |
|---|---|
0x478eb | 0x478eb–0x47974 |
Frees and clears the six door shapes and the six switch shapes of the door tables.
Comparative source: REF-SCUMM-016, releaseDoorShapes.
Used by: Doors, teleporters and temporary walls › Released shapes, Run a sequence › Portal animation, Doors, teleporters and temporary walls › Released shapes
Load the shapes of a door graphic
| Address | Range |
|---|---|
0x47975 | 0x47975–0x47a5b |
Loads the CPS image named at the start of a door record, then cuts with the shape encoder three door shapes from three rectangles of four words (column, row, width in columns, height), and two switch shapes, each from a rectangle followed by an x word and a y word of which the low byte is kept. The shapes of door graphic g go to door shapes 3 g to 3 g + 2 and switches 3 g and 3 g + 1 of the door tables. Returns the address after the 48 bytes of rectangles and positions.
Comparative source: REF-SCUMM-016,
DarkMoonEngine::loadDoorShapes.
Used by: Spots and wall decorations › Where objects are drawn, Level data (INF) › What it becomes in memory, Images, palettes and fonts, Compressed containers (CPS), Decoration, door and monster images, Dungeon graphics, Scenes and sequence pictures
Release monster shapes
| Address | Range |
|---|---|
0x47a5c | 0x47a5c–0x47aef |
0x47a5c(first, count) frees and clears the
monster shapes and the
monster decorations first to first + count − 1.
The level loader calls it with 0 and 36 (0x48a43); the
script form of opcode 0xec with 18 entries of one
graphics slot.
Used by: Monster decorations (DCR) › Monster images, groups and frames, Run a sequence › Portal animation, Change level or load monster resources › Monster-resource loading, Doors, teleporters and temporary walls › Released shapes, Values passed on to other routines › The routines, Level 3: the lower catacombs and the ant nest, Level 8: reference tables, Level 3: reference tables › The ant nest
Load DCR descriptors
| Address | Range |
|---|---|
0x47af0 | 0x47af0–0x47c4f |
0x47af0(name, first) returns at once when the file named with
the DCR name format does not exist (0x47b15);
otherwise it reads the DCR groups and cuts each
entry with a nonzero width and height through the
shape encoder, storing group g entry s at
decoration first + 6g + s (0x47b84–0x47ba6). Called
by the three monster image loaders with their first shape.
Used by: Monster decoration entry › In brief, Monster decorations (DCR) › In brief, Monster decorations (DCR) › Organization, Monster decorations (DCR) › Monster images, groups and frames, Compressed containers (CPS) › Unpacked images, Images, palettes and fonts, Decoration, door and monster images, Dungeon graphics, Scenes and sequence pictures, Level data (INF)
Monster colour variants
| Address | Range |
|---|---|
0x47c50 | 0x47c50–0x47df9 |
0x47c50(name, first), called by each
monster image loader after cutting the shapes: for each of the
six shapes k, it reads rows 184–199 of column 302 + 3k of the image
page (0x47cc3–0x47ce1) and finds each colour in the shape's 16-colour
table; it then builds two copies of the table in which those colours are
replaced by the pixels of columns 303 + 3k and 304 + 3k
(0x47d25–0x47dd2), stored in the colour variant tables.
The monster drawing uses variant 1 or 2 for a
monster whose slot_mod_3 is 1 or 2.
Used by: Compressed containers (CPS) › Unpacked images, Monster slot › Layout
Load monster shapes
| Address | Range |
|---|---|
0x47dfa, 0x47e98, 0x47f36 | 0x47dfa–0x47e97, 0x47e98–0x47f35, 0x47f36–0x47fca |
loader(name, first, decorations), chosen by the
monster loader table: loads the image with the
CPS image loader, cuts six shapes with the
shape encoder from the first six rectangles of the
layout DS:0x110a, DS:0x119a or DS:0x122a
respectively, into monster shapes first to
first + 5, builds the colour variants and, when
decorations is nonzero, loads the DCR file (0x47e86,
0x47f24, 0x47fbb). The sublevel record reader calls them at 0x48b31
with first = 18 × graphics slot.
Used by: Compressed containers (CPS) › Unpacked images, Monster decorations (DCR) › Monster images, groups and frames, Change level or load monster resources › Monster-resource loading, Compressed containers (CPS) › Details and edge cases, Images, palettes and fonts, Decoration, door and monster images, Dungeon graphics, Scenes and sequence pictures, Level data (INF)
Colour the VCN blocks for the EGA mode
| Address | Range |
|---|---|
0x47fcb | 0x47fcb–0x480bb |
Called twice by the VCN loader in the EGA mode, for
blocks 0–999 (argument 1) and 1,000–1,999 (argument 0). It clears a
2,000-byte table in the work area addressed by DS:0xcbc4
(0x47fe8–0x47ffc) and writes 1 at the offset given by each of the first
330 VMP words (0x48003–0x48025). It then turns each 4-bit pixel of the
32,000 bytes of blocks into one byte, through the backdrop colours when
the argument is 1 and the block's byte in the table is set, otherwise
through the wall colours (0x4802d–0x480ab).
Anomaly: the offset is the raw VMP word, flags included: the add at
0x48015 and the store at 0x4801c write past the 2,000-byte table for a
backdrop entry with bit 0x4000 and leave the block unmarked. The
work area starts at offset 0x2dbe of the program's
first code segment, so the byte for block b lands at offset 0x6dbe +
b, analysis address 0x16dbe + b: inside the
critical-error handler for blocks 1 to 46, on the
first byte of its installer for block 47.
Used by: Display modes › The three modes, Dungeon tiles (VCN) › Reading the file, Wall layouts (VMP), Anomalies and bugs
Build the EGA block masks
| Address | Range |
|---|---|
0x480bc | 0x480bc–0x4811d |
In the EGA mode, writes one mask byte for every four pixels of the VCN blocks into the block buffer: two bits per pixel, set when its raw value is not 0, 16 bytes per block. The EGA tile drawing uses them as the transparency of a block drawn over the backdrop.
Used by: Display modes › The three modes, Dungeon tiles (VCN) › Reading the file
Load a VCN file
| Address | Range |
|---|---|
0x4811e | 0x4811e–0x48328 |
Builds a VCN file name and loads the file. It copies the two
colour tables, then a fixed 47,500 bytes of block data
(0x48209–0x48228) to the block buffer, whatever the
file's block count. In the Tandy mode it first replaces colours 1–15 of
both tables through a table returned by driver slot 49
(0x481b3–0x48207). In the EGA mode (0x4823d–0x48306) it
colours blocks 0–1,999, has the driver store them in video
memory (slot 10, the second half at segment
0xabe8), reloads the file and builds the masks.
Used by: Dungeon tiles (VCN) › Organization, Run a special event › Reload the wall graphics (event 6), Display modes › The three modes
Copy VCN colour maps
| Address | Range |
|---|---|
0x48176 | — |
Copies the VCN colour maps of the level.
Used by: Dungeon tiles (VCN) › Organization
Rebuild the block item chains
| Address | Range |
|---|---|
0x48329 | 0x48329–0x4839b |
Clears the item chain of every level block,
then inserts each of the 600 items whose level_raw is
the current level and whose location_raw is positive
into its block, at its position_raw, with the
chain insertion. Called by the
INF level loader at 0x48eb9.
Used by: Item entry › Block chains, Level block › Changes during play, Changing level › Returning to a level, Level data › What each part of the files becomes, Level records and level changes › Changing level, How a script runs › Scripts and the game's state, Move the party, monsters or items, Where an item is, Initial items (ITEM.DAT)
Read the level map
| Address | Range |
|---|---|
0x4839c | 0x4839c–0x4847a |
Clears the 1,024 level blocks
(0x483a4–0x483b5), opens the name it is given (0x483b8–0x483c7), reads
six header bytes into the first block entry (0x483cc–0x483de) and
0x1000 bytes into the level-data buffer
(0x483e1–0x483f6), without testing what either read returns. When the
level's saved-level bit is set, it restores the walls
from LEVELS.TMP through 0x49368; otherwise it copies the
1,024 four-byte cells into words +0 and +2 of the blocks
(0x48444–0x48473). Neither path writes the rest of an entry, so the
header's third word stays as the state of block 0 (ANOMALY-64; header
read 0x483d3–0x483d9, cell copy 0x48444–0x48455).
Used by: Anomalies and bugs, Level block › From the files to memory, Level block › In brief, Level maps (MAZ) › Reading the file, Blocks, directions and positions › Directions and coordinates, Level data › Loading a level, Changing level › Returning to a level, Sublevels › The two records, Level data › What each part of the files becomes, Level records and level changes › Changing level, Loading, failures and the end of the game › Details and edge cases, Loading, failures and the end of the game, Level maps, Level 8: reference tables
Read monster properties
| Address | Range |
|---|---|
0x48497 | 0x4847b–0x486e8 (the loop body starts at 0x48486) |
Reads the monster type properties with a
46-byte stride: each entry starts with its type index and is copied to
that index, until index 0xff (0x486c8–0x486da). The table is never
cleared (every literal reference to DS:0xcd1a is an index computation),
so entries the record does not define keep their previous values. The
index is read as signed and used without a range check (0x48486–0x48494);
the ranged-weapon bytes are stored from +0x24 for as many entries as the
signed count (0x4864e–0x48677).
Used by: Level data (INF) › What it becomes in memory, Level data › What each part of the files becomes, Monster capabilities, Level 4: reference tables › Monster types, Level 5: reference tables › Monster types, Bestiary, Level 2: reference tables, Level 3: reference tables, Level 6: reference tables, Level 7: reference tables, Level 8: reference tables, Level 9: reference tables, Level 10: reference tables, Level 11: reference tables, Level 12: reference tables, Level 13: reference tables, Level 14: reference tables, Level 15: reference tables, Level 16: reference tables, Level 1: reference tables › Monsters
Load script timers
| Address | Range |
|---|---|
0x486e9 | 0x486e9–0x48768 |
Loads the level's timer list into the
script timers, multiplying each period by 18 and
keeping the low 16 bits (0x4870e–0x4871f); the first deadline is the
counter plus that value, sign-extended. It sets no limit on the number of
timers.
Used by: Level data (INF) › What it becomes in memory, Level data › What each part of the files becomes, Level records and level changes › Changing level, Timed scripts › Timed block scripts, Level 4: reference tables › How often the timer fires, Level 7: reference tables, Level 8: reference tables, Level 10: reference tables, Level 12: reference tables › Pits, Level 6: reference tables › The moving pit, Level 11: reference tables › The moving pit, Level 14: reference tables › Falling floors
Toggle a wall group
| Address | Range |
|---|---|
0x48769 | — |
Sets (second argument nonzero) or clears bit 0x02,
WALL_RUNTIME_SMALL_PROJECTILE_PASSAGE, of the
wall properties of the references 10 g + 3 to 10 g +
11 except 10 g + 7, for door graphic g: the closed and partly open
references of its two door groups. The
door records loader calls it for each door record, setting the
bit when the record's marker is 0xea.
Comparative source: REF-SCUMM-013, toggleWallState.
Used by: Spots and wall decorations › Where objects are drawn, Walls and doors › Faces that the level does not map, Walls and doors › What a wall lets through, Wall mapping flags, Wall properties › Where each bit is tested, Level data (INF)
Select a sublevel
| Address | Range |
|---|---|
0x487a7 | — |
Selects sublevel record n by following the records'
next_offset words n times (0x487c8–0x487e1), without a bound check,
then calls 0x4839c with the record's map name
(0x487f6–0x487fd) when its marker is 0xec. n is the
sublevel passed to the INF level loader.
Used by: Level data (INF) › Organization, Level data › Loading a level, Sublevels › The two records, Level data › What each part of the files becomes, Sound effects, Images, palettes and fonts, Decoration, door and monster images, Dungeon graphics, Palettes (PAL, EGA, COL), Scenes and sequence pictures, Level 1: reference tables, Level 7: reference tables, Level 8: reference tables, Level 16: reference tables
Load the level palette and colour tables
| Address | Range |
|---|---|
0x48876 | 0x48876–0x48a17, inside the sublevel selection |
Loads 768 bytes into the palette buffer DS:0xf168 from
%s.PAL, or %s.EGA in the EGA mode, named after the record's palette
name when it has one, otherwise after its graphics name. It then builds five colour tables with
driver slot 12 (mga-606) from the palette
(0x4890f–0x48a00): with colours 224–255 temporarily white, DS:0xeee4
(colour 4, weight 75), DS:0xeee8 (12, 200), DS:0xee30 (10, 85) and
DS:0xcc26 (11, 125); then, with the palette restored, the
distance table (12, 85), which stays installed in the
driver. Outside the VGA mode it also sets the palette (0x48a0a–0x48a12).
Used by: Clipping, scaling and darkening › Darkening with distance, Display modes › The three modes, Palettes (PAL, EGA, COL) › Reading the file
Read the door records
| Address | Range |
|---|---|
0x48a4d | 0x48a4d–0x48ae6, in the sublevel loader, after the sound and the release at 0x48a1a–0x48a4c |
Whatever the sublevel's marker, after loading the sound named by
the record, releases the door shapes, then reads two door
records. A record starting with 0xec or 0xea names its door graphic g
(byte 13 after the marker): it toggles the graphic's walls
(set for 0xea), stores byte 14 as the graphic's
DoorKind and byte 15 as its "no switch" flag in
the door tables, and loads its shapes. Any
other first byte is skipped alone.
Comparative source: REF-SCUMM-016,
EoBCoreEngine::initLevelData.
Used by: Spots and wall decorations › Where objects are drawn, How a door graphic moves, Level data (INF) › Organization, Walls and doors › What a wall lets through, Level data › What each part of the files becomes, Play a sound
Set the step script limit
| Address | Range |
|---|---|
0x48ae7 | — |
Writes the steps until the step script and clears the step counter.
Used by: Level data (INF) › What it becomes in memory, Level data › What each part of the files becomes, Level records and level changes › Changing level, Events that start scripts, Timed scripts › Step-triggered script
Read the monster graphics slots
| Address | Range |
|---|---|
0x48afe | 0x48afe–0x48b40, in the sublevel loader, after the step script limit |
Reads the two monster graphics slots of the sublevel record. A slot that
starts with 0xec is a 16-byte record: its first byte selects one of the
three monster shape loaders through the far-pointer table at
DS:0x125a, which is called with the image name (bytes 2–14), the first
shape slot (second byte × 18) and the decoration flag (byte 15), which makes
the loader also read the image's DCR file. Any other first byte is skipped
alone.
Used by: Level data (INF) › What it becomes in memory, Monster decorations (DCR), Bestiary
Read the wall section
| Address | Range |
|---|---|
0x48b49 | — |
Loops over a section of the level data: a marker 0xec calls
0x475a0, anything else 0x47718.
Used by: Level data (INF) › What it becomes in memory, Walls and doors › What a wall lets through, Level data › What each part of the files becomes, Wall decorations (DEC) › Organization, Wall mapping flags
Read initial monster states
| Address | Range |
|---|---|
0x48bea | — |
Reads the conditional block of initial monster states. Its first
part (0x48bea–0x48c2f) reads (index v, interval) pairs until index
0xff, and stores each sign-extended interval in entries 2 + 2 v and
3 + 2 v of the timed-callback table: the update groups
2 v and 2 v + 1. At 0x48c9c–0x48cb1 it skips the initial monster
placement when the level's saved-level bit is set;
otherwise it clears the monster slots and places the
level's monsters. In between (0x48c31–0x48c92) it restarts monster
groups 0–3: the deadline of an even group is the counter plus its
interval, that of an odd group the counter plus half of it. v is not
checked, nor the slot index of a record (0x48d17–0x48d25).
Used by: Level data (INF) › What it becomes in memory, Sublevels › The two records, Level data › What each part of the files becomes, Monsters › How a monster acts, Noticing the party › Where the destination comes from, Monster slot › Copying runtime state, Monster slot › From the INF record to the slot, Monster slot › In brief, Monster slot › Other initialized fields, Monster state flags › Placed by the level, Level records and level changes › Changing level, Timed updates › Monster update cadence, Timed updates › The table of timed updates, Bestiary, Level maps, Level 3: reference tables, Level 6: reference tables, Level 8: reference tables
INF level loader
| Address | Range |
|---|---|
0x48d45 | — |
Builds the name LEVEL<n>.INF from the
INF name parts, stores the current level
and sublevel, calls 0x487a7 and
0x48bea and applies the cell bindings. It is called from
0x1cba6 (0x1cbbc), 0x1caf7
(0x1cb25), 0x27236 (0x272c9) and
0x49b60 (0x49efe): a byte scan of the whole file finds no
other far call to its stub entry, and no near call to it exists in
overlay 250. The level
data is described by the INF format. Its range,
0x48d45–0x48f68, includes 0x48e81; it
stops the shared counter at its start (0x48d51)
and restarts it at its end (0x48f51), so the first deadlines of the
level's timers count from the stopped counter. It checks no offset, count
or index of the file: the size word is read as signed (0x48dae), the
level-state and binding offsets are followed as given (0x48e06–0x48e1d),
and a level without the 0xec monster marker has its
monster slots cleared unless its
saved-level bit is set (0x48e51–0x48e7f).
Used by: Change level or load monster resources › Behavior, Compressed containers (CPS) › Reading the file, Level data (INF) › Reading the file, Level data › Loading a level, Level data › What each part of the files becomes, Changing level › When the game loads a level, Level records and level changes › Changing level, Scripted movement, monsters and items › Moving the party, monsters and items, The game clock › Pauses, Loading, failures and the end of the game, Level 3: the lower catacombs and the ant nest, Level maps (MAZ) › Reading the file, The engine, Level maps, Level 11: reference tables, Level 3: reference tables › The ant nest
Copy scripts and apply cell bindings
| Address | Range |
|---|---|
0x48e81 | 0x48e81–0x48f19 |
Copies the level's scripts and stores the cell bindings in words
+4 and +8 of the level blocks.
The script length is the binding offset minus the current position
(0x48e81–0x48e96), copied into the script buffer
without a check. The binding count is compared as signed; each cell index
is multiplied by 10 without a range check; the flags are ORed into +4
(0x48ef6) and the reference stored in +8 (0x48f0d). That store is the
only write of a block's script offset found, and the
dispatcher its only reader.
Used by: Block state flags › Use in the reference files, Level block › In brief, Level data (INF) › Organization, Blocks, directions and positions › Directions and coordinates, Level data › What each part of the files becomes, Print a message › The message table, Script virtual machine › Where scripts live, Events that start scripts › Monsters entering and leaving blocks, How a script runs › Scripts and the game's state, Script virtual machine › How a run starts, Level maps, Level 7: reference tables, Level 5: reference tables › Resurrection altars, Level 11: reference tables › The challenge
Redraw the play screen
| Address | Range |
|---|---|
0x48f69 | 0x48f69–0x49011 |
0x48f69(redraw view) rebuilds the whole play screen. It decodes
PLAYFLD.CPS into page 3 and copies it to page 2 through the
CPS image loader; on page 2 it draws the
compass and, when its argument is nonzero and no level
palette is waiting to be set (DS:0xee3b = 0, 0x48fac), the
scene; it then copies the whole of page 2 to the
screen and finally loads INVENT.CPS the same way, into pages 3 and 2.
That last load puts back what page 2 holds the rest of the time, as after
the INF level loader (0x48f1b–0x48f5d) and the save writer:
the background of the character panel's inventory page, which
the character sheet copies from page 2 to the
screen (0x2a2cd). DS:0xee3b is set to 1 at the end of the INF level
loader (0x48f58); the next scene redraw then,
when its argument is nonzero, fills the view with colour 12, sets the
palette held at DS:0xf168 and clears it (0x3f703–0x3f74e). So a call
just after a load leaves the view to that redraw. Callers: resident 0x1caf7 (0x1cb67,
argument 0) after loading the saved level; resident 0x1edc8 (0x1edea,
argument 1), which first reloads the VCN file and afterwards
redraws the portraits, and is itself called after
the monster-resource form of opcode 0xec (0x27354) and by overlay 252
(0x4b196, 0x4b341); the camp menu after a character is dropped
(0x44828); the rest when Insal leaves
(0x4624e); and the
saved-game reader (0x49f09), all with 0.
Used by: Entry points, Recruiting and dismissing characters, Rebuild the play screen, Images, palettes and fonts
Test a bit
| Address | Range | Status |
|---|---|---|
0x476fa | 0x476fa–0x47717 | No caller found |
0x476fa(value, bit) returns 1 when bit bit of the byte value, read
as signed, is set, and 0 otherwise. No near call in the overlay, no far
call through entry 11 and no far pointer to it was found in the file.
Used by: Entry points
Sources
The executable is identified in the file inventory; the overlay layout is described on the overlays page. Comparative sources are listed in the technical references.