Okay, now my age and lack of experience is going to
show: Can someone
explain
to me exactly *how* a light pen works? What is the feedback mechanism if
drawing on, say, a completely black screen? How does the computer get
coordinates for where the pen is touching?
I can tell you how the C64 does it, and I'm sure the principle is broadly
applicable.
The VIC-II knows at any given point in time which pixel coordinate the
raster beam is currently at. Within the light pen is a sensor which can
pick up the presence of the beam. The screen is being updated 60 times
per second (NTSC), so unless you get the pen off within that 1/60th of a
second, at some point the raster beam will be within view of the light
pen's sensor. When this happens, a triggering signal is sent to the VIC-II,
which latches the current X/Y position of the beam (and therefore the pen)
into its registers. Once read, the registers reset for another read. Since
this all happens in literally a jiffy or two, there is a lot of jitter and
so the C64 PRG recommends sampling and averaging over a few frames before
using the generated coordinates.
There can be additional switches present for more functions. The Inkwell
Systems 170C that I use with my C128 has a simple single switch in the pen
nib which is triggered when depressed, but the pen location can still be
tracked with the pen held sufficiently close to the screen to see the beam,
even without the switch activated.
--
---------------------------------- personal:
http://www.armory.com/~spectre/ --
Cameron Kaiser, Floodgap Systems Ltd * So. Calif., USA * ckaiser at
floodgap.com
-- Whatever it is, I'm against it. -- Groucho Marx ----------------------------