6 September to 10 September 2025
Here's my disassembly diary for this part of my project to document The Sentinel on the BBC Micro. You can click on the following links to jump to a specific day in the diary:
- 6 September 2025 - Identify maths lookup tables using Excel, convert them from data blocks into FOR loops, convert some of the calculated labels into Lxxxx labels
- 7 September 2025 - Document the Entry routine (the first documented routine!)
- 9 September 2025 - Document ConfigureMachine and ClearMemory, identify main title loop, start trying to identify subroutines called by main title loop (e.g. SetColourPalette, ResetVariables, DrawTitleScreen, DrawObject, SpawnCharacter3D, SpawnSecretCode3D), realise that some code is the same as in Revs (Multiply8x8, GetAngleInRadians) so copy comments over
- 10 September 2025 - Identify more Revs routines (GetRotationMatrix, Multiply8x16, Multiply16x16) and copy comments from Revs, reach 5% progress, identify and document more Revs code (Absolute16Bit, Negate16Bit, ScanKeyboard, parts of Divide16x16), add arctan and sin labels
Please note that this diary is a dump of my thoughts as I disassembled and documented The Sentinel, and as such it contains lots of mistakes and dead ends and misinterpretations. This diary is all about the journey, rather than the destination; for the latter, see the finished product.
6 September 2025
================
See all the GitHub commits and diffs for 6 September 2025.
Let's start by looking for maths lookup tables, as they are normally pretty easy to spot.
Good candidates are L3B00, L3D00 and L5980, as they gradually increase as the table goes on, a classic sign of a trigonometric lookup table.
Stick them in Excel as sentinel_table_lookups.xlsx, draw some graphs and see if anything looks familiar...
L5980 is clearly sine, it's pretty similar to the sine table from Aviator.
L3C00 looks like arctan, but stepped, but it makes sense if L3B00 is the low byte and the high byte starts at L3C01.
L3D00 also seems to start at L3D02, but it's harder to calculate, poking around in Excel has revealed two options, one with cos and sin and another with tan, but I have no idea what's going on as neither of them look particularly useful (put both options into the source, let's deal with this one later!).
Convert all these tables into FOR loops to create calculable tables.
Remove the need for the likes of:
.L3E00 L3E3C = L3E00+60 L3EC0 = L3E00+192
by inserting labels when they make sense.
7 September 2025
================
See all the GitHub commits and diffs for 7 September 2025.
Only got 15 mins today, but it's an important 15 mins.
And we're off! Entry becomes the first subroutine to be documented - every long journey starts with a single step...
9 September 2025
================
See all the GitHub commits and diffs for 9 September 2025.
Continuing from Entry through ConfigureMachine and ClearMemory.
Today I learned about the addressable latch in the System VIA (used to set the screen memory address).
Then into what looks like a main game loop, which contains a lot of JSRs within a loop.
Call it MainLoop, start to analyse what the JSRs might do by setting breakpoints.
First one is SetColourPalette, pretty simple VDU stuff.
Next one zeroes a load of memory blocks, so call it ResetVariables.
Next one draws the title screen, but if we simply run it the screen stays blue, so change the palette to the visible colour scheme (by changing the SetColourPalette from A=4 to A=0) and we can see it actually drawing the screen.
Can then dive into the DrawTitleScreen routine, which draws the title text and the Sentinel on the right.
The routine takes an argument in A that's 0 or &80; changing this either draws the title screen with The Sentinel, or it draws the landscape code screen with a robot.
Title text is in a variable that's passed to sub_C31CE that draws the letter, so name that routine DrawLetter3D.
The Sentinel or robot is drawn by a call to sub_C139B, so call this DrawObject for now.
The landscape code is drawn by sub_C3381, so call this DrawLandscapeCode.
SPOTTED WHILE EXPLORING:
Turns out that sub_C0D03 is the same as Multiply8x8 in Revs, so that's a quick win.
And sub_C0F3E is GetAngleInRadians from Revs.
10 September 2025
=================
See all the GitHub commits and diffs for 10 September 2025.
Turns out there are more Revs subroutines in The Sentinel, so copy over the Revs comments for some quick wins:
- sub_C0E75 is the same as GetRotationMatrix in Revs
- sub_C0F4A is Multiply8x16 in Revs
- sub_C0F9E is Multiply16x16 in Revs
>>> I have now broken through the 5% barrier <<<
More Revs code:
- sub_C1007 is Absolute16Bit in Revs
- sub_C1009 is Negate16Bit in Revs
- sub_C0F62 is almost ScanKeyboard in Revs
Also sub_C0D4A seems to contain chunks of the Divide16x16 routine from Revs, so copy that over.