Radio Shack TRS-80 Model 100 Basic Manual page 164

Basic language lab
Hide thumbs Also See for TRS-80 Model 100:
Table of Contents

Advertisement

Line 28
If
a function key is pressed, execution will be directed according to the
subroutine line numbers in the ON KEY GOSUB statement. For example, if Function
Key (Ij) is pressed, execution goes to the subroutine in line number 100.
If
the
second Function Key, (£2), is pressed, execution goes to the subroutine in line number
200. If the third Function Key, CE3), is pressed, execution goes to the subroutine in
line number 300.
If any other function key is pressed, nothing happens, since there are no more line
numbers in the ON KEY GOSUB statement.
The general form of the statement is:
ON KEY GOSUB
<Ust
of
line numbers>
where the list of line numbers corresponds to subroutines. The first line number in the
list corresponds to Function Key (fj), the second line number, if present, corresponds
to Function Key (£2), and so on.
The ON KEY GOSUB statement must be placed in the program so that it will be
executed before the Function Key is pressed. Otherwise, the Function Keys will
be
ignored during program execution.
Line 38 A continuous loop prints the integers starting at zero and incrementing in
steps of one. These statements keep right on printing, so long as a Function Key is not
pressed.
Line
lee
This two statement interrupt subroutine is executed if the Function Key (Ij)
is pressed. The statement which is being executed when the Function Key is pressed is
allowed to finish before execution is transferred to the subroutine. This subroutine
simply prints the message
SUBROUTINE 1
and returns execution to the statement after the one which was interrupted. For
example, if the interrupt occurs while the statement
PRINT I
is being executed, then execution returns to the next statement
1=1+1.
Line 288 This interrupt subroutine is executed if Function Key
~
is pressed.
Line 388 This interrupt subroutine is executed if Function Key (l3) is pressed.
Experiment #3 Interrupting an Interrupt
It
is possible to interrupt an interrupt subroutine by pressing a Function Key while the
interrupt subroutine is executing. You can modify the current program to illustrate
this.
Change line 200 to:
200 FOR
J
=
1 TO 20
158

Advertisement

Table of Contents
loading

Table of Contents