How lightpen works

On your typical tv set the electron gun (in the CRT) scans across the screen (phospor) one line at a time. It starts at the upper left corner of the screen then draws going to the right. When it gets to the right the electron gun turns off goes down one line and turns on and draws the next line. It does this until it gets to the bottom of the screen. Where it goes back to the top and starts over again. These are called raster lines.

Well when the electron beam hits the phosphor it glows brightly and slowly dims until it is struck again by the electron beam. Our eyes don't really notice this bright and dimming because they do not refresh that fast. You can see the bright/dim effect if you record the picture on the tv with a camcorder. Since the TV and the Camcorder refresh at about the same frequency you will see a bright group of lines that roll up the screen.

Since the Video Chip in the computer has to create the video signal it knows where it is currently drawing the curent raster line. The light pen when pointed to the screen detects this bright/dim effect and when the light goes from dim to bright it sends a signal pulse to the video chip. The video chip sets a latch which feeds 2 numbers, usually X location, Y location, into a memory location associated with the video card/chip. The computer program then looks at the numbers in the memory location. And can tell where the light pen is pointed on the screen by the two numbers.

Some light pens are more sensitive than others. They are usually just a Photo receptor cell with a pinpoint lens and a schmitt-trigger flip flop chip.

Some video cards had light pen plugins on them. For example CGA and EGA cards had a light pen connector in them with following pinout:

1       Light Pen Input [-]
2       no pin
3       Light Pen Switch [-]
4       +5V output
5       +12V output

I have not seen or heard of one on a VGA or higher video card. Not a high demand item, but there are probably ones out there.

The sensitvity of the nintendo gun is probably to low/slow to work at the higher scan rates of the tipical computer monitor. TV scan rates are pretty slow compaired to the computer ones. So if you find a video card that has the light pen plugin you will probably have to use their light pen.