Routines
Address
Description
37689
Wait for interrupt then display and handle input device selection menu
37764
Display and handle Gadget X menu
37880
Clear stack and prepare to load data
37909
Draw input device selection menu and update currently selected input device
37951
Display instructions windows
38003
Set border to black and clear temporary storage area of memory
38024
Initialise data and start a new game
38205
Main game loop: Process keyboard input and move Magic Knight or enter menus
38429
Handle Magic Knight's fall, preserving x-velocity
38434
Handle Magic Knight's falls
38585
Kill Magic Knight's x-velocity if he cannot horizontally pass through a block beside him
38724
Kill Magic Knight's jump if he cannot vertically pass through a block above him
38780
Draw top in-game window
38829
Print "STORMBRINGER" text at top of command summary window
38841
Move Magic Knight into room
A
, draw room, objects and characters and initialise room-specific data
39014
Room drawing: Start drawing layout data fragment
39036
Room drawing: Skip over block drawing data to start of next instruction
39047
Room drawing: (000) Draw floor, paint attributes / terrain interaction data, draw Magic Knight, characters and objects then return
39158
Room drawing: Advance
IX
to start of next room layout data entry and paint attributes
39183
Room drawing: Advance
IX
to start of next room layout data entry and paint terrain interaction data
39189
Room drawing: Start painting attribute / terrain interaction data for layout data fragment
39216
Draw run of 2 × 2 blocks horizontally
39291
Draw run of 2 × 2 blocks vertically
39366
Draw 2 × 2 block with style index
A
at stored coordinates then move right two characters
39393
Finalise room drawing, draw objects and characters, and animate the arrival of any new characters
39553
If a character has arrived then redraw Magic Knight and all characters in room
39578
Print Magic Knight's current room's name at top of screen
39655
Prepare to execute room-specific routine for Magic Knight's current room
39668
Check whether Magic Knight is moving into a new room and react if so
39682
Change Magic Knight's current room if possible
39714
Move Magic Knight one room to the left if possible
39758
Move Magic Knight one room to the right if possible
39795
Draw all characters in Magic Knight's current room
39829
Animate arrival of any new character if in Magic Knight's current room
39883
Draw a character
39933
Paint a character's attributes
39958
Animate puff of smoke at coordinates pointed to by
IX
40008
Set Magic Knight's velocity to zero, if appropriate move to new room, update state of storm cloud and execute room-specific routine
40153
Decrease Magic Knight's current strength by ten
40177
Decrease Magic Knight's current strength by one every fourth call
40190
Decrease Magic Knight's current strength by average of 1/4 if he is carrying the Glow Shield
40201
Room-specific routine: Decrease Magic Knight's strength by one once every four frames
40235
Room-specific routine: Update position of 1 axe and display
40239
Room-specific routine: Update positions of 4 axes and display
40258
Room-specific routine: Kill Magic Knight if he is in a dark room without illumination
40326
Load
B
with room index of object
A
40338
Room-specific routine: Check for egg dropped down wishing well and set wish-pending flag and display message if appropriate
40357
Check whether an egg has been dropped down the wishing well and set wish-pending flag if so
40406
Room-specific routine: Move Magic Knight down a room if appropriate
40437
Room-specific routine: Move Magic Knight between teleport rooms if appropriate
40489
Room-specific routine: Display cave progress and set Magic Knight's x-velocity to 2 if at floor level
40523
Room-specific routine: Set Magic Knight's x-velocity to 2 if his y-coordinate is 136
40527
Room-specific routine: Set Magic Knight's x-velocity to -2 if his y-coordinate is 136
40546
Room-specific routine: Move Magic Knight up or down a room if appropriate and boost jumps if wearing Power Boots
40598
Room-specific routine: Kill Magic Knight if he is too close to Bearwoolf
40614
Room-specific routine: Enable / disable entry to castle depending upon disquise worn and whether Newspaper is held
40658
Divide
A
by eight, rounding down to nearest integer
40664
Room drawing: Read graphic definition from room layout data and draw
40845
Paint room layout data entry's attributes, applying horizontal and vertical mirrors (room drawing)
40873
Paint room layout data entry's attributes, applying horizontal mirror (room drawing)
40905
Paint room layout data entry's attributes, applying vertical mirror (room drawing)
40937
Paint room layout data entry's attributes (room drawing)
41035
Store coordinates of area to be coloured and point
IX
at RLE attribute (or terrain interaction) data (room drawing)
41081
Paint room layout data entry's terrain interaction parameters, applying horizontal and vertical mirrors (room drawing)
41109
Paint room layout data entry's terrain interaction parameters, applying horizontal mirror (room drawing)
41141
Paint room layout data entry's terrain interaction parameters, applying vertical mirror (room drawing)
41173
Paint room layout data entry's terrain interaction parameters then advance to next entry (room drawing)
41271
Draw 2 × 2 block with style index
A
at bitmap virtual text cursor then move right two characters
41459
Read glowing character block definitions and add to current room
41477
Add a glowing character block to the current room
41504
Copy 2 × 4 (characters) region of display file into temporary storage
41545
Copy 2 × 4 (characters) region from temporary storage into display file
41578
Process command to pick up an object
41748
Process command to drop an object
41915
Load
C
with 7 (index of broken glass)
41918
Load
C
with 8 (index of broken glass)
41921
Load
C
with 9 (index of broken glass)
41924
Process command to take an object
42036
Remove current object from current character's inventory and add it to Magic Knight's then return to main game loop
42085
Take an object routine: Off-White Knight
42091
Take an object routine: Aramis Le Peux
42105
Take an object routine: Robin of Shylock
42157
Take an object routine: Have current character take object
A
in exchange for Newspaper
42220
Take an object routine: Reggie the Rat
42226
Take an object routine: Rachel of Amazonia
42232
Take an object routine: Barker the Ent
42238
Take an object routine: Organon the Guard
42244
Take an object routine: Grunter the Bearwoolf
42247
If current object is an egg then display "[Character] WANTS TO KEEP THE [Object]" window (13) and return to main game loop
42257
Process command to give an object
42395
Remove current object from Magic Knight's inventory and add it to a character's then return to main game loop
42429
Give an object routine: Off-White Knight
42441
Give an object routine: Robin of Shylock
42479
Give an object routine: Aramis Le Peux and Reggie the Rat
42482
Give an object routine: Rachel of Amazonia
42485
Give an object routine: Barker the Ent and Organon the Guard
42488
Give an object routine: Grunter the Bearwoolf
42494
Display and handle main in-game menu (when fire is pressed)
42616
Print currently available additional in-game menu command options
42638
Process command to examine yourself / a character / an object
42938
Insert numeric stats (at
HL
) of a character into "examine character" window text
43000
Insert numeric / text stats of an object into "examine object" window text
43043
Process command to command a character
43117
Send current character to sleep if possible
43158
Wake current character up if possible
43199
Make current character go away if possible
43250
Have a character help if possible
43318
Make current character eat and drink if possible
43428
Make current character be happy if possible
43494
Process command to read an object
43636
Process command to throw an object
43874
Process command to cast a spell
43950
Cast Dimension Merge if possible, otherwise display failure message
43998
Display failure message (when attempting to cast Melt Granite)
44001
Cast Pass Plant if possible, otherwise display failure message
44063
Cast Spell of Wonder if possible, otherwise display failure message
44100
Cast Travel to Person if possible, otherwise display failure message
44198
Cast Magic Fulcrum if possible, otherwise display failure message
44216
Cast Quiticus Gamus and jump to game over
44225
Flash border and screen and decrease Magic Knight's magic level if level is at least
C
44253
Show "WELL DONE" screen, jumping to game over when fire is pressed
44337
Process command to blow an object
44615
Load
BC
with coordinates of character's arrival point when summoned and set zero flag if character refuses
44635
Process command to wear / unwear an object
44861
Process command to teleport
44933
Process command to tickle a character
44990
Process command to pull lever
45095
Process command to smell something
45131
Process command to have a wish
45149
Process command to have a drink
45206
Print name of
B
-th conditional command in command summary window
45224
Command-character-to-help routine for Off-White Knight
45227
Command-character-to-help routine for Aramis Le Peux
45256
Command-character-to-help routine for Robin of Shylock
45333
Command-character-to-help routine for Reggie the Rat
45336
Command-character-to-help routine for Rachel of Amazonia
45342
Command-character-to-help routine for Barker the Ent
45345
Command-character-to-help routine for Organon the Guard
45348
Command-character-to-help routine for Grunter the Bearwoolf
45351
Load
A
with weight of object
A
45364
Load
A
with current character's happiness level
45380
Wait for interrupt then load object
C
into the first empty inventory slot of a character
45390
Point
HL
to the
E
-th byte of the
A
-th record in object properties table
45406
Point
HL
at
E
-th byte on
A
-th record of characters' current stats table (excluding Magic Knight)
45411
Point
IX
at current character's current stats
45423
If character's happiness is lower than
B
then show "[Character] DOES NOT WANT TO BE COMMANDED..." and jump to main game loop
45434
Increase current character's happiness by amount
A
45450
Point
IX
at current inventory of character
A
45466
Test whether current object is too heavy for Magic Knight to pick up (or take)
45505
Check whether Magic Knight is wearing an object
45510
Check whether Magic Knight is carrying an object
45522
Insert current time and score into "time left" and "percentage completion" texts
45552
Display "[Character] IS ASLEEP" window and jump to main game loop if current character is asleep, else return
45584
Load Magic Knight's coordinates (in characters) into
DE
45601
Point
HL
at current position data for current character
45617
Adjust height (at
DE
) of a window to accommodate text
45625
Set a window's height to
A
45631
Display "YOU ARE NOT WEARING ANYTHING" window and set zero flag if Magic Knight's inventory (wearing) is empty
45641
Display "YOU ARE NOT CARRYING ANYTHING" window and set zero flag if Magic Knight's inventory (carrying) is empty
45685
If
A
is 4 then display "THE BEAR SAYS..." message and wait for fire to be pressed
45723
End the game if current character is Off-White or Grunter
45766
Print name of object in inventory slot
A
of inventory data at
HL
in command summary window
45781
Update current character based upon selection made in menu
45802
Display a character's inventory window as an information window
45809
Show list of objects (window or menu) and handle selection if a menu
45963
Display and process input for character selection menu (current room's characters only)
46106
Display and process input for character selection menu (character list defined at
HL
)
46183
Set Magic Knight's available action flags
46326
Set Magic Knight's available action flags (additional)
46380
Load
C
with property of index
A
for all Magic Knight's carried objects,
OR
-ed together
46408
Create list of characters in room
A
and load
A
with number of characters
46463
Print Magic Knight's current strength at (6, 2) as text if he is carrying the Mirror
46490
Draw objects in Magic Knight's inventory if he is carrying the Mirror
46560
Update position of axe, display, and decrease Magic Knight's strength if in contact
46742
Multiply x- or y-velocity of axe by minus one
46784
Draw axe(s) to screen if Magic Knight is in an axe room
46837
Splice numeric data
A
as a string into a string at
HL
46873
Print text at location
HL
to screen using full screen width
46902
Print text at location
HL
to screen
47020
Return from recursive text-printing
47023
Text printing: Return from current level of text printing
47049
Text printing: Print an entry from the common words table
47080
Text printing: Toggle BRIGHT flag
47084
Text printing: Toggle FLASH flag
47092
Text printing: Change PAPER colour
47096
Text printing: Change INK colour
47110
Print the current object's name
47121
Print appropriate Newspaper substring for current required disquise
47132
Print current Crystal Ball substring
47143
Print current Scroll substring
47154
Print the name of the current command
47162
Print the current character's full name
47170
Print the current character's short name
47178
Return
47179
Subtract 100 from common word index and jump to second part of common words table
47185
Draw a menu window
47193
Draw a window
47326
Draw a window frame
47491
Draw an upper or lower window frame edge then increment the border character index
47502
Process keyboard / joystick input on a menu and load
A
with selected item index
47592
Wait for fire button / key to be released
47603
Move hand cursor up and update menu item highlighting
47665
Move hand cursor down and update menu item highlighting
47703
Load
A
with (zero-based) index of selected menu item
47731
Invert INK and PAPER bits to (de-)highlight currently active menu item
47797
Convert numeric value
BC
to ASCII string at location
HL
47833
Clear lower two thirds, and lower three character rows of upper third of display file
47856
Clear display file
47881
Flood attribute file with stored attribute value
47897
Set parameters for and play upward scale sound
47930
Set parameters for and play downward scale sound
47938
Set parameters for and play short downward scale sound
47946
Play hiss-type sound
47989
Set parameters (for cheat / debug routine sound) and play
48018
Get current border colour in
A
48027
Fill a region of attribute file with specified attribute (e.g. background colour and colour of text within)
48081
Blank the interior of an area of the display file (i.e. set bytes to zero)
48164
Draw all objects in Magic Knight's current room
48191
Set terrain interaction data for character blocks spanned by an object and draw the object
48341
Remove object
C
from a character's inventory and tidy up remaining entries
48360
Draw a line from (
C
,
B
) to (
E
,
D
)
48389
Print word in temporary text buffer to screen, wrapping text if necessary, then process next word
48518
Move virtual text cursors (attribute and bitmap) down to left edge of next row of window
61214
Room drawing: Reset apply-vertical-mirror flag, reset apply-horizontal-mirror flag and draw a graphic
61236
Room drawing: Set apply-vertical-mirror flag, reset apply-horizontal-mirror flag and draw a graphic
61267
Room drawing: Reset apply-vertical-mirror flag, set apply-horizontal-mirror flag and draw a graphic
61297
Room drawing: Set apply-vertical-mirror flag, set apply-horizontal-mirror flag and draw a graphic
61336
Room drawing: Draw a graphic
61387
Load contents of
A
into memory location pointed to by
HL
61390
Read (from graphic data) repeat counter value, x, and draw x rows of reset pixels
61411
Read (from graphic data) repeat counter value, x, and draw x rows of set pixels
61415
Room drawing: Jump to routine to advance
HL
to next display file address to be drawn to
61418
Room drawing: Advance
HL
to next display file address to be drawn to (apply-horizontal-mirror flag reset)
61521
Room drawing: Advance
HL
to next display file address to be drawn to (apply-horizontal-mirror flag set)
61625
Reverse the order of the bits in
A
61638
Store background bitmap data at Magic Knight's current location
61720
Overlay graphic data for Magic Knight's current frame on table of bitmap data for Magic Knight at his current location
61774
Draw bitmap data for Magic Knight overlaid on background to display file
61816
Set redraw-Magic-Knight-on-next-interrupt flag and wait for interrupt
61823
Erase Magic Knight from display, advance his current position then redraw
61860
Store background attributes if appropriate, then draw Magic Knight to display without drawing axes
61913
Store background attribute data at Magic Knight's current location
62003
Restore background attribute data at Magic Knight's current location
62178
Call time-dependent routines (main interrupt routine)
62310
Interrupt routine: Write current attribute for a glowing block to attribute file
62317
Interrupt routine: Update glowing blocks' attribute to next colour in sequence
62330
Update game time, time left and move characters if appropriate
62428
Increase Magic Knight's current magic level by 20 (up to maximum of 100)
62443
Make Chicken lay an egg if possible
62476
Update all characters' stats (deteriorate or regenerate) and wake up / send to sleep if required
62594
Update characters' stats as they tire or regenerate
62622
Move character whose turn it is to move, if allowed
62778
Get index of destination room for a character and load into
A
62812
Update index of character whose turn it is to be updated
62827
Update character's x-coordinate if new value is allowed, otherwise return
62853
Set position of character whose turn it is to move to his/her initial position
62877
End game due to running out of time
62959
Store all registers on the stack
62987
Restore all registers from the stack
63005
Print text/graphic character in
A
and advance bitmap virtual text cursor
63040
Draw axe to screen
63134
Load
HL
with display file address for coordinates in
BC
63162
Draw a UDG, with index
A
, from 2 × 2 blocks' UDG data at location of bitmap virtual text cursor
63203
Move virtual cursor (bitmap) to display file for coordinates x=
C
, y=
B
and load address into
HL
63219
Point
HL
at terrain interaction data, or attribute file address for character coordinates x=
C
, y=
B
63233
Point
HL
at terrain interaction data for character coordinates x=
C
, y=
B
63247
Advance bitmap virtual text cursor right by one character
63263
Advance bitmap virtual text cursor to start of next character row
63286
Update attribute virtual text cursor based upon current bitmap virtual text cursor
63302
Draw a run of characters (e.g. edge of frame of a window)
63313
Advance
HL
to byte after first zero from address in
HL
onwards
63322
Point
HL
at start of
B
-th entry in list of read-texts of readable objects
63327
Point
HL
at start of
B
-th entry in list of "command a character" commands
63332
Point
HL
at
B
-th entry in table of object names
63349
Print text at
DE
(command summary) in command summary window at top of screen
63388
Print command summary text (text at
DE
, e.g. "COMMAND ") in command summary window
63399
Print or update command summary window at top of screen
63443
Swap x- and y-coordinates of current window / graphic with values in temporary storage
63472
Update character printing routine to use base address of text character set graphics
63488
Update character printing routine to use base address of floor character set graphics
63494
Draw a graphic with lookup index
A
, width of 2 and height of 3 at character coordinates (
C
,
B
)
63499
Draw a graphic with lookup index
A
, width of 2 and height of 2 at character coordinates (
C
,
B
)
63504
Draw a graphic with lookup index
A
at character coordinates (
C
,
B
)
63598
Update currently selected input device
63657
If Kempston joystick is not present then revert to previously selected input device
63668
If key-press was enqueued then return index of last key pressed, else wait for key-press and return index
63691
Print current control keys to screen
63740
Redefine keyboard controls
63969
Set zero flag if key pressed is already assigned to a control, otherwise reset
64034
Capture keyboard input, or jump to joystick reading routine, loading result into
A
64042
Capture keyboard input
64091
Capture Kempston joystick input
64122
Capture cursor joystick input
64159
Capture Sinclair joystick 1 input
64192
Store a "left" input from control device
64195
Store a "right" input from control device
64198
Store an "up" input from control device
64201
Store a "down" input from control device
64204
Store a "fire" input from control device
64207
Display execute / reject command window and return if execute chosen, else exit to main game loop
64230
Wait for interrupt then display "PRESS FIRE TO CONTINUE" window and wait for fire to be pressed
64258
Display "YOUR HANDS ARE FULL" window (13) and return to game
64265
Display "THE [object] IS TOO HEAVY FOR YOU" window (13) and return to game
64270
Display "[Character] WANTS TO KEEP THE [Object]" window (13) and return to game
64275
Display "[Character] DOES NOT WANT THE [Object]" window (13) and return to game
64280
Display "[Character] DOES NOT WANT TO BE COMMANDED BY YOU" window (29) and return to game
64285
Display "[Character] CANNOT HELP YOU" window (29) and return to game
64290
Display "YOU CANNOT [Current Command] THAT SPELL NOW..." window (12) and return to game
64297
Display window 12 with text at
HL
and return to game
64301
Display window 24 with text at
HL
and return to game
64305
Display window 27 with text at
HL
and return to game
64309
Display window 28 with text at
HL
and return to game
64313
Display window 29 with text at
HL
and return to game
64317
Display an information window with text at
HL
and return to game
64354
Scroll a region of the display file up a pixel row without wrapping
64360
Do nothing (return)
64361
Scroll a region of the display file down a pixel row without wrapping
64367
Scroll a region of the display file up a pixel row
64456
Scroll a region of the display file down a pixel row
64548
Flash border and screen (as in cast a spell)
64582
Display cyan "game over" window and return to control selection menu
64623
Advance
HL
by
A
words, load
HL
with word at location
HL
as address and jump to it
64627
Load address with index
A
in a list of addresses at
HL
into
HL
64637
If do-not-draw-storm-cloud flag is set then prepare to draw storm cloud
64687
If do-not-draw-storm-cloud flag is reset then draw storm cloud
64810
Set new random seed and load
A
with a random number
64829
Generate a random seed / random number up to
B
64836
Select Magic Knight's room (cheat / debug routine)
64878
Cheat / debug routine: Draw Magic Knight's current room then jump back into cheat routine main loop
64883
Cheat / debug routine: Decrease Magic Knight's current room index by 1, wrapping around to 51 if below zero
64906
Cheat / debug routine: Increase Magic Knight's current room index by 1, wrapping around to zero if above 51
64912
Cheat / debug routine: Increase Magic Knight's current room index by 8, wrapping around to zero if above 51
64919
Cheat / debug routine: Decrease Magic Knight's current room index by 8, wrapping around to zero if below zero
64926
Cheat / debug routine: Exit cheat / debug mode
64935
Set left and right x-coordinates to edges of screen and load
A
with Magic Knight's current strength
65524
Interrupt routine: second jump
65535
Interrupt routine: first jump