MAMEWorld >> Programming
View all threads Index   Flat Mode Flat  

Bart T.
Reged: 01/07/06
Posts: 196
Send PM
Re: EmuTimer question
05/13/15 06:14 AM


> Hi all, I have a question about MAME timers that really gives me a headache
> From what I see a timer, "advances" when a CPU eats cycles (so it's CPU dependant).
>
> Well, let's take a case with a single CPU (eg. M6809) and with only one IRQ source
> (for example a vblank IRQ fired by a timer)...
> So, if the CPU is in "wait mode" (eg: CWAI instruction) and therefore it can be
> "unlocked" only by the vblank irq..., then 'who' increases the timer that should fire
> the vblank irq?

I don't know the details of how MAME works (I've only read, not worked on, that code base) but when a CPU is in a suspended state like this, the clock is still ticking. The CPU will continue to "eat" cycles. It just won't be doing anything (the program counter won't advance, for instance). So if MAME has timers tied to CPU cycles, they will continue to function as expected.

Think of it this way: Work doesn't cause the CPU clock to tick. Causality runs the other way: clock cycles are what drive the CPU. When in a suspended state, on each clock cycle, the CPU evaluates whether a "wake-up" condition has been met (e.g., an external signal, an interrupt, or some on-chip timer expiring). In your case, it's an external interrupt. If this hasn't happened, it will remain in the same state.


Bart

Edited by Bart T. (05/13/15 06:15 AM)







Entire thread
Subject Posted by Posted on
* EmuTimer question dma.request 05/12/15 09:36 AM
. * Re: EmuTimer question Bart T.  05/13/15 06:14 AM
. * Re: EmuTimer question R. Belmont  05/13/15 08:33 PM
. * Re: EmuTimer question dma.request  05/13/15 10:05 AM

Extra information Permissions
Moderator:  Pi 
1 registered and 70 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 2156