Int 10H [CGA] [PCjr] [EGA] Function 04H Get light pen position

Obtains the current status and position of the light pen.

Call with:

AH = 04H

Returns:

AH = 00H if light pen not down/not triggered

01H if light pen down/triggered

BX = pixel column (graphics x coordinate)

CH = pixel row (graphics y coordinate, modes 04H—06H)

CX = pixel row (graphics y coordinate, modes 0DH—13H)

DH = character row (text y coordinate)

DL = character column (text x coordinate)

Notes:

The range of text and graphics coordinates returned by this function depends on the current display mode.

On the CGA, the graphics coordinates returned by this function are not continuous. The y coordinate is always a multiple of two; the x coordinate is either a multiple of four (for 320-by-200 graphics modes) or a multiple of eight (for 640-by-200 graphics modes).

Careful selection of background and foreground colors is necessary to obtain maximum sensitivity from the light pen across the full screen width.