Commodore 128 Programmer's Reference Manual page 88

Hide thumbs Also See for 128:
Table of Contents

Advertisement

78
COMMODORE 128
0
Li
PEN
Return X and Y coordinates of the light pen
\ ' (
PEN(n)
^
where n = 0 PEN returns the X coordinate of light pen position on any VIC screen.
p
n = 1 PEN returns the Y coordinate of light pen position on any VIC screen.
If
n = 2 PEN returns the character column position of the 80 column display.
n = 3 PEN returns the character row position of the 80 column display.
n = 4 PEN returns the (80-column) light pen trigger value.
j [
The VIC PEN values are not sealed and are taken from the same coordinate plane as
sprites use. Unlike the 40 column (VIC) screen, the 80 column (8563) coordinates are
r ~(
character row and column positions and not pixel coordinates like the VIC screen. Both
) [
the 40 and 80 column screen coordinate values are approximate and vary, due to the
nature of light pens. The 80-column read values are not valid until PEN(4) is true.
Light pens are always plugged in to control port 1.
If
EXAMPLES:
10 PRINT PEN(0);PEN(l)
Displays the X and Y coordinates of the light
j )
pen (for the 40 column screen).
IJ
10 DO UNTIL PEN(4):LOOP
Ensures that the read values are valid (for the
80 column screen).
j i
20 X = PEN(2)
Li
30 Y = PEN(3)
40 REM:REST OF PROGRAM
77
Return the value of pi (3.14159265)
j j
IT
EXAMPLE:
) I
I j
PRINT tt This returns the result 3.14159265.
u
POINTER
w
Return the address of a variable
POINTER (variable name)
- -
This function returns a zero if the variable is not defined.
L
EXAMPLE:
A = POINTER (Z)
This example returns the address of variable Z.
NOTE: Address returned is in RAM BANK 1.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents