Jump to content
IGNORED

Strange Stella Issue in Developer Mode


Karl G

Recommended Posts

I've noticed a strange issue with my unreleased game (Penult) where it will crash about 1/4 of the time when developer settings are enabled, specifically when SP is randomized. If SP is not randomized, then it never happens, and none of the other developer settings seem to affect this one way or another.

 

What is strange about it is that I use the CLEAN_START macro almost immediately upon start, which should set this to $FF, so a random SP shouldn't make a difference. It still happens when I changed it to do CLEAN_START as the first operation, and also when I explicitly do a LDX #$FF followed by TXS even before the CLEAN_START macro.

 

I've only noticed this happening since I've gotten my new laptop, and I can reproduce it with Stella 6.6 and 6.7 under Linux. I never noticed it when using my now-dead MacBook, and I don't recall what version of Stella I had installed there.

 

Anyway, it seems to happen also with the public demo of the game found here. This is a 128K DFSC ROM. Any ideas as to what might be going on?

Link to comment
Share on other sites

4 hours ago, Thomas Jentzsch said:

The code uses the stack pointer before it is in initialized. And when the SP points below $80, the game will crash.

 

Lffb8
    pha                           
    tya                           
    pha                         
    lda     Lffc0,x             
    rts                         

 

Thank you. That does make sense, but I'm not sure how I should avoid that? This is my bankswitching code that gets triggered if the game gets started in any bank other than the desired startup bank. I'm pretty sure I got this method from a template. Do you have any suggestions on how to better handle this? Do I just need to expand my startup code in every bank to set the SP first thing before doing my bank switch? It's strange that I didn't run into this issue previously. 

Link to comment
Share on other sites

13 minutes ago, Karl G said:

Do you have any suggestions on how to better handle this? Do I just need to expand my startup code in every bank to set the SP first thing before doing my bank switch?

Either use a different template which avoids the stack (e.g. using jmp.ind instead) or set the SP to a valid value before using the current one.

13 minutes ago, Karl G said:

It's strange that I didn't run into this issue previously. 

Did you always use developer settings?

  • Thanks 1
Link to comment
Share on other sites

29 minutes ago, Thomas Jentzsch said:

Did you always use developer settings?

Yes. And they have helped me ferret out many other issues in my code. That's what's strange about it. Maybe I accidentally had "randomize SP" unchecked, though. 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...