Calculator Community > TI Z80

di / ei timing

(1/1)

E37:
I am using the crystal timers for very precise timekeeping and I want to know if I can disable and enable interrupts for certain small routines without that throwing off the timer.

What does using ei and di to enable and disable interrupts do to the interrupts 'timer'? Does it pause it so that if an interrupt would occur in 1000 t-states before interrupts were disabled, it would actually happen 1000 t-states after they were enabled again or does it happen 1000 - (amount of t-states that interrupts were disabled for) t-states?
Does using the crystal timers vs normal interrupts make any difference?

Xeda112358:
Since you can use the timers without interrupts I'd imagine that they count independent of whether or not interrupts are enabled or disabled. However, if the timer hit 0 without your acknowledging and then you later EI, it looks like it'll immediately trigger an interrupt.

Specifically, I was reading about the timers' loop control ports, but I'm not experienced with the timers yet, so I may have misinterpreted it.

E37:

--- Quote from: Xeda112358 on July 21, 2019, 12:47:35 pm ---Since you can use the timers without interrupts I'd imagine that they count independent of whether or not interrupts are enabled or disabled. However, if the timer hit 0 without your acknowledging and then you later EI, it looks like it'll immediately trigger an interrupt.

Specifically, I was reading about the timers' loop control ports, but I'm not experienced with the timers yet, so I may have misinterpreted it.

--- End quote ---
You read it right. I just didn't pay enough attention to that when I was making it. So disabling interrupts only prevents them from occurring. When interrupts are off, they will pile up like when the ISR is too long.

That should be fine then. Thanks

Navigation

[0] Message Index

Go to full version