QBasic 1.1: PEN Function

Syntax

PEN(n%)

Description / Parameter(s)

n% Specifies the information to be returned about light pen status:
 
n%Returns
0Whether pen was used since last call (-1 if yes, 0 if no)
1The x screen coordinate of the last pen press
2The y screen coordinate of the last pen press
3The current pen switch status (-1 if down, 0 if up)
4The x screen coordinate where the pen last left the screen
5The y screen coordinate where the pen last left the screen
6The character row of the last pen press
7The character column of the last pen press
8The character row where the pen last left the screen
9The 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