When the time specified has passed, the subroutine is called automatically, just as if a
GOSUB
had
been issued at the current position in the program. When the subroutine finishes, using a normal
RETURN
command, the main program continues running where it was interrupted.
The timers have different interrupt priorities. Timer 3 has the highest priority and timer 0 the
lowest.
AFTER
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
EVERY
command, so an
AFTER
overrides any previous
EVERY
for the given timer, and vice versa.
10 MODE 1: X=0
20 AFTER 45 GOSUB 100
3 0 A F T E R 1 0 0 , 1 G O S U B 2 0 0
40 PRINT "AMSOFT"
50 WHILE X<100
6 0 L O C A T E # 1 , 3 0 , 1 : P R I N T # 1 , X : X = X + 1
70 WEND
80 END
1 0 0 P R I N T " p e r i p h e r a l s "
110 RETURN 110
2 0 0 P R I N T " a n d s o f t w a r e "
210 RETURN 210
Note the use of two streams (windows) to allow printing by the ‘main program’ (Lines 50-80) using
independant cursor positioning from that used by the interrupt subroutines.
AFTER the time you have preset in the command line, the program diverts to the designated
subroutine and performs the task defined therein:
10.2 EVERY
The EVERY command allows a BASIC program to arrange for subroutines to be called at regular
intervals. Four delay timers are available, each of which may have a subroutine associated with it.
Its form is:
EVERY <integer expression>, [<integer expression>] GOSUB <line number>
The first <integer expression> specifies how long to wait between each call of the subroutine. This
time is measured in 1/50ths of a second.
The second <integer expression> specifies which of the four possible delay timers is to be used. The
expression must yield a value in the range 0..3. If the expression is omitted, timer 0 is assumed.
When the time specified has passed, the subroutine is called automatically, just as if a GOSUB had
been issued at the current position in the program. When the subroutine finishes, using a normal
RETURN
command, the main program continues running where it was interrupted.
Содержание CPC464
Страница 1: ......
Страница 32: ...or you can type 3e1 1e1 ENTER 300 2 3000x1000 Type 3e3 1e3 ENTER 3000000 3 3000x0 001 Type 3e3 1e 3 ENTER 3 ...
Страница 102: ...PRINT 10 AND 12 Results in 8 PRINT 10 AND 1000 Results in 8 again ...
Страница 118: ...TO DO DRAW THIS PAGE ...
Страница 219: ...actual value may be made to vary during the execution of a program ...
Страница 240: ...Text and WINDOW planner Mode 2 80 Columns ...
Страница 241: ......
Страница 245: ...Sound envelope Music planner sheet ...