Rob Finch wrote:
The following EhBASIC program shows interrupts happening by displaying an “I” on screen when an interrupt occurs.
Code:
10 ON IRQ GOTO 1000
20 GOTO 10
1000 PRINT “I”;
1010 RETIRQ
This piece of code is a typical example to me why I have problems to understand the concept of IRQ handling in EhBasic.
If line 10 "enables" a sort of IRQ handler (that causes a GOTO 1000 if an IRQ is present) then the example should have a second line like
20 GOTO 20
But if the ON IRQ has to be executed frequently - well this is no IRQ service, it is a special sort of polling (and useless).
The same confusion with line 1000, 1010. OK, 1000 does something because of a present IRQ, so far so fine. Then 1010 RETIRQ. ??? How does RETIRQ know where and how to clear the interrupt? It makes no sense to return from IRQ without clearing the cause of the IRQ somehow. The IRQ - as I see it - is still present, so this would result in an infinite loop.
It only would make a (very limited) sense, if IRQ "processing" is done by polling (ON IRQ GOTO...).
Sorry for this outbreak Rob
- the reason you gave this example is more serious and its challenging to detect the cause. If it were a new hardware I would estimate an open circuit (at least temporarily) somewhere. Could this in this virtual case be possible? An undefined state of one signal between two clocks or so? Another candidate would be a timing violation.
As you say task#0 is working fine, the others not so fine, what if you would generate a copy of your BIOS-monitor and have it running on a different task number. Perhaps you change only the prompt of this clone to distinguish which monitor is running. If you switch to this clone - whats then about the IRQs?