> 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)
|