and enter the new lines:
210
PRINT
"SUBROUTINE
2"
220
NEXT
J :
RETURN
List the program
to
confirm that it
is:
10
KEY
ON
20
ON
KEY
GoSUB
100,200,300
30
PRINT
I : 1=1+1 :
GoTo
30
100
PR
I
NT
"SUBRoUT
I
NE
1" :
RETURN
200
FOR
J = 1
TO
20
210
PRINT
"SUBROUTINE
2"
220
NEXT
J :
RETURN
300
PR
I
NT
"SUBRoUT
I
NE
3"
:
RETURN
Execute this program and press
~
to interrupt execution and begin execution of the
interrupt subroutine at line 200.
You should see the message:
SUBROUTINE
2
repeat 20 times.
When the subroutine
is
finished printing 20 times, execution returns to the main
program. You will see the numbers printing again when this happens.
Again press
Cf2)
to interrupt execution of the main program. This time however, press
the
F1
function key before the 20
SUBROUTINE
2
messages finish printing. You then should see the message:
SUBROUTINE
1
displayed once and the SUBROUTINE 2 message continue until all
20
repetitions are
complete. Finally, execution returns to the main program where the numbers continue
to
be
displayed.
Sometimes it
is
desirable to be able
to
interrupt
an
interrupt subroutine and sometimes
it
is
not desirable. The KEY
OFF
statement can be used
to
prevent the interruption of
an
interrupt subroutine.
Change the following lines
in
your program:
200
KEY
oFF:FoR
J = 1
TO
20
220
NEXT
J :
KEY
ON
:
RETURN
List the program to confirm that it
is:
10
KEY
ON
20
ON
KEY
GoSUB
100,
200,
300
30
PRINT I : 1=1+1 :
GoTo
30
100
PR
I
NT
"SUBRoUTI
NE
1":
RETURN
200
KEY
oFF:FoR
J = 1
TO
20
210
PRINT
"SUBROUTINE
2"
220
NEXT
J :
KEY
ON
:
RETURN
300
PRINT
"SUBROUTINE
3":RETURN
159