Dan Piponi Posted January 26, 2018 Share Posted January 26, 2018 In Haunted House I see this bit of code being executed (in both Stella and my own emulator): F44E INY F44F SBC $0F F451 BCS F44E That SBC is reading from address $0F. This is in TIA, but there is no readable register there. So what does this read? My own emulator returns zero and so the code hangs. But Stella seems to not hang. When I read the Stella source it looks like this returns (depending on settings) something randomised or what was left on the data bus from before (though I don't fully understand how something can linger on the data bus). As the last thing on the bus was (I think) the $0F of the SBC instruction, it ends up subtracting $0F. That seems pretty weird. Anyone know what's going on here? Im the end I hard-coded a read from $0F to return $0F in my emulator and now I can play Haunted House in it. -- Dan Quote Link to comment Share on other sites More sharing options...
+nanochess Posted January 26, 2018 Share Posted January 26, 2018 Interesting but yes the effect is substracting 15 from A register. If you follow the code you'll see the result is used in a classic horizontal positioning routine for TIA display objects. Most probable thing is that as TIA doesn't respond to reads in this direction, so the bus keeps the $0F floating in data bus (from last byte read of instruction) and it uses it to substract 15. Quote Link to comment Share on other sites More sharing options...
Dan Piponi Posted January 26, 2018 Author Share Posted January 26, 2018 Do you think it was a bug? Intended to be "SBC #$15" but it worked anyway so nobody noticed. Quote Link to comment Share on other sites More sharing options...
ZackAttack Posted January 26, 2018 Share Posted January 26, 2018 That would be my guess. It's such a common mistake and often doesn't cause any noticeable failures. It'd be interesting to see what would happen if you add a pull-up resistor to D7 and run it on real hardware. Quote Link to comment Share on other sites More sharing options...
alex_79 Posted January 26, 2018 Share Posted January 26, 2018 (edited) Yes, usually games with that bug work fine on almost all consoles (that's why it's often overlooked), but there are a few cases where they fail: https://atariage.com/forums/topic/242783-haunted-house-glitch-on-7800/ Edited January 26, 2018 by alex_79 Quote Link to comment Share on other sites More sharing options...
+stephena Posted January 26, 2018 Share Posted January 26, 2018 If you use "Drive unused pins randomly" in Stella, you can see that sometime the ROM starts up correctly, and sometimes there are weird graphical effects and you can't play the game at all. So there's definitely some 'bad' code in the ROM. Quote Link to comment Share on other sites More sharing options...
+nanochess Posted January 26, 2018 Share Posted January 26, 2018 Do you think it was a bug? Intended to be "SBC #$15" but it worked anyway so nobody noticed. Probably it's a bug. It's easy to miss the # it happened to my several times but with other code and the bugs are really hard to pinpoint Quote Link to comment Share on other sites More sharing options...
+stephena Posted January 26, 2018 Share Posted January 26, 2018 Probably it's a bug. It's easy to miss the # it happened to my several times but with other code and the bugs are really hard to pinpoint We plan at some point to add checks for common problems like this to the Stella disassembler, so programmers can see common, but hard-to-find errors. Quote Link to comment Share on other sites More sharing options...
+nanochess Posted January 26, 2018 Share Posted January 26, 2018 We plan at some point to add checks for common problems like this to the Stella disassembler, so programmers can see common, but hard-to-find errors. That's a pretty good idea any chance it could handle bank switched labels? Or a tab to see each bank disassembly? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.