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

The Sega genesis game: Joe and Mac Caveman Ninja crashing on the title screen #144

Open
TomateThree opened this issue Dec 20, 2024 · 2 comments
Labels
bug Something isn't working fixed-next-release Fixed on master, will go into next release md Genesis / Mega Drive

Comments

@TomateThree
Copy link

The game crashes on the title screen, in add files i gonna show a screen shot of the momment when this ocurrs.
https://github.com/user-attachments/assets/cad8a742-209e-4f89-a9fc-2d4c3b5a1323

@jsgroth jsgroth added bug Something isn't working md Genesis / Mega Drive labels Dec 20, 2024
@jsgroth
Copy link
Owner

jsgroth commented Dec 21, 2024

I see why it's crashing but I'm going to have to dig in more to figure out the root cause. Seems like possibly a Z80 CPU bug.

Right before the crash, the Z80 executes a RET that jumps to a non-code address, and after executing some nonsense instructions it executes a HALT with interrupts disabled. The 68000 then gets into an infinite loop waiting for the Z80 to set a flag in audio RAM, which never happens because the Z80 is no longer running.

jsgroth added a commit that referenced this issue Dec 21, 2024
…r resetting (#144)

this fixes freezing in Joe & Mac, which seems to depend on ignoring 68000 writes to audio RAM while the Z80 is on the bus
@jsgroth
Copy link
Owner

jsgroth commented Dec 21, 2024

I think I figured this out. It wasn't a Z80 bug - this game seems to depend on the 68000 not being allowed to write to Z80 audio RAM unless the Z80 is running (i.e. not reset) and removed from the bus.

While the game is booting, the 68000 performs some stray writes to audio RAM without removing the Z80 from the bus, and the game depends on those writes being ignored. Otherwise the writes will corrupt the game's audio driver code which eventually causes the Z80 to halt and the game to crash. I'm surprised this never caused problems in anything else I tested...

This will be fixed in the next release, thanks for reporting this!

@jsgroth jsgroth added the fixed-next-release Fixed on master, will go into next release label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed-next-release Fixed on master, will go into next release md Genesis / Mega Drive
Projects
None yet
Development

No branches or pull requests

2 participants