[Coco] MAME Interrupt Bug

Glen Hewlett glen.hewlett at sympatico.ca
Sat Mar 18 13:31:32 EDT 2017


Hi Tim,

This little program sets up the graphics screen and sets up an IRQ to be hit during the VBLANK (60 times a second) similar to how my Pac Man game is running where I found this bug.  The IRQ Stack blasts some junk to the screen then returns.  The main program scrolls the top half of the screen 1 pixel to left just to show the computer is not locked up.

The program runs properly on my CoCo3 but using MAME in CoCo3 emulation mode it gets stuck in an endless loop in the Interrupt (I can see it happen using MAME debug mode).  I know the program is tiny but it’s not that big either and does show an example of this bug that I’m seeing.  It would be nice if someone else could verify they see the same thing with their version of MAME/MESS.  I’m currently using version 0.183 of MAME.

Since email usually kills source code formatting I posted the code on pastebin here:
http://pastebin.com/raw/4KFq4fqP <http://pastebin.com/raw/4KFq4fqP>

Cheers,
Glen


> On Mar 18, 2017, at 11:11 AM, Glen Hewlett <glen.hewlett at sympatico.ca> wrote:
> 
>> 
>> On Mar 18, 2017, at 10:38 AM, tim lindner <tlindner at macmess.org> wrote:
>> 
>> On Fri, Mar 17, 2017 at 7:54 PM, Glen Hewlett <glen.hewlett at sympatico.ca> wrote:
>>> On Mar 17, 2017, at 3:57 PM, William Astle <lost at l-w.ca> wrote:
>>>> On 2017-03-17 01:35 PM, Glen Hewlett wrote:
>>>>> The code below doesn’t work on the latest MAME (0.183) but it does work on a real CoCo3.
>>>>> I have a feeling that MAME doesn’t handle turning off all the interrupts very well.  Maybe it’s
>>>>> me, I’ll have to investigate this more as I’ve been using MAME to test my code for the last six
>>>>> months and this is the first time I’ve had an issue with it.
>> 
>>>> It might be that you're getting a spurious interrupt in MAME after disabling the GIME IRQ.
>>>> Reading FF92 immediately after disabling everything would clear that.
>> 
>>> You Rock!  You were totally correct that MAME was having trouble when I disabled the
>>> GIME IRQ and then disabled the IRQ.  I tried it as you described and only disabled
>>> the GIME IRQ and reading $FF92 and it now works fine with MAME.  I’m really glad to
>>> have the code running on MAME again.  :)
>> 
>> 
>> Let me see if I understand this.
>> 
>> 
>> LDA     #%01001100              *
>>       STA     $FF90                   * CoCo 3 Mode, MMU Enabled,
>> GIME IRQ Disabled, GIME FIRQ Disabled, Vector RAM at FEXX enabled,
>> Standard SCS Normal, ROM Map 16k Int, 16k
>>       LDA     #%00000000              * $00 - disable all interrupts
>>       STA     $FF92                   * Disable all Interrupts
>> 
>> 
>> The above code would disable interrupts on a real CoCo and a MAME.
>> 
>> But on MAME when stack blasting caused the CC reg to enable
>> interrupts, an interrupt would erroneously be taken?
> 
> Hi Tim,
> 
> Yes that is what seemed to have been happening.  The code above would cause MAME emulation of the CoCo3 to crash but on a real CoCo3 it was OK.  When I changed the above bit of code from:
>> LDA     #%01001100              *
>>       STA     $FF90                   * CoCo 3 Mode, MMU Enabled,
>> GIME IRQ Disabled, GIME FIRQ Disabled, Vector RAM at FEXX enabled,
>> Standard SCS Normal, ROM Map 16k Int, 16k
>>       LDA     #%00000000              * $00 - disable all interrupts
>>       STA     $FF92                   * Disable all Interrupts
> 
> To:
>> LDA     #%01001100              *
>>       STA     $FF90                   * CoCo 3 Mode, MMU Enabled,
>> GIME IRQ Disabled, GIME FIRQ Disabled, Vector RAM at FEXX enabled,
>> Standard SCS Normal, ROM Map 16k Int, 16k
>>       LDA     $FF92                  
> 
> 
> Then the code works under MAME emulation properly.  I also changed to the bit of code at the end of the CC stack blasting similarly.
> 
> I think I should write a little example code that proves this again so others can test this bug if this really is a bug in MAME or if it’s just me.
> 
> Cheers,
> Glen
> 
>> 
>> -- 
>> --
>> tim lindner
>> 
>> "Proper User Policy apparently means Simon Says."
>> 
>> -- 
>> Coco mailing list
>> Coco at maltedmedia.com <mailto:Coco at maltedmedia.com>
>> https://pairlist5.pair.net/mailman/listinfo/coco <https://pairlist5.pair.net/mailman/listinfo/coco>
> 
> 
> -- 
> Coco mailing list
> Coco at maltedmedia.com <mailto:Coco at maltedmedia.com>
> https://pairlist5.pair.net/mailman/listinfo/coco <https://pairlist5.pair.net/mailman/listinfo/coco>


More information about the Coco mailing list