Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when exiting to winning cutscene #225

Closed
kieranhj opened this issue Mar 31, 2018 · 3 comments
Closed

Crash when exiting to winning cutscene #225

kieranhj opened this issue Mar 31, 2018 · 3 comments
Labels

Comments

@kieranhj
Copy link
Owner

Reported by Diminished on Stardot.

Stack looks very suspiciously like an infinite loop:

01d0 21 8e 22 dc 21 44 21 8e !.".!D!.
01d8 22 dc 21 44 21 8e 22 dc ".!D!.".
01e0 21 44 21 8e 22 dc 21 44 !D!.".!D

&21DC is the return address from JSR DoKid in NextFrame in topctrl.asm
&228E is the return address from JSR ctrlplayer in DoKid in topctrl.asm
&2144 is the return address from JSR NextFrame in MainLoop in topctrl.asm !!

This would suggest that ctrlplayer never returned by probably hit a BRK causing the error handler to be called. But the only reason it would go back into the MainLoop is if it thought we were trying to save the game (to recover from write protect errors.) Weird.

@kieranhj kieranhj added the bug label Mar 31, 2018
@kieranhj
Copy link
Owner Author

I noticed that when I was fighting Jaffar on level 12b, during the short musical sting that plays when he appears, the game slowed down a lot for the duration of the music. I died during the fight a few times, and once this slowdown started happening it occurred every time I fought him. The finger may therefore point at the music decompression codec, but I don't know.

I beat him eventually and the game let me exit the level and loaded the epilogue, and then it crashed when I ran through the door that triggers the ending cinematic.

@kieranhj
Copy link
Owner Author

Looking at the bottom of the stack:
0128 48 18 5b 18 df 28 04 a7 H.[..(..
This is the call to beeb_load_audio_bank which goes into disksys and eventually calls OSFILE. Stepping through the MOS call in b-em the stack can get at least &2E deeper than entry so would overflow in this case (and presumably the load fails.)

Problem must be higher up with the looping entry to MainLoop...

@kieranhj
Copy link
Owner Author

kieranhj commented Apr 1, 2018

Stack overflow issue now fixed with stack reset in RESTART.

@kieranhj kieranhj closed this as completed Apr 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant