Download Print this page

Atari CX70 Operator's Manual page 35

Light pen

Advertisement

ATARI Light Pen Operator's Manual
BASIC Reference Manual for color and hue information. A relatively
bright background color level has been chosen to assure that the light
pen mill respond easily. You may experiment by changing the brightness
(luminance) and hue of the background as well as varying the
brightness control of your television set to determine the minimum
levels to which your light pen will respond (see Appendix B).
At line 20/ the program looks at location 632. If it contains a
decimal 15/ it means the light pen is not pressed against the screen.
If it contains a decimal 14/ the light pen is pressed against the
screen. The application of the light pen to the screen closes a switch
that is built into the tip. Until the switch is closed/ the computer
stays in a wait loop at line 20.
At line 30/ the computer reads an internal (X) hardware register which
has been activated by the light pen. Line 40 adjusts this value to be
compatible with Graphics Mode 23 plotting coordinates (range 0-159).
Line 50 causes a read of the Y hardware register and adjusts the value
of Y to Graphics Mode 23 (range 0-95).
Line 60 plots the point found in the adjusted hardware registers/ the
point currently under the tip of the light pen. Then the program
returns to the wait loop at 20 until the next switch closing.
Experimenting with Programming Example 1
Each time you move the light pen along the screen/ you leave a trail
of dots behind. Place the light pen in one spot/ holding it
perpendicular to the screen. Now at that same spot/ aim the pen at
different angles otFier than perpendicular. Notice that spots
surrounding the one the pen sits on are being plotted also. The pen is
detecting light from other parts of the screen (see Appendix B).
Move the pen slowly to draw figures on the screen. Occasionally/ a dot
will appear at a random location on the screen even though the pen is
not near that area. This is caused by random noise from the television
or pen. Section 6 shows how to prevent noise from affecting your
programs.
Using the Light Pen with ATARI BASIC - 31

Advertisement

loading