Thomas Jentzsch Posted October 16, 2023 Author Share Posted October 16, 2023 If you add a JMP after entering the bank, does that fix it? Quote Link to comment Share on other sites More sharing options...
vdub_bobby Posted October 16, 2023 Share Posted October 16, 2023 (edited) I have JMP (addr) immediately after entering the bank already. EDIT: Also added a JMP *+3 at my Start vector. Didn't seem to help. Edited October 16, 2023 by vdub_bobby Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted October 16, 2023 Author Share Posted October 16, 2023 9 minutes ago, vdub_bobby said: I have JMP (addr) immediately after entering the bank already. EDIT: Also added a JMP *+3 at my Start vector. Didn't seem to help. And the start vector does not point to 3xxx? Quote Link to comment Share on other sites More sharing options...
vdub_bobby Posted October 16, 2023 Share Posted October 16, 2023 (edited) Here's bank 1 (ORG/RORG to $1000): Here's bank 2 (ORG/RORG to $2000/$3000): EDIT: Ahh hmm. I changed my bankswitch code to a simpler method and seemed to fix it. Edited October 16, 2023 by vdub_bobby Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted October 16, 2023 Author Share Posted October 16, 2023 Looks OK so far, I suppose I need more code to help. Quote Link to comment Share on other sites More sharing options...
vdub_bobby Posted October 16, 2023 Share Posted October 16, 2023 So, I've got this overkill bank switching code that looks like this: I'm using the BRK vector to switch banks. Since I only have two banks, using the top 3 bits of the address to dynamically switch banks is overkill, so I replaced the indexed write (NOP $1FF8,X) with a static write (NOP $1FF8). That fixed it in Stella. If I switch that last one there back it breaks. I've attached the code. What's weird is that this all was working no problem until I moved a big chunk of code (the kernel) and corresponding gfx data from bank 1 to bank 2. TankMaze.asm Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted October 16, 2023 Author Share Posted October 16, 2023 (edited) Hm..., which version of Stella are you using? It looks fine on my side. Edited October 16, 2023 by Thomas Jentzsch Quote Link to comment Share on other sites More sharing options...
vdub_bobby Posted October 16, 2023 Share Posted October 16, 2023 (edited) Using 6.6 The version I posted above does work, it's if I replace all the NOP $1FF8 and NOP $1FF9 with NOP $1FF8,X it doesn't work. I'll post an updated, non-working version in a sec. EDIT: This will break when it tries to jump to a non-code location, but if you start it in the debugger you can see that is is RORGing both banks to $3000 and then - EDIT EDIT: I see I am a version behind (current is 6.7). I'll download that and give it a try. EDIT EDIT EDIT: Saw same behavior in Stella 6.7 TankMaze.asm Edited October 16, 2023 by vdub_bobby Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted October 17, 2023 Author Share Posted October 17, 2023 There is some weirdness going on. E.g. 100e 20 60 11 jsr InitialSetupSubroutine So clearly a subroutine in $1xxx. However, in Stella I see: As if the high byte of the address has been changed. And this only happens in Stella, and only after disassembling the code. The problem is, that the disassembler is based on the old DiStella code, which was only meant for 4K. Over the years, I have tried to add better multibank support, but the code base has its limits and has become fragile too. Until 6.4. the code did not do that, since 6.5 it does. That code is overdue for a major rewrite. 2 Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted October 17, 2023 Author Share Posted October 17, 2023 A quick fix is to change the start vector in bank 1. Currently it points to $3000, if you change that to $1000, it works. Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted October 17, 2023 Author Share Posted October 17, 2023 After further thinking about this, I think we got irritated by Stella's debugger. The problem is this: The game starts in bank 1, with PC = $3xxx. First it switches to bank 0 (which skips JMP *+3), PC is still $3xxx. Then it executes no code which could correct the PC to $1xxx (no JMPs) before it hits the first BRK. Which means the return address points to $3xxx. And then the return from bank 1 fails. So if you add a jump before the 1st break (or change the start vector in the 2nd bank), the problem is fixed. Quote Link to comment Share on other sites More sharing options...
vdub_bobby Posted October 17, 2023 Share Posted October 17, 2023 Oh, interesting. Thanks! 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.