Routines
Address
Length
Description
23820
64
Game loader - load game code and set execution starting address
31744
3
Launch the initial game menus
31747
170
Draw decorative screen border graphics
31917
372
Draw game screen decorative border (colours)
32289
260
Draw the inner border for the intro sequence
32549
276
Draw the intro sequence landscape
32825
104
Menu 1: Print control options
32929
32
Menu 1: Scan keyboard input for control option selection
32961
60
Menu 1: Highlight/store selected control option (1-4)
33021
30
Menu 1: Check if ENTER pressed to confirm player controls
33051
18
Menu 2: Print the menu
33069
46
Menu 2: Check for ENTER or LOAD keys being pressed
33115
30
Clear the menu screen
33145
65
Menu text PRINT routine
33267
52
Drawing routine (decorative border and intro sequence background)
33319
56
Drawing routine used for intro sequence graphics
48922
25
Initialize game
48947
45
Load saved game
48992
61
Start game
49053
162
New game initialization - set up game data
49215
59
Run new game intro sequence
49274
31
Intro sequence lightning - flashing & sound effects
49305
10
Intro sequence - move Maroc's sprite down one pixel
49315
30
Maroc out of energy - clear scroll, calculate & print rank
49345
70
Place/replace Maroc in the start room
49415
83
Reset various room-based game data ready for a new room
49498
102
Room initialization - identify room data set and scenery style, reset room/viewport position
49600
32
Set up LEFT vertical wall/floor connector graphics
49632
47
Set up room background scenery - part 1
49679
86
Set up room background scenery - part 2
49765
43
Check for and set up back wall brickwork/rock scenery
49808
50
Set up room floor-wall connector graphics
49858
54
Calculate horizontal/vertical room co-ordinates for each room section/components
49912
53
Set up RIGHT vertical wall/floor connector graphics
49965
28
Check room item data sets to see if any doors need setting up
49993
225
New room - door setup
50218
54
Identify room's interactable objects
50272
161
Set up the room's creatures
50433
112
Set up room foreground scenery objects - part 1
50545
68
Adjust room element co-ordinates based on Maroc's room entry point
50613
50
Tunnel room - identify the connecting door set
50663
49
Set up tunnel
50712
35
Start of tunnel data setup
50747
60
Calculate and set current room attribute colours
50807
45
Identify and set up level name for printing on scroll
50870
162
Start of game cycle - control checks
51032
11
Pause game routine - check if 'pause' key pressed
51043
55
Pause game routine - play tune and check user input
51098
43
Pause game routine - save the current game
51141
11
Pause game routine - check if 'resume game' key is pressed
51152
26
Start of main game loop
51178
77
Copy current room item data set into working buffer
51255
104
Adjust room item's position based on the speed and direction of Maroc and the item
51359
61
Deal with and check room item, creature or scenery
51420
131
Determine if creatures will enter the current room
51551
60
Check which creatures are entering the room
51611
91
Check for an on-screen door being opened or closed
51702
111
Check if Maroc is moving through an open doorway
51813
41
Maroc is moving through a doorway
51854
38
Trigger door opening or closing
51892
76
Door opening or closing
51968
76
Set up 'interactable' objects in current room
52044
15
Servant has dropped a held item
52059
59
Handle interactable objects that are falling/flying
52118
18
Check if servant has moved away from Maroc after retrieving an item
52136
127
Determine movement of room items/creatures that move around the screen
52263
75
Check and change object state after positive events match/collision
52338
54
Check if Maroc has picked up (or been given) a spell or item
52392
53
Maroc has picked up a spell
52445
68
Maroc has picked up an item
52513
69
Check for an object trade with warlock
52582
34
Check for servant picking up an object
52616
79
Deal with creature in room - create footstep sounds and check for missile collisions
52695
154
Change creature behaviour based on Maroc's magic
52849
64
Maroc is trading items with a warlock
52913
35
Maroc has offered an object of insufficient value to a warlock
52948
55
Decide whether a warlock will fire a missile/bolt at Maroc
53003
51
UNSEEN spell effect on creature movement
53054
26
Goblin warrior - check if movement is affected by Maroc's magic power
53080
65
Initialize missile/bolt fired by a creature
53145
128
Warlock or creature - materialization & disintegration events
53273
50
Warlock - drop carried object
53323
26
Creature collision check with room boundary and Maroc
53349
23
Creature has collided with Maroc
53372
31
Maroc has destroyed a creature - initialise disintegration
53403
81
Missile fired by Maroc or a creature - check for active shield/barrier spells
53484
42
Creature's missile has hit Maroc's shield/barrier
53526
24
Check if a missile fired by a creature has hit Maroc, and if so reduce his energy
53550
51
Check missile room boundary collisions and on-screen lifespan
53601
24
Copy co-ordinates of room's left/right wall connector sections to working buffer
53625
89
Tunnel position & direction
53714
45
Check tunnel item type for collision checks and movement (boundary, bats and spiders)
53759
28
BAT movement in tunnel section
53787
32
Tunnel item (boundary or bat/spider) has gone off-screen - reduce on-screen item count
53819
51
Tunnels - check if Maroc has hit a left/right boundary wall
53870
15
Start of setting up room routine
53885
168
Drawing checks and routines for all on-screen room items
54053
12
Start of setting up room routine - part 2
54065
55
Flash the 'MAGIC' text in the bottom left (if Maroc has picked up a spell) and trigger sound effect
54120
222
Determine Maroc's sprite graphic position, height and direction
54342
51
Draw Maroc's sprite graphic
54393
36
Check if Maroc is on a room element/item that drains or restores his energy
54429
21
Check if Maroc has gone through the portal in room 81
54450
74
Draw Maroc's shadow and flickering barrier for SHIELD, PROTECT and DEFENCE spells
54524
216
Move and draw the room's foreground scenery items
54740
42
Re-calculate room event table data sets
54782
60
Prepare data for any creatures that are entering Maroc's room
54842
23
Gradual energy drain/restore for Maroc's ongoing effect spells
54865
42
Determine whether a warlock should materialize in the room
54907
41
Prepare a warlock to appear in the room
54948
12
Generate a DEMON in the room in the High Temple of Chaos
54960
23
Initialize the appearance of a warlock or a demon
54983
11
Copy creature, demon or warlock data to room data sets
54994
74
Tunnel section - Generate and prepare tunnel items
55068
20
Tunnel section - Run game timer and randomly generate creatures
55088
100
Tunnel section - Generate a SPIDER or BAT encounter
55188
95
Check for any fired missiles/bolts
55283
64
Check which spell has been cast
55347
127
SERVANT spell - check for retrieval of object from Maroc's backpack
55474
28
Set up active spell-based room event checks
55502
51
HAIL, WAYSTONE, FREEZE, SUMMON or PORTAL spell cast
55553
11
Check/decrement the FREEZE spell timer counter if active
55564
52
Check if Maroc is carrying too many objects
55616
12
Check if Maroc is out of energy
55628
190
Deal with room items when Maroc leaves the room
55818
67
Maroc's room number has changed - identify new room number
55885
59
Maroc is out of energy
55944
64
Game completion - Maroc has destroyed Avelach, Lord of Chaos
56008
20
Object - vertical room position check/adjustment
56028
18
Fetch object state and prepare graphics for printing
56070
25
Generate pseudo-random number using ROM address values
56095
121
Set up missile data and calculate trajectory
56216
93
Draw/erase graphics - screen boundary checks
56309
76
Draw/erase graphics - calculate screen display address position
56385
11
Draw/erase graphics - erase graphic bytes
56396
7
Draw/erase graphics - draw graphic bytes
56403
36
Draw/erase graphics - re-calculate screen display address 1 pixel line down
56439
18
Draw/erase graphics - graphic tile out of bounds
56457
76
Draw/erase graphics - graphic partly out of bounds - RIGHT border of play area
56533
79
Draw/erase graphics - graphic partly out of bounds - LEFT border of play area
56612
56
Draw the spell pointer arrow, spell charge icons and energy bar on the scroll
56668
34
Print the active spell's message text
56702
35
Set length of Maroc's energy bar based on his current energy level
56737
171
Draw/erase foreground scenery items
56908
51
Identify objects for current room
56959
56
Identify state of object in current room
57015
66
Create data set for interactable room object and copy item/graphic data into it
57081
58
Clear the scroll status panel at the bottom of the screen
57139
137
Print spell names on the scroll
57276
17
Calculate servant/icon cursor graphic horizontal/vertical direction & speed
57293
108
Check for events/collisions
57401
119
Check if Maroc or room item is within room boundaries
57520
18
Copy room item data from item buffer to room data sets
57538
51
Setup game graphics
57589
117
Create flipped/mirrored version of a particular graphic
57706
109
Set up data for creature/warlock appearing in Maroc's room
57815
48
Play (generic) sound effect
57863
25
Set screen colour for current room
57888
59
Set attribute colours for Maroc
57947
43
Clear the playing area (pixels)
57990
42
Collision check between creature missile and Maroc's shielding barrier
58032
32
Copy room item event data into working buffer
58064
42
Set up message text on scroll to print
58106
60
Character/text printing
58166
150
Handle creature/graphic animation
58316
49
Increase/decrease Maroc's energy and play short beep sound
58365
111
Print screen colours for room object/creature
58476
123
Animation routine for when Maroc is out of energy
58599
165
Calculate and print Maroc's rank
58764
25
Clear the spell message text area on the scroll
58789
17
Identify address of message text
58806
72
Play music
58878
18
Generate sound effect when Maroc picks up a scroll/spell/item
58896
49
Intro sequence - toggle sky colour between blue/yellow
58945
88
Main loop - handle spell menu and keyboard/joystick inputs
59033
97
UP/DOWN controls pressed while in spell menu
59130
89
Draw active spell charges and icon on scroll
59219
43
Write active spell message on scroll and draw energy bar
59262
36
Check for UP/DOWN and FIRE control presses after a spell is selected
59298
32
Player has cast a spell
59330
43
Print name of ongoing effect spell in small scroll in bottom right of screen
59373
16
Set FLASHing attributes for the spell icon in the top right of the scroll
59389
85
Check which spell is being cast
59474
14
Check horizontal movement direction & speed (MOVE spell)
59488
32
Increase Maroc's horizonal movement speed
59520
21
Decrease Maroc's horizontal movement speed
59541
11
Check vertical movement direction & speed (MOVE spell)
59552
32
Increase Maroc's vertical movement speed
59584
21
Decrease Maroc's vertical movement speed
59605
25
Set Maroc's speed to zero if FIRE pressed while he is moving
59630
59
MOVE spell continued - set viewport scenery speed/movement based on Maroc's
59689
47
Player has cast a spell requiring a controllable cursor (e.g. SERVANT, MISSILE, OPEN)
59736
47
Calculate change to servant/cursor icon horizontal screen position
59783
86
Calculate change to servant/cursor icon vertical screen position
59869
64
Check if FIRE pressed when servant or controllable spell cursor is on screen
59933
23
Spell selected that is the same as the active 'effect' spell (e.g. SHIELD, UNSEEN)
59956
109
Deactivate the currently active effect spell
61946
28
Code sheet - get the code that the player needs to enter
61982
66
Code sheet - hash/randomize the security code co-ordinates required for input
62056
12
Code sheet - print code message/character on screen
62068
21
Code sheet - pick a reference co-ordinate for the code that the player has to enter
62089
13
Code sheet - generate 3 random bytes using the FRAMES timer system variable
62102
99
Code sheet - initialize and print security code to enter
62201
82
Code sheet - set up and evaluate player code input
62283
5
Code sheet - set random number seed to generate the random code location address
62288
73
Code sheet - code entry count and validation
65000
60
Unencrypt all LOADed game data