Wednesday, 10 February 2016

Not my bug!

I've finally squashed a long-standing bug in the game play of my C port that resulted in the player dropping through the floor and wrapping around to the top of the screen indefinitely. It was most easily reproduced by jumping on a collapsing block (eg. room #230) but I had seen it on other occasions in the past.

The kicker is, the bug is in the original ZX Spectrum Z80 code!

Not much point going into detail but, in a nutshell, the code was de-referencing a pointer that was NULL in certain circumstances, but the code never expected it to be so, and hence never checked it. Given the code in question handles two quite different object types, it's likely the programmers simply called the prior routine for the 2nd object thinking it was sufficient.

The end result of the bug is that, on the ZX Spectrum, it writes a zero to location zero, which happens to be ROM and therefore benign. I've actually verified this is the case using the MESS debugger.

I also suspect it's also the case with the MSX port, and is certainly the case on my TRS-80 port.

So my C port must of course check for a 'NULL POINTER' in this routine. It's slightly more involved than that, but that's the gist of it.

Hopefully that's the last of the bugs in the C port, though I'm still yet to play through a complete game. I will release an update of the Amiga port and perhaps someone else can beta-test it for me!

P.S. The Amiga port got a mention on!

No comments:

Post a Comment