Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: E37 on July 21, 2019, 12:26:44 pm

Title: di / ei timing
Post by: E37 on July 21, 2019, 12:26:44 pm
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?
Title: Re: di / ei timing
Post by: 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 (http://wikiti.brandonw.net/index.php?title=83Plus:Ports:30#Loop_Control_ports:), but I'm not experienced with the timers yet, so I may have misinterpreted it.
Title: Re: di / ei timing
Post by: E37 on July 21, 2019, 03:08:46 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 (http://wikiti.brandonw.net/index.php?title=83Plus:Ports:30#Loop_Control_ports:), but I'm not experienced with the timers yet, so I may have misinterpreted it.
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