home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / pascal / 6717 < prev    next >
Encoding:
Text File  |  1992-11-19  |  1.5 KB  |  41 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!mcsun!news.funet.fi!cs.joensuu.fi!jpehko
  3. From: jpehko@cs.joensuu.fi (Juha Pehkonen)
  4. Subject: Re: HOW DO YOU READ MORE THAN ONE KEY
  5. Message-ID: <1992Nov19.100442.2914@cs.joensuu.fi>
  6. Organization: University of Joensuu
  7. References: <1992Nov19.025936.35994@ns1.cc.lehigh.edu>
  8. Date: Thu, 19 Nov 1992 10:04:42 GMT
  9. Lines: 30
  10.  
  11. mas4@ns1.cc.lehigh.edu (MICHAEL ANTHONY STRAUSS) writes:
  12. >I'm currently writing a program on Turbo 6.0 that requires more than one key
  13. >to be read at once.  Does anyone out there know how to do this.  Any code or
  14. >suggestions would be appreciated.  Thanx in advance...
  15.  
  16. Just forget about it :-) But seriously, if you're talking about reading
  17. multiple keypresses at the same time, then you should try Port-function.
  18. Don't try to find it with Ctrl-F1 'cause it's not there. Write a short
  19. program like this:
  20.  
  21. begin
  22.  repeat
  23.   write(Port[$20]);
  24.  until (1=2); 
  25. end; 
  26.  
  27. Yep, it's quick'n dirty but it does the job. Press down keys and watch the
  28. output change. Everytime you press/release a key new code is 'sent' to
  29. port $20. You probably got 102 keys in your keyboard, so there are 204
  30. different codes (or so one would assume :-). All you have to do is find
  31. out which is which. The codes are not ASCII codes. If I'm not totally
  32. wrong, you get code 1 when you press Esc, code 2 when you press F1, etc.
  33.  
  34. You can use boolean variables (or boolean arrays) to determine which keys
  35. are pressed down. The rest should be rather TRIVIAL. If not, sue me (or use
  36. e-mail :-)
  37.  
  38. Juha Pehkonen
  39. jpehko@cs.joensuu.fi
  40.  
  41.