Mercurial > repos > blastem
changeset 952:7f4a7f07f325
Fix VDP interrupt ack. Big thanks to Eke-Eke or whoever left that helpful comment in Genesis Plus GX. Fixes Fatal Rewind
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 12 Apr 2016 08:35:44 -0700 |
parents | fec4a59ae5d7 |
children | 08346262990b |
files | vdp.c |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/vdp.c Mon Apr 11 20:56:54 2016 -0700 +++ b/vdp.c Tue Apr 12 08:35:44 2016 -0700 @@ -1935,9 +1935,16 @@ void vdp_int_ack(vdp_context * context, uint16_t int_num) { - if (int_num == 6) { + //Apparently the VDP interrupt controller is not very smart + //Instead of paying attention to what interrupt is being acknowledged it just + //clears the pending flag for whatever interrupt it is currently asserted + //which may be different from the interrupt it was asserting when the 68k + //started the interrupt process. The window for this is narrow and depends + //on the latency between the int enable register write and the interrupt being + //asserted, but Fatal Rewind depends on this due to some buggy code + if ((context->flags2 & FLAG2_VINT_PENDING) && (context->regs[REG_MODE_2] & BIT_VINT_EN)) { context->flags2 &= ~FLAG2_VINT_PENDING; - } else if(int_num ==4) { + } else if((context->flags2 & FLAG2_HINT_PENDING) && (context->regs[REG_MODE_1] & BIT_HINT_EN)) { context->flags2 &= ~FLAG2_HINT_PENDING; } }