home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
508.lha
/
lightpen_v1.1
/
README.pp
/
README
Wrap
Text File
|
1991-05-06
|
4KB
|
111 lines
Lightpen-Handler
================
(c) Copyright by Andreas Klingler 1988,1991
This program is freely distributable but is NOT public domain. It MAY NOT
be included in any commercial package, or sold for ANY amount, without
written permission from the author. However if may be included on any
freely distributable package, including packages for which a nominal
copying fee of no more than $5 is charged, as long as this copyright notice
keeps intact.
This software is distributed as-is, without any warranty.
Don`t blame me for any trouble this gets you into.
What`s it all about?
--------------------
Every Amiga has a hardware build in to connect a lightpen to it. However
this feature is rarely used, so I decided to write a software to use a
lightpen just like you use the mouse. You even can use the mouse and a
lightpen simultaniously and your applications don`t notice any difference.
Unfortunately the resolution of the light pen registers is not very high
(vertical 1 non-interlaced scan line, horizontal 2 low-res pixels), but for
normal menu selections and gadget pressing it is more than sufficient.
Files in the distribution:
README - Guess what? You are reading this!
lp - Ready to go code
lp.info - Yes, you can start it from workbench, too
lp.c - SAS/C source
makefile- for SAS/C LMK
To use the handler
just plug in your lightpen in
Joyport 1 (the right one) on an A2000
Joyport 0 (the front one) on an A1000
and start the program from CLI or Workbench (you don`t need to RUN it). To
remove the handler just run it again. If you start it from the CLI it
gives some output on what`s going on. KS 2.0 should be no problem. As you
may have noticed there is a difference between the A1000 and the A2000 (and
the other Amigas?): On the A1000 you have to plug the lightpen in the same
port the mouse goes. To be still able to use the mouse you should first
run a program which attaches the mouse to the other port.
(However buttonsupport is hardwired for port1, but you can change it
to port0 in the source)
The lightpenhandler is done as an InputEvent-Handler. It links into the
InputEvent stream just ahead of Intuition. This might not be the best
choice (normaly an interrupt-handler would be the way to do such things),
but as I had to generate some InputEvents anyway, and there is a good
example of an InputEvent-Handler in the RKMs I took this way. We just link
our faked mouse events at the end of each bypassing input event chain. We
can`t starve here, because at least every 1/10 sec. there is a timer event
to which we can link.
Of course for the hardware you are on your own, but I will give a short
description how to make a *very* simple lightpen. If there is some
hardware guy outthere who has a good and simple solution and likes to share
it: feel free to mail it to me!
On every Amiga one of the joystick/mouse ports as an input to support
a lightpen. Unfortunately the line used for the beam trigger (6) is the same
which is normaly used as the left mousebutton. So to emulate the
mousebuttons I had to use other lines:
Pin 3 left penbutton
4 right penbutton
5 pen pressed to screen (not used here)
6 capture beam position
7 +5V (125 mA)
8 GND
The beam counter is triggered by pulling pin 6 to ground.
For a simple start try the following circuit:
(I don`t feel responsible for any damage this might do to your computer!)
------------------------------------ 7 (+5V)
|
| |
| | 5k6
|
|__________________________________ 6 Beam
|/
|\ BPX 81 (Phototransistor)
|
|
------------------------------------ 8 GND
For the buttons you need some switches which connect the appropriate pin
to ground when you press them.
This works only for very bright areas on the screen. You might also want to
try to hack-up one of these cheap C64 lightpens.
Have fun with it!
Andreas Klingler
Koehlerstrasse 12
8551 Hemhofen
Germany
FAX: +49 9195 3730
EMail: asklingl@informatik.uni-erlangen.de