Routines
Address
Description
26670
Display input device selection menu
26745
Display and handle Gadget X menu
26855
Clear stack and prepare to load data
26884
Draw input device selection menu and update currently selected input device
26926
Display instructions windows
26976
Set border to black and clear temporary storage area of memory
26997
Initialise data and start a new game
27136
Main game loop: Process keyboard input and move Magic Knight or enter menus
27352
Handle Magic Knight's fall, preserving x-velocity
27357
Handle Magic Knight's falls
27508
Kill Magic Knight's x-velocity if he cannot horizontally pass through a block beside him
27647
Kill Magic Knight's jump if he cannot vertically pass through a block above him
27703
Draw top in-game window
27750
Print "KNIGHT-TYME" text at bottom of command summary window
27762
Move Magic Knight into room
A
, draw room, objects and characters and initialise room-specific data
27934
Room drawing: (001 - 250) Read layout parameters and draw graphic in place
27951
Room drawing: (000) Draw floor, paint attributes / terrain interaction data, draw Magic Knight, characters and objects then return
28070
Room drawing: Advance
IX
to start of next room layout data entry and paint attributes
28095
Room drawing: Advance
IX
to start of next room layout data entry and paint terrain interaction data
28101
Draw all objects and characters in current room, draw Magic Knight, set action flags and validate I.D. card
28172
Print Magic Knight's current room's name at top of screen
28264
Prepare to execute room-specific routine for Magic Knight's current room
28277
Check whether Magic Knight is moving into a new room and react if so
28291
Change Magic Knight's current room if possible
28323
Move Magic Knight one room to the left if possible
28346
Move Magic Knight one room to the right if possible
28364
Draw all characters in Magic Knight's current room
28390
Draw a character
28432
Paint a character's attributes
28457
Set Magic Knight's velocity to zero, if appropriate move to new room, execute room-specific routine
28469
Room-specific routine: Do nothing
28470
Room-specific routine: Go to game over routine if Magic Knight is not wearing the Cloak of Invisibility
28482
Room-specific routine: Go to game over routine if Magic Knight is not wearing the Pair of Boots
28494
Room-specific routine: Go to game over routine if Magic Knight is not wearing the Gas Mask
28506
Room-specific routine: Show Tyme Guardians' warning message if not already shown
28542
Room-specific routine: Go to game over routine if Magic Knight is not carrying the Golden Sundial of Alpha
28554
Room-specific routine: Show Tyme Guardians' messages and install tyme machine on USS Pisces
28625
Divide
A
by eight, rounding down to nearest integer
28631
Room drawing: Read graphic definition from room layout data and draw
28696
If draw-communicate-window-face flag is set then draw communicate window face
28716
Wait for interrupt then flood 7th - 22nd rows of attribute file with attribute in
HL
28730
Room drawing: (255) Read start coordinates, repeat count and UDG code and print run of characters
28753
Room drawing: (254) Read start coordinates and UDG code and print the UDG
28766
Room drawing: (253) Draw a line
28785
Room drawing: (252) Draw a horizontal line
28833
Room drawing: Move virtual bitmap cursor to coordinates specified in layout data
28846
Paint room layout data entry's attributes, applying horizontal and vertical mirrors (room drawing)
28874
Paint room layout data entry's attributes, applying horizontal mirror (room drawing)
28906
Paint room layout data entry's attributes, applying vertical mirror (room drawing)
28938
Paint room layout data entry's attributes (room drawing)
29036
Store coordinates of area to be coloured and point
IX
at RLE attribute (or terrain interaction) data (room drawing)
29060
Skip
IX
over room layout data entry for which painting (attribute / terrain interaction) is inappropriate
29082
Paint room layout data entry's terrain interaction parameters, applying horizontal and vertical mirrors (room drawing)
29110
Paint room layout data entry's terrain interaction parameters, applying horizontal mirror (room drawing)
29142
Paint room layout data entry's terrain interaction parameters, applying vertical mirror (room drawing)
29174
Paint room layout data entry's terrain interaction parameters then advance to next entry (room drawing)
29272
If Magic Knight is on the bridge and USS Pisces is not at Gangrole then draw viewscreen starfield
29330
Process command to pick up an object
29488
Process command to drop an object
29619
Process command to take an object
29756
Process command to give an object
30001
Display and handle main in-game menu (when fire is pressed)
30123
Print currently available additional in-game menu command options
30145
Process command to examine yourself / a character / an object / USS Pisces
30533
Insert numeric stats (at
HL
) of USS Pisces into "examine USS Pisces" window text
30583
Insert numeric stats (at
HL
) of a character into "examine character" window text
30643
Insert numeric / text stats of an object into "examine object" window text
30686
Process command to command a character
30810
Send current character to sleep if possible
30842
Wake current character up if possible
30874
Have a character help if possible
30940
Process command to launch tyme machine
30968
Process command to read an object
31041
Process command to cast a spell
31122
Cast Remove Barriers if possible, otherwise display failure message
31188
Cast Consult Oracle if possible, otherwise display failure message
31257
Cast Fortify Character if possible, otherwise display failure message
31280
Cast Fortify Yourself if possible, otherwise display failure message
31312
Cast Lightning Bolt if possible, otherwise display failure message
31468
Show "WELL DONE" screen, jumping to game over on key-press
31537
Process command to wear / unwear an object
31688
Process command to move starship
32055
Set unknown flag
32065
Scroll viewscreen content down 24 pixel rows then display acceleration / deceleration effect (i.e. leave orbit)
32124
Display acceleration / deceleration effect then scroll viewscreen content up 24 pixel rows (i.e. enter orbit)
32158
Prepare viewscreen for USS Pisces' arrival at destination
32200
Remove starship destination entries for locations to the north-west, north and north-east
32213
Remove starship destination entries for locations to the south-west, south and south-east
32226
Remove starship destination entries for locations to the north-west, west and south-west
32239
Remove starship destination entries for locations to the north-east, east and south-east
32252
Process command to use transporter
32602
Update and increment predefined region's attribute 64 times (transporter effect)
32623
Set top-left and bottom-right of area to cycle attributes (for transporter effect)
32694
Handle vertical scrolling digit selection (use transporter menu) and load selected digit's ASCII code into
A
32867
Subtract ten from
IX
32880
Add ten to
IX
32886
Reset EAR bit, wait for interrupt then set EAR bit
32895
Process command to communicate
33100
Command-character-to-help routine for Gordon
33140
Command-character-to-help routine for Sarab
33170
Command-character-to-help routine for Klink and S3 E3
33290
Command-character-to-help routine for Hooper
33304
Command-character-to-help routine for Murphy
33318
Command-character-to-help routine for Sharon
33332
Command-character-to-help routine for Forbin
33338
Command-character-to-help routine for Derby IV
33448
Command-character-to-help routine for Swiftfoot
33462
Command-character-to-help routine for Julie 8
33468
Command-character-to-help routine for Hectorr
33487
Load
A
with weight of object
A
33500
Load
A
with current character's happiness level
33516
Load object
C
into the first empty inventory slot of a character
33525
Point
HL
to the
E
-th byte of the
A
-th record in object properties table
33541
Point
HL
at
E
-th byte on
A
-th record of characters' current stats table (excluding Magic Knight)
33546
Point
IX
at current character's current stats
33558
If character's happiness is lower than
B
then show "[CHARACTER] DOES NOT WANT TO BE COMMANDED..." and jump to main game loop
33569
Increase current character's happiness by amount
A
33585
Point
IX
at current inventory of character
A
33601
Test whether current object is too heavy for Magic Knight to pick up (or take)
33640
Check whether Magic Knight is wearing an object
33645
Check whether Magic Knight is carrying an object
33657
Insert current time and score into "time left" and "percentage completion" texts
33725
Display "[CHARACTER] IS ASLEEP" window and jump to main game loop if current character is asleep, else return
33757
Load Magic Knight's coordinates (in characters) into
DE
33774
Adjust height (at
DE
) of a window to accommodate text
33782
Set a window's height to
A
33788
Check whether Gordon and Sarab are both asleep, and increase their happiness by five if not
33824
Display "YOU ARE NOT WEARING ANYTHING" window and set zero flag if Magic Knight's inventory (wearing) is empty
33834
Display "YOU ARE NOT CARRYING ANYTHING" window and set zero flag if Magic Knight's inventory (carrying) is empty
33863
Check whether current object is wanted / unwanted by current character
33896
Check whether current character is carrying an object
33911
Print name of object in inventory slot
A
of inventory data at
HL
in command summary window
33926
Update current character based upon selection made in menu
33945
Display a character's inventory window as an information window
33952
Show list of objects (window or menu) and handle selection if a menu
34122
Display and process input for character selection menu (current room's characters only)
34265
Set Magic Knight's available action flags and validate I.D. card if appropriate
34484
Load
C
with property of index
A
for all Magic Knight's carried objects,
OR
-ed together
34512
Create list of characters in room
A
and load
A
with number of characters
34567
Draw strength bar at top of screen
34627
Draw objects in Magic Knight's inventory if he is carrying the Mirror
34697
Splice numeric data
A
as a string into a string at
HL
34733
Print text at location
HL
to screen using full screen width
34762
Print text at location
HL
to screen
34858
Return from recursive text-printing
34861
Text printing: Return from current level of text printing
34887
Text printing: Print an entry from the common words table
34918
Text printing: Toggle BRIGHT flag
34922
Text printing: Toggle FLASH flag
34930
Text printing: Change PAPER colour
34934
Text printing: Change INK colour
34948
Print the current starship location's name
34958
Print the current object's name
34968
Print the current character's name
34976
Subtract 100 from common word index and jump to second part of common words table
34982
Draw a menu window
34990
Draw a window
35123
Draw a window frame
35285
Draw an upper or lower window frame edge then increment the border character index
35296
Process keyboard / joystick input on a menu and load
A
with selected item index
35386
Wait for fire button / key to be released
35397
Move hand cursor up and update menu item highlighting
35459
Move hand cursor down and update menu item highlighting
35497
Load
A
with (zero-based) index of selected menu item
35525
Invert INK and PAPER bits to (de-)highlight currently active menu item
35591
Convert numeric value
BC
to ASCII string at location
HL
35627
Clear display file below 7th character row (play area)
35649
Clear display file
35674
Flood attribute file with stored attribute value
35690
Set parameters for and play upward scale sound
35723
Set parameters for and play downward scale sound
35731
Set parameters for and play short downward scale sound
35739
Play hiss-type sound
35782
Set parameters (for "USS Pisces has arrived" sound) and jump to playing routine
35790
Set parameters (for cheat / debug routine sound) and play
35819
Get current border colour in
A
35828
Display acceleration / deceleration effect on USS Pisces viewscreen
35882
Draw viewscreen "tunnel" rectangles
35940
Fill a region of attribute file with specified attribute (e.g. background colour and colour of text within)
35994
Blank the interior of an area of the display file (i.e. set bytes to zero)
36077
Draw all objects in Magic Knight's current room
36104
Set terrain interaction data for character blocks spanned by an object and draw the object
36254
Remove object
C
from a character's inventory and tidy up remaining entries
36273
Reset star to point of origin and generate a new direction and movement data
36321
Advance positions of stars on viewscreen by one timestep
36415
Reset all stars to point of origin and generate new velocities and movement data
36434
Set up star movement data based upon starting position and direction
36499
Move a star depending upon the signs and magnitudes of its "direction"
36543
Draw a line from (
C
,
B
) to (
E
,
D
)
36573
Draw a rectangle with opposite vertices at (
C
,
B
) and (
E
,
D
) (pixels)
36602
Print word in temporary text buffer to screen, wrapping text if necessary, then process next word
36731
Move virtual text cursors (attribute and bitmap) down to left edge of next row of window
52513
Room drawing: Reset apply-vertical-mirror flag, reset apply-horizontal-mirror flag and draw a graphic
52535
Room drawing: Set apply-vertical-mirror flag, reset apply-horizontal-mirror flag and draw a graphic
52566
Room drawing: Reset apply-vertical-mirror flag, set apply-horizontal-mirror flag and draw a graphic
52596
Room drawing: Set apply-vertical-mirror flag, set apply-horizontal-mirror flag and draw a graphic
52635
Room drawing: Draw a graphic
52686
Load contents of
A
into memory location pointed to by
HL
52689
Read (from graphic data) repeat counter value, x, and draw x rows of reset pixels
52710
Read (from graphic data) repeat counter value, x, and draw x rows of set pixels
52714
Room drawing: Jump to routine to advance
HL
to next display file address to be drawn to
52717
Room drawing: Advance
HL
to next display file address to be drawn to (apply-horizontal-mirror flag reset)
52820
Room drawing: Advance
HL
to next display file address to be drawn to (apply-horizontal-mirror flag set)
52924
Reverse the order of the bits in
A
52937
Store background bitmap data at Magic Knight's current location
53019
Overlay graphic data for Magic Knight's current frame on table of bitmap data for Magic Knight at his current location
53073
Draw bitmap data for Magic Knight overlaid on background to display file
53115
Erase Magic Knight from display, advance his current position then redraw
53150
Store background attributes if appropriate, then draw Magic Knight to display
53185
Store background attribute data at Magic Knight's current location
53278
Restore background attribute data at Magic Knight's current location
53479
Call time-dependent routines (main interrupt routine)
53498
Update game time, time left and move characters if appropriate
53573
Increase Magic Knight's current magic level by 10 (up to maximum of 100)
53585
Update all characters' stats (deteriorate or regenerate) and wake up / send to sleep if required
53703
Update characters' stats as they tire or regenerate
53731
Move character whose turn it is to move, if allowed
53861
Get index of destination room for a character, load into
A
and update character movement routine
53871
Update index of character whose turn it is to be updated
53886
If character has a disallowed x-coordinate in the "barrier room" then return twice
53937
End game due to running out of time
54051
Store all registers on the stack
54079
Restore all registers from the stack
54097
Print text/graphic character in
A
and advance bitmap virtual text cursor
54132
Move virtual cursor (bitmap) to display file for coordinates x=
C
, y=
B
and load address into
HL
54148
Point
HL
at terrain interaction data, or attribute file address for character coordinates x=
C
, y=
B
54162
Point
HL
at terrain interaction data for character coordinates x=
C
, y=
B
54176
Advance bitmap virtual text cursor right by one character
54192
Advance bitmap virtual text cursor to start of next character row
54215
Update attribute virtual text cursor based upon current bitmap virtual text cursor
54231
Draw a run of characters (e.g. edge of frame of a window)
54242
Advance
HL
to byte after first zero from address in
HL
onwards
54251
Point
HL
at start of
B
-th entry in list of read-texts of readable objects
54256
Point
HL
at start of
B
-th entry in list of "command a character" commands
54261
Point
HL
at start of
B
-th entry in list of starship destination names
54266
Point
HL
at
B
-th entry in table of object names
54283
Print text at
DE
(command summary) in command summary window at top of screen
54322
Print command summary text (text at
DE
, e.g. "COMMAND ") in command summary window
54333
Print or update command summary window at top of screen
54377
Swap x- and y-coordinates of current window / graphic with values in temporary storage
54406
Draw a graphic with lookup index
A
, width of 2 and height of 2 at character coordinates (
C
,
B
)
54411
Draw a graphic with lookup index
A
at character coordinates (
C
,
B
)
54505
Update currently selected input device
54564
If Kempston joystick is not present then revert to previously selected input device
54575
If key-press was enqueued then return index of last key pressed, else wait for key-press and return index
54598
Print current control keys to screen
54647
Redefine keyboard controls
54876
Set zero flag if key pressed is already assigned to a control, otherwise reset
54942
Capture keyboard input, or jump to joystick reading routine, loading result into
A
54950
Capture keyboard input
54999
Capture Kempston joystick input
55030
Capture cursor joystick input
55067
Capture Sinclair joystick 1 input
55100
Store a "left" input from control device
55103
Store a "right" input from control device
55106
Store an "up" input from control device
55109
Store a "down" input from control device
55112
Store a "fire" input from control device
55115
Display execute / reject command window and return if execute chosen, else exit to main game loop
55138
Display "PRESS FIRE TO CONTINUE" window and wait for fire to be pressed
55165
Display "YOUR HANDS ARE FULL" window (13) and return to game
55170
Display "YOU ARE WEARING TOO MUCH" window (13) and return to game
55177
Display "THE [object] IS TOO HEAVY FOR YOU" window (13) and return to game
55182
Display "YOU CANNOT WEAR THAT" window (13) and return to game
55187
Display "THERE IS NOTHING NEAR ENOUGH" window (13) and return to game
55192
Display "THERE IS NOTHING IN THIS ROOM" window (13) and return to game
55197
Display "YOU CANNOT DROP THE [object]" window (13) and return to game
55202
Display "[Character]'S HANDS ARE EMPTY" window (13) and return to game
55207
Display "[Character] WANTS TO KEEP THE [Object]" window (13) and return to game
55212
Display "[Character]'S HANDS ARE FULL" window (13) and return to game
55217
Display "[Character] IS NOT STRONG ENOUGH" window (13) and return to game
55222
Display "[Character] DOES NOT WANT THE [Object]" window (13) and return to game
55227
Display "[Character] IS ALREADY ASLEEP" window (29) and return to game
55232
Display "[Character] IS TOO WAKEFUL TO SLEEP" window (29) and return to game
55237
Display "[Character] DOES NOT WANT TO BE COMMANDED BY YOU" window (29) and return to game
55242
Display "[Character] IS ALREADY AWAKE" window (29) and return to game
55247
Display "[Character] IS TOO TIRED TO WAKE UP" window (29) and return to game
55252
Display "[Character] CANNOT HELP YOU" window (29) and return to game
55257
Display "[Character] IS TOO TIRED TO HELP YOU" window (29) and return to game
55262
Display "THERE ARE NO BARRIERS TO BE REMOVED HERE." window (29) and return to game
55267
Display "YOU CANNOT EXAMINE THE USS PISCES IF..." window (29) and return to game
55272
Display "YOU HAVE ARRIVED AT X.Y.Z." window (17) and return to game
55277
Display "THE STARSHIP HAS ARRIVED AT [Starship Location]" window (12) and return to game
55282
Display "THERE IS NO WRITING FOR ME TO READ" window (12) and return to game
55287
Display window 17 with text at
HL
and return to game
55291
Display "GORDON AND SARAB ARE BOTH ASLEEP" window (12) and return to game
55298
Display "THERE IS NOBODY WITHIN SUB-SPACE COMMUNICATOR RANGE" window (12) and return to game
55303
Display "[Character] HEARS A VOICE AND IGNORES IT" window (12) and return to game
55308
Display window 29 with text at
HL
and return to game
55312
Display "[Character] DOES NOT RECOGNISE YOUR AUTHORITY" window (12) and return to game
55317
Display "[Character] DOES NOT LIKE STARFLEET SO HE IGNORES YOU" window (12) and return to game
55322
Display "[Character] HEARS A MUFFLED VOICE..." window (12) and return to game
55327
Display "GORDON AND SARAB CANNOT UNDERSTAND YOU" window (12) and return to game
55332
Display "YOU CANNOT CAST THAT SPELL NOW..." window (10) and return to game
55339
Display "[Character] HAS TAKEN YOUR PHOTO" window (10) and return to game
55344
Display "THE BARRIER HAS FADED INTO NOTHINGNESS" window (29) and return to game
55349
Display "YOU CANNOT DROP THE [Object] HERE" window (29) and return to game
55354
Display "[Character] HAS GONE TO SLEEP" window (29) and return to game
55359
Display "[Character] HAS WOKEN UP" window (29) and return to game
55364
Display an information window with text at
HL
and return to game
55401
Scroll a region of the display file up a pixel row without wrapping
55407
Do nothing (return)
55408
Scroll a region of the display file up a pixel row with wrapping
55414
Restore copied bitmap data from top to bottom of region to scroll
55436
Scroll a region of the display file down a pixel row without wrapping
55442
Scroll a region of the display file down a pixel row with wrapping
55448
Restore copied bitmap data from bottom to top of region to scroll
55470
Scroll a region of the display file up a pixel row
55559
Scroll a region of the display file down a pixel row
55651
Flash border and screen (as in cast a spell)
55685
Display cyan "game over" window and return to control selection menu
55726
Advance
HL
by
A
words, load
HL
with word at location
HL
as address and jump to it
55730
Load address with index
A
in a list of addresses at
HL
into
HL
55740
Set new random seed and load
A
and
E
with a random number
55768
Select Magic Knight's room and USS Pisces' current location (cheat / debug routine)
55814
Cheat / debug routine: Draw Magic Knight's current room then jump back into cheat routine main loop
55819
Cheat / debug routine: Decrease Magic Knight's current room index, wrapping around to 24 if below zero
55836
Cheat / debug routine: Increase Magic Knight's current room index, wrapping around to zero if above 24
55853
Cheat / debug routine: Decrease USS Pisces' current location index, wrapping around to 24 if below 1
55869
Cheat / debug routine: Increase USS Pisces' current location index, wrapping around to 1 if above 24
55887
Cheat / debug routine: Exit cheat / debug mode
65524
Interrupt routine: second jump
65535
Interrupt routine: first jump