home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / coherent / 6324 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  2.6 KB

  1. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!rphroy!caen!batcomputer!cornell!uw-beaver!uw-coco!mdisea!mdivax1!van-bc!rwsys!root
  2. From: root@rwsys.wimsey.bc.ca (Superuser)
  3. Newsgroups: comp.os.coherent
  4. Subject: Re: game port driver code?
  5. Message-ID: <92121815346@rwsys.wimsey.bc.ca>
  6. Date: 20 Dec 92 04:16:45 GMT
  7. References: <1992Dec11.205204.14437@sequent.com>
  8. Organization: RWSYS Exporter BBS system
  9. Lines: 48
  10.  
  11. patbob@sequent.com (Patrick White) writes:
  12. >     Does anyone have any code for reading joysticks from the gameport under
  13. > Coherent?  A device driver or program code would be fine.
  14. >     I've got info on what needs to be done and don't want to reimplement it
  15. > if I can avoid it.  Any ideas on how to implement it would be welcome too (eg.
  16. > how to turn off task switching while in the busy wait loop, timers and the ilk
  17. > I might be able to use, more efficient ways to access the I/O port than
  18. > /dev/kmem, etc.)
  19. >     If I decide it's too much for me to do, I'll summarize if there is
  20. > interest.
  21. > thanks,
  22. > Pat White (patbob)
  23. > -- 
  24. > Pat White (patbob@sequent.com, work: (503) 578-3463)
  25. You will need a device driver. You can't create a dos-style event loop
  26. that reads the hardware and then loops again because application (user)
  27. level software is 'protected' and cannot read/write directly to hardware.
  28.  
  29. The DDK allows a device driver to use the timeout() function with
  30. 10 millisec granularity. Or you can sit in an event loop in a device
  31. driver ( but it really makes the device driver useless if any sort
  32. of multitasking or multiuser stuff is needed. It could also screw
  33. up things like serial port access and disk drive access to monopolize
  34. the processor in an event loop. )
  35.  
  36. The physical operation of the game port ( ibm version ) is so simple
  37. that a device driver should be easy to write.  According to my
  38. literature, all you have to do is write to 0x201 and then keep
  39. checking back for the the amount of elapsed time before the bit
  40. corresponding to the joystick goes low.
  41.  
  42. The only possible problem is coherent's 10 millisec granularity. If
  43. it is too long, the read_t0() function can offer shorter timing
  44. but at the cost of a bit more complexity.
  45.  
  46. One way or another, however, you'll need the DDK.
  47. Randy Wright
  48.  
  49. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  50. root@rwsys.wimsey.bc.ca (Randy Wright)      | Exporter BBS     2400 bps
  51.                 or                          | (604) 581-0518     8N1
  52.     Randy_Wright@Mindlink.bc.ca             | uucp         ogin: uguest
  53.                                             | interactive login: guest
  54. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  55.