MiSTer-devel / NeoGeo_MiSTer

NeoGeo for MiSTer
GNU General Public License v2.0
145 stars 76 forks source link

NeoCD: Double Dragon freezes during loading #183

Closed paulb-nl closed 11 months ago

paulb-nl commented 1 year ago

It will load normally when something else is loaded first.

Normally when loading a PRG file the System ROM will do this:

The problem is this game loads a PRG file with destination $180000 first. This means the System ROM will not write to $110004 for this file but it will still copy $110004 to $000000 when the PRG file is finished.

If nothing has been loaded before this means it will write uninitialized data to $000000 which in our case is all zeros.

The only way I see this can work is if the System ROM switches back to System ROM vectors but it never writes to $3A0003.

sorgelig commented 11 months ago

does it require any non-zero value or specific one?

PepAlacant commented 11 months ago

Hello. I had problems with this game (original disc) and an specific NEOGEO CD console. If I tried to load this game from first bootup of the console, the game freezed at the middle of the first loading. If I load other game before, then Double Dragon, the game start to work. It happened only with an specific console ( top loader ). Other Top loaders I had didn't have problems with this game.

sorgelig commented 11 months ago

So, depending on specific console RAM on power up may or may not get compatible powerup value. It seems a game bug rather than core, but we can try to fix it. May be preload the RAM with some value before disk loading.

paulb-nl commented 11 months ago

Tracked it down to memory address $10F733 which the System ROM uses as the high byte of the DMA destination to copy the vectors from $110004.

It doesn't write to that memory address when loading a PRG file with destination != 0 so the DMA destination will depend on what is in RAM. Currently RAM is cleared to $00 by the Menu core so DMA will overwrite the vectors with garbage and crash.

We need to preload RAM with something like $F0 or $AA so it writes to some unused area. If RAM contains $FF then it will still overwrite the vectors when it overflows from $FFFFFF to $00007FE.

sorgelig commented 11 months ago

I've added ram filling in Main. Looks like fixes this issue.

PepAlacant commented 11 months ago

There were other bugs related to original hardware that were present in certain models... I remember the case of Ninja Combat CD, that had garbled graphics if it was loaded in the first boot up... The magic of SNK ! Maybe different BIOS revisions or the console revisions, that were some, with independent YM2610 and others with the sound chip merged into a custom. NINJA COMBAT CD works perfect in the core.

sorgelig commented 11 months ago

You are free to check if this change fixes other similar issues. Actually i filled only first 128K RAM to avoid slowing down the boot process. But can fill whole 1MB if it requires.

PepAlacant commented 11 months ago

For now, all that I'm testing in the CD part is working well.

The only things I still see that could be incorrect are :

Fix layer problem in the loading screens of Fighter's History Dynamite ( only in demo mode in CD and CDZ modes )

The "auto pause" in the CDZ bios when checking the disk. This doesn't affects the games ... it's just the pause is pressed in the CD music menu. ( CDZ only problem )

There is a bug when pressing ABC+Select ( It's the reset function of the games in NEOGEO CD ) The pad becomes crazy sometimes. ( CD and CDZ problem )

When entering the Memory Manager then exit ( it reboots the console ) the game is not detected anymore ( CDZ only problem )

Thanks for the great work you are doing.

nonochus commented 11 months ago

The "auto pause" in the CDZ bios when checking the disk. This doesn't affects the games ... it's just the pause is pressed in the CD music menu. ( CDZ only problem )

When entering the Memory Manager then exit ( it reboots the console ) the game is not detected anymore ( CDZ only problem )

Testing the core, I've noticed one thing with these bugs that might help to resolve them.

Enter the memory manager, when you exit it no longer recognizes the game and it stays like pressing the pause button all the time on the cd-player, but if you press the "stop" button on the cd player..... the game is recognized again and can be played.

Tested on unibios and original bios in cdz mode. I hope this helps to solve the bugs.

Congratulations, the core works very well! Thank you very much!

Toryalai1 commented 11 months ago

About DMA and CD, seems like gyurco added to the mist repo: https://github.com/gyurco/NeoGeo_FPGA/commit/dcdbb56cb9d5faa8b0db81cb430829edf040943e

I don't know if this would be helpful or not

sorgelig commented 11 months ago

Generally speaking that timer was redundant and could be removed. I didn't dig much into CD code since it works.

sorgelig commented 11 months ago

Since original problem is solved, i close it. If there are other issues, then open a new one.