Re: [hatari-devel] Many changes to MFP |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Hi Nicolas,
That's a huge change, thanks a lot.
I've given a very previous try to your patch.
At least, K.prg (Falcon karting) is now working well.
I already detected that calling the DSP before testing the MFP
interrupts made it work (I found it by chance).
Your changes seems to let the game work (tested only with the OLD cpu
for now).
I continue to check.
Regards
Laurent
Le 10/03/2013 21:46, Nicolas Pomarède a écrit :
Hello
although OK most of the time, the code in mfp.c had some serious
bugs/limitations that affected a limited number of games/demos, but
required quite a lot of rewrite to get the good results.
Some of the problems :
- in MFP_CheckPendingInterrupts, if several interrupts happened at
the same time, they would all be processed (instead of handling only
the highest one) and moreover, they would be processed in reverse
order (so timer C would be handled before timer B for example !)
- in newcpu.c, do_specialties_interrupt was called each time
PendingInterruptCount remained < 0, instead of calling it only once
when all PendingInterruptFunction were processed, to start an
exception only for the highest priority interrupt.
- an extra delay of 4 cycles is required when the MFP's IRQ signal is
set before it is visible to the CPU (but this delay is not always
necessary, it depends on when the signal was set while processing the
current cpu instruction, so this involves some kind of sub-instruction
level when processing timers)
All in all, this required quite a lot of careful changes, as the mfp
is a rather central part of the computer and any error can have big
(bad) impacts.
I also moved the DSP interrupt part back in falcon/dsp.c, as it
doesn't belong to the MFP and has no interrupt number of its own in
mfp.c.
This new code should fix a few games (rasters in Super Hang On and
Super Monaco GP, Bolo not starting) as well as a few demos (Audio
Artistic Demo by Big Alec, Reset part in Decade Demo, ...)
I tested a lot of games / demos to avoid regression, but it's possible
some program are not working anymore, don't hesite to test your
favorites demos/games (especially Falcon's programs, I didn't test
them that much).
More work is still required to handle MFP interrupt happening *during*
the processing of an exception (Main Menu in Anomaly Demo for
example). This is rather tricky, as it requires to emulate the IACK
cycles between the CPU and the MFP. Hopefully I should fix this in
another patch.
Nicolas