Wednesday 15 February 2023

Half-way through the MAIN program audit

Slow progress due to Real Life commitments, but progress none-the-less.

I'm now half-way through the MAIN program, working on all the flying object handlers now.

It has become apparent that the few small blocks of random data throughout the dump are simply padding to allow code to be modified/patched within a single device. Obvious now that I've noticed said blocks are right at the end of each device.

One of the remaining known bugs that I've noted in my note book is the observation that Jara morph into Toroids when they change direction. The problem is, I've just finished auditing the Jara handler code and I can't see any way this could happen. I originally suspected a simple transcode bug with the incorrect sprite code being set in the handler routine. It's not that though - in fact the Jara sprites come from a look-up table based off a timer value to animate them - and it's correct.

It's very unlikely that it's data corruption; once a handler is installed the object type in the object table is ignored. It would have to be the handler address being changed every time the Jara change direction, which isn't very likely.

Unfortunately the Jara aren't very common, so some creative patching might be required.

Something for lunchtime today...

UPDATE: Only 10 minutes to fix the Jara bug! Since Jara only appear later in the game, I simply patched the object table for the Toroids to jump to the Jara handler, so they appear immediately. Fortunately the morph bug was readily apparent; on Jara that started out moving to the left, then changed direction to move to the right (though curiously, not on Jara that started out moving right).

A simple transcode bug that went unnoticed during my audit - I was storing the sprite colour of any right-moving Jara in the _CODE offset rather then the _COLOUR offset in the object table.

So that's 3 of 8 down, 5 (known) bugs to go...

UPDATE: Another big fixed! Actually, it was 2 bugs which had the same ultimate effect - the Zakato wouldn't appear before it exploded. There are actually 4 different Zakato variants with slightly different behaviour. On one variant, the delta X value was inadvertantly written into the high byte, so it disappeared off the screen in 1 frame. On another variant, the instruction to set the sprite code was omitted completely.

So now that's 4 down, 4 (known) bugs to go...

No comments:

Post a Comment