Encoding of program code
Avalon's entire game code, as saved on the cassette tape, is encrypted.
Once the data is loaded from tape, the whole game code & data (39000 bytes, starting from 61A9) is put through a short unencryption algorithm, in the routine at FDFF.
The encryption and code sheet were added by Steve Marsden (link to games list at Spectrum Computing)
Graphics data
Avalon's graphics are stored from 994F and referenced from an address table at 97C3.
Graphics consist a number of 1 character wide tiles - graphic pieces that make up the full graphic 'jigsaw'. To save memory, the tile pieces are trimmed to only contain the graphic bytes necessary; there are no leading or trailing 'empty bytes' with zero values.
Stored with each tile is a number that tells us how many bytes there are in the tile. Also stored are two pixel offset bytes (X/Y) indicating where to position the tile in relation to the graphic's central pixel X/Y co-ordinates.
For example, Maroc's X,Y central pixel position for frame 1 is somewhere in the middle of the sprite:
Maroc graphic centre co-ordinates position
The first tile graphic is 16 bytes and consists of Maroc's hat and eyes (9950).
TEST-UDG-85
The offset co-ordinates stored with this tile are 253 and 231 which indicate pixel offsets of -3 (X) and -25 (Y) respectively.
This tells us that this tile should be positioned 3 pixels to the left of, and 25 pixels above, the overall graphic's central X/Y pixel location.
Maroc concept art - original sketch 1 Maroc concept art - original sketch 2
Maroc original art (taken from mobygames.com) Click an image for a larger version

GRAPHICS MIRRORING
When Maroc enters a room, each room element - background scenery, doors, door frames, connecting walls, creatures and objects - is evaluated, to decide whether it needs a mirrored/flipped version of its graphics.
Bit 5 of the Graphics properties byte holds this information.
mirrored door frame door frame
Some room items will always need mirroring. For example, the left and right vertical floor/wall connectors (see C1C0).
For room creatures, the graphics need mirroring if they have left/right facing directions (e.g. goblin warriors - see A49C), but they won't if they don't (e.g. demons - see A6CE).
Goblin warrior mirrored Goblin warrior
The routine that creates the flipped versions of the graphics is at E0F5. The flipped graphics data is stored from 32851.
This area of memory was originally used for the game menus, and drawing the decorative border, but once the game starts it is overwritten (as the menus and border do not need revisiting).
Graphic properties byte
Each game graphic is preceded by a single byte that holds various graphic item's properties (see A54D for an example).
The makeup of this byte is as follows:
Bit Value
0-3 Number of animation frames for this graphic
4 Unused
5 Graphic has a horizontally mirrored/flipped version
6 Graphic has a left/right facing direction
7 Graphic is animated
Setting the scene(ry)
A standard room contains a few different elements:
There are different versions of each of these elements for the 'brick' styled levels and the 'cavern' style levels.
The first byte of the room's data at 61A9 indicates the size of the room. For the starting room this byte value is 5, and can be used for the position of the room scenery:
how the screen is divided
Each of the right and left sides of the room can contain 2 elements, either a door or a side wall section. Two vertical connectors signify the corners of the room - their position is calculated based on room size.
In the above image, the room is the smallest possible (size = 5) and so the back wall only consists of 1 section. However, some rooms are long, scrolling horizontally across vast hallways. The flexible room data banks at 61A9 allow for a variety of room types and elements.
The room attribute colour is calculated at C63B and is based on the bits in the room number, with a few INK/PAPER combinations avoided.
The foreground scenery objects at C501 for each room are selected using an algorithm using byte values contained in the Spectrum ROM. This saves memory while ensuring consistent foreground scenery for each game. The number of foreground scenery objects is based on the room's size divided by two.

Doors and brickwork

