Spotlight › CGA light pen
CGA light pen
Point at the screen itself. With a light pen on a CGA card, you can now press, drag and release on the os8088 desktop.
- Position steps
- 16 x 2 pixels
- Memory while loaded
- 512 bytes
- Screens it works on
- CGA
01 / What it is
What it is
A light pen is a stylus with a light sensor in its tip, from the years before most computers had a mouse. A CRT, the picture tube of an old monitor, draws its picture with a spot that sweeps the screen line by line. When the spot passes under the pen, the sensor sees it, and the graphics card notes where the spot was at that instant.
CGA, the colour graphics card of the first IBM PCs, has a connector for such a pen. os8088 now has a driver for it: hold the pen to the screen and press its switch to click, keep it pressed to drag, and let go to release.
02 / On the screen
On the screen
03 / How it works
How it works
Once each clock tick, about 18 times a second, the driver reads the pen's switch and the card's record of where the pen last saw light. From that it works out a position and moves the pointer there.
The card can only say which 8-pixel byte it was reading, and in this mode that comes out as steps of 16 pixels across and 2 lines down. Release works even over a dark part of the screen, where the pen sees nothing. The mouse and keyboard pointer keep working alongside it.
04 / What it does not do
What it does not do
It has not been tried with a real pen on a real monitor. Everything here was tested on an emulator that imitates the card's pen circuit. A report from real hardware is welcome.
It is coarse. Use the mouse for pixel work. A pen needs something lit under it to click.
CGA only, as the main screen. The 286 edition and the 128KB edition of os8088 do not have the driver.
05 / Run it
Run it
Connect a switched light pen to the CGA card.
Boot os8088 from the standard system disk on the CGA monitor.
Open Control Panel > Drivers and tick CGA Light Pen. Close the Control Panel to keep the choice.
Aim at a bright part of an item and press the pen's switch.