Light pen
ZXNet echo conference «hardware.zx»
From Eugene Palenock → To Ivan Roshin 2 February 2001
Hello Ivan!
22 Jan 01 12:48, Ivan Roshin -> All:
IR> program preferably in assembler for servicing the light pen,
IR> connected via tape input for Speccy. If
IR> there is one, please throw the text of the program into my soapbox. What if
IR> no, then at least give me some idea.
I wrote software for this once...
The idea is this (and the only one) - the screen is blanked, then the white line scrolls
vertically, then the line is extinguished and the pixel scrolls horizontally along it.
A simplified option is to clear attributes to 0 and then scroll to attribute 127.
Naturally, it will work slowly, because you need to avoid getting caught in the ray.
You can not scroll the line, but activate it in half of the screen area
(start with the full screen first) and discard the half where there is no pen. Much
it will be faster.
The subject is simply a photodiode that shows the threshold brightness of the point below it.
It's easy to do. Therefore, after detecting a response to a bright point, it is necessary
extinguish and check this, because otherwise there may be a false positive - for example
the person pointed the subject at the lamp from the moment the screen was scanned.
Best regards, Evgeniy.
From Eugene Palenock → To Kirill Frolov 3 February 2001
Hello Kirill!
02 Feb 01 09:02, Kirill Frolov -> Ivan Roshin:
KF> Such a pen has no practical value; a mouse is much more convenient.
It has, for example, if some information device is made from Spectrum and
put it at the station. Stupid guests of the capital can’t handle a mouse, but poking with a pen
on the screen - easily.
Best regards, Evgeniy.
From Dmitriy Nesmachny → To Eugene Palenock 5 February 2001
Hello Eugene!
Tuesday 3 } 2001 08:41:33, Eugene Palenock -> Kirill Frolov:
EP> Has, for example, if some information device from
Make a Spectrum EP> and place it at the station. Stupid guests
EP> capitals cannot cope with a mouse, but poking a pen on the screen -
EP> easily.
Yeah, but not the way you wrote: why determine the coordinate if it’s better
determine an area of the screen using a stylus? In short, the algorithm is something like this:
implement:
1. Draw several control buttons on the screen.
2. The buttons flicker with a maximum frequency so that this can be done
catch: 1 frame is on, 2 is off, for example (after all, the phosphor is on the monitor screen
have some inertia, due to which, for example, two-screen pictures
do), the pen is simultaneously polled as soon as it is in time with the flickering of the buttons
will respond, which means it was pointed at the button.
3. We extinguish half of the buttons, determine whether it is above the extinguished or under the lit button
feather If above the extinguished half, we look in the extinguished half, otherwise in the burning half.
4. If we have defined not a button, but a group of buttons - goto 3
IMHO it should be pretty fast.
Best regards, Dmitriy.