PEN Function
◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Returns the status of the light pen.
PEN(n%)
■ n% Specifies the information to be returned about light pen status:
n% Returns
══ ═════════════════════════════════════════════════════════
0 Whether pen was used since last call (-1 if yes, 0 if no)
1 The x screen coordinate of the last pen press
2 The y screen coordinate of the last pen press
3 The current pen switch status (-1 if down, 0 if up)
4 The x screen coordinate where the pen last left the screen
5 The y screen coordinate where the pen last left the screen
6 The character row of the last pen press
7 The character column of the last pen press
8 The character row where the pen last left the screen
9 The character column where the pen last left the screen
Example:
DO
P = PEN(3)
LOCATE 1, 1: PRINT "Pen is ";
IF P THEN PRINT "down" ELSE PRINT "up "
PRINT "X ="; PEN(4), " Y ="; PEN(5); " "
LOOP
See Also ◄PEN, ON PEN Statements► ◄SCREEN► ◄Screen Modes►