QBasic 1.1: PEN Function
Explanation
PEN Function
Returns the status of the light pen.
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Syntax
Description / Parameter(s)
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