Chawter
10 I
BASIC Kevwords
Sample Program
5
S T R I G ( 0 )
O N :
S T R I G ( 2 )
ON
1 0 ON S T R I G C 0 ) GOSUB 1 0 0 0
2 0 ON S T R I G C 2 ) GOSUB 2 0 0 0
3 0 P R I N T
"Press o n e
o f
t h e j o y s t i c k buttons."
4 0 FOR
I
=
1 TO 3 0 0 0 : N E X T
I
5 0 GOTO 3 0
1 0 0 0 P R I N T
"You p r e s s e d t h e left button."
: R E T U R N
2 0 0 0 P R I N T
"You p r e s s e d t h e right button."
:
RETURN
Lines 10 and 20 turn on joystick trapping. Line 30 instructs you
to press one of the buttons. Line 40 waits for you to press a but-
ton. If you press the left button, BASIC transfers program control
to the subroutine
at
Line 1000. If you press the right button,
BASIC transfers program control
to
the subroutine at Line 2000.
If you
do
not press a button, Line 50 returns to print the mes-
sage again. This program is a continuous loop. To end the pro-
gram, press
[ C T R L ] m ] .
239