BuGS Status Update

I found the crashing bug I was experiencing and I believe it is fixed with this build.  And I believe it also explains the other crashes people saw on other configurations.  The problem is that the sprite code is in a different bank from most of the other code.  The player and shot sprites try to write to a pair of words to describe a collision if any is found during the draw.  These were defined to be in the same bank as the sprite code but the data bank register was incorrect.  So the writes happened to the wrong bank and what happened to be there got corrupted whenever a player or shot was drawn.  On my machine, that was tileBelow data.  I have fixed the writes so they happen to the correct address and I can no longer reproduce the crash and the code looks right to me.  So, this build should be better.  Thanks for everyone’s help.

The wrong bank was leading to the flea smearing across the screen.  What was happening for me was the the tileBelow array was getting corrupted.  The flea animation uses tileBelow to figure out what tiles need to be marked dirty and need to be redrawn based on the flea’s changing position.  Because tileBelow was corrupted, the wrong tiles ended up being marked dirty.  That meant that the flea was not being erased anymore between frames so it smeared down the screen.  Worse, the flea detects it has reached the bottom of the screen when the tileBelow says that it is an invalid tile offset.  Because the tiles that the flea is tracking are no longer correct, it doesn’t detect the bottom of the screen and the flea continues animating beyond the bottom of the screen, corrupting the SCB.  Basically @digarok nailed it when he said that there was off-screen writes happening.  I just needed to figure out why that was happening because the flea code should make it impossible, as long as the tileBelow data was correct, which it wasn’t.

Source Code

Changes

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.