The data at 61A9 - after the first byte holding room size - contains information about where to put DOORS and BRICKWORK patterns in any room, as well as the set number of the connecting door tables at 6790.
Each element is held in a pair of bits of information. These are checked in the routine at C20F. The 2 bits determine whether the item is a door (bit 0 set), brickwork (bit 1 set), or nothing (no bits set).
For example, here's room 6, in the Gatehouse Level:
room number 6
That's two doors, and two bits of brickwork on the back wall.
Here's the data for room 6 at 61CC:
Room size Data 1 Data 2 Door connection 1 Door connection 2 End-of-data flag
8 66 36 6 8 255
8 %01000010 %00100100 6 8 255
The second row of this table is just an alternative representation of the data, with binary values for the 2nd and 3rd bytes.
The first byte indicates room size. In this case it's 8:
Starting from the far left-hand-side of the room, the Data 1 byte:
...That's taken us to the middle of the back wall - half the room in just one byte..!
Using a similar process for the Data 2 byte, we've got %00, %10, %01, %00. This translates to empty-brickwork-door-empty.
Maroc's rank
There are 8 x 16 = 128 possible ranks (7216), from APPRENTICE LORE SEEKER to SUPREME LORE LORD.
Maroc score is increased by killing creatures and descending into lower dungeon levels. His score determines his RANK, which is shown when he runs out of energy, or finishes the game.
Action Points Max points available
Destroying warlocks 4 * warlock number 112
Destroying (any number of) demons 32 32
Destroying any goblin, wraith, or guardian of chaos 0.5 per creature 63
Current dungeon level (C6A4) (1 to 9) * 2 18
MAX TOTAL = 225
This score is halved (= 112) and then added to Maroc's RANK. However, this means that the highest rank Maroc can attain - after destroying every creature in the game - is GUARDIAN OF LORE.
In the routine that determines the score however, there is another calculation; at E4FB three points are gained for every spell collected. There are 27 spells listed at 6DFC. This would allow Maroc to advance an extra (27*3)/2 = 40 ranks.
This is way too many. It'd probably take Maroc's rank way past SUPREME LORE LORD by the end of the game.
Fortunately this doesn't happen because there the score is (perhaps deliberately) reset at E51B after calculating the 'score for spells' points. This means that acquired spells don't affect on Maroc's score/rank after all.
You can remove this score reset with POKE 58651,0, but this will probably result in bugs later in the game as Maroc will be able to advance past the highest rank listed.
** 30/11/2022 - Update note from Steve Turner ** (Twitter link):
"You can reach the highest rank, you need to kill all meanies, do all of the adventure events, trade with the warlords and the destroy them. I did it so there were a few points to spare."
I haven't checked how the rankings are calculated in Dragontorc, but in the generally available version of Avalon (used for this disassembly), the player doesn't gain any points from the puzzles/adventure events (action of one object on another), including trading with the warlocks.
It may be that there was a corrected version of Avalon released since. If so, the code for this version would need checking/disassembling to confirm this.
Maroc's sprite rotational movement
Maroc's sprite has 8-directional movement:
Maroc frame 1Maroc frame 2Maroc frame 3Maroc frame 4 Maroc frame 5Maroc frame 6Maroc frame 7Maroc frame 8
This movement is rotational. When a player presses keys or moves the joystick to move him about, rather than immediately switch his graphics frame to that direction, the sprite smoothly and incrementally rotates clockwise or anti-clockwise towards the new position.
Additionally, Maroc's sprite position above his (fixed) shadow rises and falls depending on his movement speed.
Maroc in a stationary position Maroc moving and hovering
These elements are calculated in the routine at D368. Small enhancements like these reduce jarring sprite movements and help the player work out Maroc's position in relation to the room, doors, objects etc.
Creatures spooked by Maroc's magic
the effect of the FIND spell on goblin movement
Maroc can make creatures apprehensive if he wields powerful magic. For example, the routine at CF3E shows how goblin warriors can be scared of Maroc.
This isn't restricted to offensive spells, it can be any spell with number >=5 in the spell table at 6DFC.
In the example of the goblin warrior this is anything beyond the MISSILE spell, and can include other cursor-based spells, like the FIND spell (as shown in the animated image above).
You can even see this effect (to a lesser degree) by repeatedly casting a spell such as ENERGIZE (the 5th spell in the list). Although the effect is short (as the spell is an instant effect one), you can see a short creature reaction if cast repeatedly.
Unused rooms
In the room data table at 61A9 there's capacity for up to 223 rooms. Rooms 224 - 255 are vertical scrolling tunnels.
It looks as if all these rooms were intended for used as "223 rooms" is mentioned on the Inlay back cover.
However:
However, Maroc can cast WAYSTONE in the final room containing Avelach (room 212) to get to room 213. This is a small doorless room containing a goblin warrior, goblin missile thrower and guardian of chaos:
casting waystone in the final room
Maroc can continue to use WAYSTONE to jump to the consecutive (identical) unused rooms, until he gets to room 223. At this point the waystone check will prevent him moving any further.
After WAYSTONE-ing past the first 5 rooms (room creature data contains 3 creatures), there's no more creature data.
However, as we're still in the High Temple of Chaos, there's now space for a DEMON to materialize instead:
demon in one of the unused rooms
The jump from room 212 can be fixed (if you really want to fix it) with POKE 55514,212
This reduces the WAYSTONE maximum room number check from 223 to 212. Nothing will happen if Maroc casts WAYSTONE in the final room.
** 30/11/2022 - Update note from Steve Turner ** (Twitter link):
"The little rooms at the end were intentional. They were meant to be the demons cells and there to trap the player if he used the waystone to escape."
...If that's the case it's fairly evil on the part of the author, considering how near the end of the game the player is..! In reviews and features I haven't read much about using the WAYSTONE spell to bypass various obstacles, so it doesn't seem to have been a game mechanic picked up much by players.
At least the player can't get trapped in the demon's cells; they're likely to die fairly quickly and get put back in the start room.
Places of healing
There are SIX energy-restoration points scattered around Avalon's levels.
These places let Maroc heal without having to use spells - it helps the player preserve their ENERGIZE spell charges.
Some places are immediately accessible, others have to be activated in some way, or are behind locked doors that will need to be opened.

