Download Print this page

Atari CX70 Operator's Manual page 33

Light pen

Advertisement

ATARI Light Pen Operator's Manual
SECTION 5 - PRQQRAMMINQ EXAMPLE 1:
Using the Light Pen uiith
ATARI BASIC
This program demonstrates the ability of the computer to sense the
position of the light pen on the screen. It will plot a dot of light
each time you place the pen against the screen. The dots will be
placed exactly where the pen was resting.
Type in the following program>
then RUN it.
1 REM DEMO PROGRAM *1, L.IGHT PEN WITHOUT "PENBUF"
10 GRAPHICS 23:SETC0L0R
12,8JSETC0L0R 0,7,1-1JCOLOR 1
20 IF PEEK(632)=15 THEN 20
30 0=PEEK(5'<J28^)
^0 X=a+15'^-228*(a>10)
50 Y=PEEK(5-1285)-16
60 PLOT X,Y
70 GOTO 20
80 END
Figure 8
Programming Example 1: Using the Light Pen with
ATARI BASIC
Through the use of Graphics Mode 7 this program produces a bright
green screen. This screen is actually a set of 160 (horizontal) by 96
(vertical) squares> each of which is colored green. Push the light
pen against the television screen somewhere near the center and see
what happens. A blue dot should appear* opposite the pen tip* on the
screen. (If nothing happens* turn to Appendix C* Troubleshooting.)
Using the Light Pen with ATARI BASIC - 29

Advertisement

loading