The timers have different interrupt priorities. Timer 3 has the highest priority and timer 0 the
lowest. Immediately the timer expires, the count is reset and the count down to the next call of the
subroutine begins.
EVERY commands may be issued at any time, resetting the subroutine and time associated with the
given delay timer. The delay timers are the same as those used in the AFTER command, so an
EVERY overrides any previous AFTER for thegiven timer, and vice versa.
10 MODE 1:X=0
20 P100=O:EVERY 10 GOSUB 100
30 P200=0:EVERY 12,l GOSUB 200
40 PRINT "AMSOFT"
50 WHILE X<200
60 LOCATE #1,30,1:PRINT #1,X:X=X+1
70 WEND
80 LOCATE 1,20:END
100 DI:PEN P100:LOCATE 1,2: PRINT "peripherals":EI
105 IF P100=0 THEN P100=1 ELSE P100=0
110 RETURN
200 PEN P200:LOCATE 1,3: PRINT " and software"
205 IF P200=2 THEN P200=3 ELSE P200=2
210 RETURN
NOTE the use of DI and EI commands which disable and enable timer and sound interrupts whilst
the commands between them are executed. This has the effect of delaying the (higher priority)
interrupt of timer 1 from ever occurring during the processing of the interrupt from timer 0 (lines
100-110). Therefore, the PEN or LOCATE settings are not upset before the PRINT command.
10.3 REMAIN
This function returns the remaining count for one of the four system delay timers. It disables the
timer, returning zero if the timer is already disabled. It is used in the form:
REMAIN (<integer expression>)