Friday, 2 February 2018

Well that escalated


The bug is dead, all hail Brian, destroyer of bugs, puller of hair, screamer of screams and smasher of keyboards. Let this day be remembered for all eternity, the bug is dead.


What a total fucker...I mean really, months I've been plagued by this, then it would vanish, then come back, then vanish...I just couldn't get any grasp of what and why it was happening

It was random, no specific routine seemed to cause it, my sprites just vanished, nothing I could do would explain it, code still worked but sprites vanished, stepping through the code showed nothing, moving things around showed nothing, altering data seemed to work, but then it would come back.

Months...I'd leave it, come back to it, leave it, spend a week on it, spend an hour on it, rewrite dozens of apparently working parts, alter data systems, redo everything, apart from the cause of course.

And finally after squeezing a bit of code to let me display some values while the game was running I was able to locate the value that was not as it should be (though it was fine on the emlator)

And it turned out to be a clearing of a flag/location value in an interrupt, which the main code also used to set some things up, normally the interrupt would be done loooong before the code needed it, but if the interrupt happened after the code tested for the value, it would never be reset...and lo...the sprites would vanish

The frequency would be erratic, but once cleared after that test, it would never be reset again.

As the code, grew, shrunk, changed did more or less things, the threshold for when the the test occurred would be later and boom, sprites would vanish for no earthly reason...

It never happened on the emulator/debugger because it handles its interrupts slightly differently, and the test was always after the interrupt. Changing data formats had an impact, but only because it altered timing, so so erratic.

shit...months..really maybe a year on and off, it stopped me dead in my tracks many times....Without a doubt the worst bug I have ever had in 30+ years of coding...I have been mystified.

I can finally clean up the Colecovision game and get it finished and delivered, my poor client has been so patient. He'll finally get his game now.

Ahthankyew

No comments: