andwn / marsdev

Cross platform Mega Drive / 32X toolchain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

32x-skeleton freezes at the start in Gens

Dasutin opened this issue · comments

Building the 32X-skeleton, or any 32X project built off of the current release (2021.04) and running it in Gens results in the ROM freezing at the start. Any other emulator, like BizHawk or RetroArch, works. Running it on real hardware works.

I can not replicate this issue with the 2020.01 release in Gens.

Wonder if it has to do with GCC 9 vs 10. I can't get GCC 11 to even compile for SH-2 and have held off upgrading because of it. Will have to compare when I have some time later.
Edit: typo

I was doing some testing and narrowed down where the problem is coming from. I reverted all changes to m68k_crt1.s. Removed the added linker file md_crt1.ld.

Last I modified the Makefile to remove the changes and add back the old

- m68k_crt0.bin: m68k_crt0.s
-	$(MDAS) $(MDASFLAGS) $< -o $@.o
-	$(MDLD) $(MDLDFLAGS) --oformat=binary $@.o -o $@

- m68k_crt1.bin: m68k_crt1.s $(MDOBJS)
-	$(MDAS) $(MDASFLAGS) m68k_crt1.s -o m68k_crt1.o
-	$(MDLD) -nostdlib -T md_crt1.ld --oformat=binary m68k_crt1.o $(MDOBJS) -o m68k_crt1.bin

+ m68k_crt%.bin: m68k_crt%.s
+	$(MDAS) $(MDASFLAGS) $< -o $@.o
+	$(MDLD) -nostdlib --oformat=binary $@.o -o $@

Making the changes allowed my project to work in Gens. I also make the same changes to the 32x-skeleton example code and it works too.

I also noticed parts of my project where I was printing some text from the Genesis was causing the ROM to freeze on real hardware. I'm not doing it everywhere on my ROM so I didn't catch it before. It works in emulation (except Gens) but was causing some glitching on the top left of the screen. After making those changes, printing text from the Genesis isn't freezing on real hardware, and the glitching on the top left of the screen is gone (Gens works).

Hope this helps narrow the problem down.

I did that so C code could be run both on SH and M68000 CPUs (the code would be copied into and run from RAM), but guess it's still wonky. Maybe it would be best to revert it for now and try again when I'm in the mood to experiment with 32X again. Or better yet stick to assembly on m68k 😝