Download Print this page

Atari CX70 Operator's Manual page 67

Light pen

Advertisement

ATARI Light Pen Operator's Manual
APPENDIX H - GENERAL PROGRAMMING NOTES
Familiarity uiith ATARI assembly language is not required to uirite
programs that use the pen. However, ATARI has provided an assembly
language routine (PENBUF) which is loaded in each case by the BASIC
loader program and is called by the BASIC "USR" function. The
following list provides general programming notes for the USR function
as it applies to the light pen.
USING THE PEN WITH ATARI BASIC IN GRAPHICS MODE 0
1.
Include PENBUF loader in your program.
m
2.
GOSUB 9000 to load it into the right place.
3.
Define PENBUF=1536 (as the start of the routine)
4.
Sense that the pen switch is pressed; read location 632, 633, 634,
or 635, depending on where the pen is installed (controller jack
#1, 2, 3, or 4) 14 = pressed, 15 = not pressed.
5.
Get X, Y coordinates by: JUNK=USR(PENBUF)
NOTE: X and Y coordinates will not change unless enough light
reaches the pen.
6.
X is in location 208, Y is in location 209.
7A. POSITION the cursor using X and Y and PRINT anything, OR
7B. Compare X and Y to other numbers known to represent desired
responses.
USING THE PEN WITH ATARI BASIC IN GRAPHICS MODE 23
1-5. Same as above.
6.
X is in location 206, Y is in location 207.
7A.
PLOT X, Y as desired OR 7B.
Same as above.
USING OTHER PROGRAMMING LANGUAGES WITH THE ATARI LIGHT PEN
1.
Use the other language's equivalent commands to load PENBUF into
Page 6.
2.
Change the value stored at 1536 (hex $600) to a 234 (hex $EA).
This is a NO-OP (No Operation) machine code instruction. BASIC
passes a value onto the stack representing the number of values
being passed in a BASIC USR routine. For a normal subroutine call
General Programming Notes - 63

Advertisement

loading