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.
commands may be issued at any time, resetting the subroutine and time associated with the
EVERY
given delay timer. The delay timers are the same as those used in the
overrides any previous AFTER for thegiven timer, and vice versa.
EVERY
1 0 M O D E 1 : X = 0
2 0 P 1 0 0 = O : E V E R Y 1 0 G O S U B 1 0 0
3 0 P 2 0 0 = 0 : E V E R Y 1 2 , l G O S U B 2 0 0
4 0 P R I N T " A M S O F T "
5 0 W H I L E X < 2 0 0
6 0 L O C A T E # 1 , 3 0 , 1 : P R I N T # 1 , X : X = X + 1
70 WEND
8 0 L O C A T E 1 , 2 0 : E N D
1 0 0 D I : P E N P 1 0 0 : L O C A T E 1 , 2 : P R I N T " p e r i p h e r a l s " : E I
1 0 5 I F P 1 0 0 = 0 T H E N P 1 0 0 = 1 E L S E P 1 0 0 = 0
1 1 0 R E T U R N
2 0 0 P E N P 2 0 0 : L O C A T E 1 , 3 : P R I N T " a n d s o f t w a r e "
2 0 5 I F P 2 0 0 = 2 T H E N P 2 0 0 = 3 E L S E P 2 0 0 = 2
2 1 0 R E T U R N
NOTE the use of
DI
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>)
and EI commands which disable and enable timer and sound interrupts whilst
command, so an
AFTER