home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 2 / CDPD_II_2352.bin / scope / 176-200 / scopedisk191 / lightpen / readme < prev    next >
Text File  |  1992-10-27  |  4KB  |  111 lines

  1.                              Lightpen-Handler
  2.                  ================
  3.  
  4.                  © Copyright by Andreas Klingler 1988,1991
  5.  
  6. This  program is freely distributable but is NOT public domain.  It MAY NOT
  7. be  included  in  any  commercial  package, or sold for ANY amount, without
  8. written  permission  from  the  author.   However if may be included on any
  9. freely  distributable  package,  including  packages  for  which  a nominal
  10. copying fee of no more than $5 is charged, as long as this copyright notice
  11. keeps intact.
  12. This software is distributed as-is, without any warranty.
  13. Don`t blame me for any trouble this gets you into.
  14.  
  15. What`s it all about?
  16. --------------------
  17.  
  18. Every  Amiga  has a hardware build in to connect a lightpen to it.  However
  19. this  feature  is  rarely  used,  so I decided to write a software to use a
  20. lightpen  just  like  you  use the mouse.  You even can use the mouse and a
  21. lightpen  simultaniously and your applications don`t notice any difference.
  22. Unfortunately  the  resolution  of the light pen registers is not very high
  23. (vertical 1 non-interlaced scan line, horizontal 2 low-res pixels), but for
  24. normal menu selections and gadget pressing it is more than sufficient.
  25.  
  26. Files in the distribution:
  27.  
  28.         README    - Guess what? You are reading this!
  29.         lp    - Ready to go code
  30.         lp.info - Yes, you can start it from workbench, too
  31.         lp.c    - SAS/C source
  32.         makefile- for SAS/C LMK
  33.  
  34.  
  35. To use the handler
  36.  
  37. just plug in your lightpen in
  38.         Joyport 1 (the right one) on an A2000
  39.         Joyport 0 (the front one) on an A1000
  40. and start the program from CLI or Workbench (you don`t need to RUN it).  To
  41. remove  the  handler  just  run  it again.  If you start it from the CLI it
  42. gives some output on what`s going on.  KS 2.0 should be no problem.  As you
  43. may have noticed there is a difference between the A1000 and the A2000 (and
  44. the other Amigas?):  On the A1000 you have to plug the lightpen in the same
  45. port  the  mouse  goes.  To be still able to use the mouse you should first
  46. run a program which attaches the mouse to the other port.
  47. (However buttonsupport is hardwired for port1, but you can change it
  48. to port0 in the source)
  49.  
  50.  
  51. The  lightpenhandler  is  done as an InputEvent-Handler. It links into the
  52. InputEvent  stream  just  ahead  of  Intuition.  This might not be the best
  53. choice  (normaly  an interrupt-handler would be the way to do such things),
  54. but  as  I  had  to  generate  some InputEvents anyway, and there is a good
  55. example of an InputEvent-Handler in the RKMs I took this way.  We just link
  56. our  faked mouse events at the end of each bypassing input event chain.  We
  57. can`t starve here, because at least every 1/10 sec.  there is a timer event
  58. to which we can link.
  59.  
  60.  
  61. Of  course  for  the  hardware you are on your own, but I will give a short
  62. description  how  to  make  a  *very*  simple  lightpen.   If there is some
  63. hardware guy outthere who has a good and simple solution and likes to share
  64. it:  feel free to mail it to me!
  65.  
  66. On every Amiga one of the joystick/mouse ports as an input to support
  67. a lightpen. Unfortunately the line used for the beam trigger (6) is the same
  68. which is normaly used as the left mousebutton. So to emulate the
  69. mousebuttons I had to use other lines:
  70.  
  71.  
  72.             Pin 3     left penbutton
  73.                 4    right penbutton
  74.                 5    pen pressed to screen (not used here)
  75.                 6    capture beam position
  76.                 7    +5V (125 mA)
  77.                 8    GND
  78.  
  79. The beam counter is triggered by pulling pin 6 to ground.
  80. For a simple start try the following circuit:
  81. (I don`t feel responsible for any damage this might do to your computer!)
  82.  
  83.    ------------------------------------ 7 (+5V)
  84.    |
  85.   | |
  86.   | | 5k6
  87.    | 
  88.    |__________________________________ 6 Beam
  89.  |/ 
  90.  |\ BPX 81 (Phototransistor)
  91.    |
  92.    |
  93.    ------------------------------------ 8 GND
  94.  
  95. For the buttons you need some switches which connect the appropriate pin
  96. to ground when you press them.
  97.  
  98. This works only for very bright areas on the screen. You might also want to
  99. try to hack-up one of these cheap C64 lightpens.
  100.  
  101.  
  102.  
  103. Have fun with it!
  104.  
  105. Andreas Klingler
  106. Koehlerstrasse 12
  107. 8551 Hemhofen
  108. Germany
  109. FAX: +49 9195 3730
  110. EMail: asklingl@informatik.uni-erlangen.de
  111.