Page 1 of 1
MD Mega Fighter (aka mmf)
Posted: Tue Nov 18, 2008 12:17 am
by ElBarto
Hello all,
I've started a quite ambitious project, a fighting game.
I don't know if I'm gonna finish it one day but it's a pretty complete project to learn a lot of thing on the MD
You can download the demo
here.
For now you can only move/jump and only with player1, the player2 is here just for fun.
There is a glitch while you jump forward or backward (only in fusion), I'm trying to find a solution to fix that ....
I've not tried on HW so if anybody can for me
The source will follow soon.
Posted: Tue Nov 18, 2008 12:12 pm
by TmEE co.(TM)
Do you use DMA for the sprites ? I'm sure you do, and you are crossing a 128K boundary here (DMA updates only 16bits of the source address), so this glitch will happen on real HW aswell (not tried). Only Fusion does emulates this feature.
Posted: Tue Nov 18, 2008 12:24 pm
by notaz
Hm, I get 404 Not Found.
Posted: Tue Nov 18, 2008 5:36 pm
by TmEE co.(TM)
Gave a whirl on real HW and surprise surprise, it does not run. Luckily for you I had EXACT same problem in my game, and the problem is having DMA enabled and writing $00 to the last DMA reg !!! You either write $80 or don't set the DMA enable bit. This is the DMA bug I believe, one workaround is making Z80 run code that accesses ROM, this way you won't get crashes.
Posted: Tue Nov 18, 2008 10:24 pm
by Nemesis
TmEE co.(TM) wrote:Gave a whirl on real HW and surprise surprise, it does not run. Luckily for you I had EXACT same problem in my game, and the problem is having DMA enabled and writing $00 to the last DMA reg !!! You either write $80 or don't set the DMA enable bit. This is the DMA bug I believe, one workaround is making Z80 run code that accesses ROM, this way you won't get crashes.
Can you give more info on this Z80 workaround you mentioned? Are you saying that simply reading ROM data from the Z80 will somehow prevent this lockup from occurring, or release the system from a locked state?
Posted: Tue Nov 18, 2008 11:17 pm
by TmEE co.(TM)
When I had this issue in my game, I tried everything possible until I noticed I do an accidental DMA during reg initialization. The crash never happened when my sound engine played music with drums (aka heavy ROM access), Z80 initialized before VDP setup... when the DMA crash happens, the whole system seems stopped, though I'm not 100% sure as my engine may be waiting a command from 68K which is halted.
Posted: Wed Nov 19, 2008 6:46 am
by ElBarto
I didn't really understand the dma bug ...
Here is what I do (in vblank):
- Enable DMA
- Setup DMA to copy tiles
- Disable DMA
Two times (each times for each player cause I didn't update the tile if the frame is the same).
I know I should wait for DMA BUSY = 0 to disable the dma, this may cause a bug ....
Posted: Wed Nov 19, 2008 7:26 am
by HardWareMan
Somewhere I read that M68K halted while running DMA. Is it correct?
Anyway, I already used several DMA transfering in VBlank routine without checking DMA busy flag. All works fine.
Posted: Wed Nov 19, 2008 8:02 am
by ElBarto
Yeah I've read that too, I assume it's true.
So what is the need of a DMA BUSY flag if when you want to check this (68k code) it's will be always 0 cause the dma isn't "running" ?
Don't know if I'm clear enough.
Posted: Wed Nov 19, 2008 8:59 am
by TmEE co.(TM)
You're having accidental DMA right in the reg initialization, when I run in on my MD2 I get a switch to 240 line res and a crash, with VRAM and palettes being in the undefined state (with TMSS enabled, I get the TMSS screen in 240line res)... that is, the code does not even reach the RAM clearing... I had same problem in my game, and cause was accidental DMA and a crash caused by it... 68K should be halted and nothing should happen, but it still crashes, and only DMA crashes are related to the DMA crashing bug mentioned in the manual. I've never ran into the bug as I've nearly always had Z80 doing something with the ROM... I'm quite sure that without any ROM access on Z80 side, I will probably start getting crashes in some situations unless I do the workaround Sega mentioned.
Posted: Wed Nov 19, 2008 9:45 am
by ElBarto
Ok I get it, the DMA enable bit was setting at the vdp initialisation.
The rom should now run on HW (same url).
I really have to get my tototek flash work on FreeBSD, my only window pc is my laptop and I don't have a parallel port on it ....
Posted: Wed Nov 19, 2008 10:34 am
by TmEE co.(TM)
It still doesn't work... crash during reg init... don't load last VDP register, maybe it helps... I know all my ROMs work because of a bug in my code that left last VDP register to be untouched
BTW, 240 line res is 50Hz only, you get rolling screen in 60Hz.