Gatehouse Level

The first point Maroc will encounter is the star marking on the floor on room 2, next to Maroc's starting location:
healing star on the Gatehouse Level
Maroc activates this floor marking with the STAR symbol (B114). The warlock on the Gatehouse Level carries this.
The quickest way for Maroc to get it is by trading the COINS (B12D) from the chest in room 20 with the warlock.

Caverns of Doom

In the Caverns of Doom there's a patch of mushrooms in room 96, that can restore Maroc's energy:
healing mushrooms in the caverns of doom
The mushrooms work without Maroc having to do anything to them.
There's similar set of mushrooms in the Mines of Madness (room 120) that drain Maroc's energy, so the player may be wary of mushrooms if they've encountered these first.

Mines of Madness

There are no healing points in the Mines of Madness.

Great Halls of the Deep

There are TWO healing places in the Great Halls of the Deep.
There are some flames in room 77. These will heal Maroc if he moves over them:
healing fire in the great halls of the deep
There's an colour-changing orb/energy ball in room 40, behind a locked door.
healing orb in the great halls of the deep
If Maroc casts DISPEL on the BONE in room 38 (three rooms away) to get the flashing key, he can use it to open this door.

Goblin Warren

There are no healing points in the Goblin Warren.
However, Maroc can obtain the CHALICE spell (see Spells - CHALICE spell) on this level in room 150, which is effectively a portable energy point.

The Labyrinth

There's a healing orb under the trapdoor in room 159.
healing orb in the labyrinth
Maroc can open the trapdoor with a yellow key he finds in another trapdoor in the previous room (room 158). This will cause the orb to appear.

Catacombs of the Undead

There's a healing orb in room 190 on this level.
healing orb in the catacombs of the undead
Two rooms away (room 188) there's a similar orb that drains Maroc's energy.

Chambers of Chaos and High Temple of Chaos

There are no healing points on either of these levels.