10 Interrupt features
Subjects
covered
in this chapter:
* AFTER
* EVERY
* REMAIN
* The master clock
If you haven’t already noticed, a major innovation in the software of the CPC464 is its unique ability
to handle interrupts from
BASIC
- which means that
AMSTRAD BASIC
is capable of performing a
number of simultaneous but separate operations within a program. Such a facility is sometimes
referred to as multitasking, and it is implemented by the application of the new commands
A F T E R
and
EVERY
.
This facility is also clearly demonstrated in the way in which sound may be handled through
facilities such as queues and rendezvous.
Every aspect of timing is referred to the master system clock, which is a quartz controlled timing
system within the main computer that looks after the timing and synchronisation of events that
happen in the computer - things like the scanning of the display and clocking the processor. Where a
function in the hardware is related to time, this can be traced back to the quartz master clock.
The software implementation is the
A F T E R
and
EVERY
command, which in keeping with the
user-friendly approach of
AMSTRAD BASIC
do precisely what they say: eg.
A F T E R
the time you
have preset in the command line, the program will divert to the designated subroutine and perform
the task defined therein.
10.1 AFTER
The CPC464 maintains a real time clock. The AFTER command allows a BASIC program to arrange
for subroutines to be called at some time in the future. Four delay timers are available, each of which
may have a subroutine associated with it.
A F T E R
<integer expression>[, integer expression]
G O S U B
<line number>
The first integer expression specifies how long before the subroutine should be called. 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, 0 is assumed.
Содержание 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 ...