[comp.sys.ibm.pc] Need help on how to access IBM-PC/AT keyboard

jmoore@pc.ecn.purdue.edu.UUCP (01/16/87)

[MUNCH ....... MUNCH ......... MUNCH .......... MUNCH ...... BURP !!]



I have been asked to look into a particular task that is to be
conducted on an IBM-PC AT and was hoping I could get some help
from the netlanders.

I need some information and hints (code would also be accepted)
on how to access or receive information from the keyboard of an
AT computer. Here is a description of the problem we are trying
to address. 

We would like to conduct a study of the number of keystrokes
that are needed for using specific editors. The study requires
that we time the period between keystrokes, the actual keys that
have been typed and record them to disk. From all of the 
information that I have been able to come up with (mainly dealing
with PC and XT computers) this is going to be a problem since 
the keyboard has its own processor that is not accessable. I have
also thought of one problem that one may run into. If the system
is busy how do you deal with buffered characters. I understand
that the AT may be fast enough to not have a problem with this
but I am not sure how to deal with it.

I would appreciate some input on this and some code if you or 
someone you may know has developed such. Also any references
to books or articles that have information that may be helpful
would be appreciated. Thanks.



Jim Moore
(jmoore@gb.ecn.purdue.edu)


Purdue University
Industrial Engineering Department
W. Lafayette, In.
(317)494-2686

dalegass@dalcs.UUCP (Dale Gass) (01/20/87)

In article <696@pc.ecn.purdue.edu.UUCP>, jmoore@pc.ecn.purdue.edu.UUCP writes:
> I need some information and hints (code would also be accepted)
> on how to access or receive information from the keyboard of an
> IBM-PC/AT.

> We would like to conduct a study of the number of keystrokes
> that are needed for using specific editors. The study requires
> that we time the period between keystrokes, the actual keys that
> have been typed and record them to disk. From all of the 

Although the Keyboard does have its own processor, it doesn't do buffering
of its own--every time a key is struck, and interrupt is sent to the PC
which services the keyboard input (interrupt 9, I believe.)  This interrupt
reads from the keyboard port, decodes the key, and stores it in a buffer
at segment 40h.

By writing another interrupt routine which performs a tally of strokes, and
then jumps to the old interrupt service routine, you can effectively
have your routine called at every keystroke.

Regarding the timing between keystrokes: there is an interrupt (1Ch) that
is called at every clock tick.  This routine is usually pointed to a
IRET instruction and does nothing.  By using this routine to increment
a count somewhere in memory, and having the keyboard interrupt store away
this count and then reset it to zero, you can, in effect, time the
distance between keystrokes.

I hope this was of some help...


***************************************************************************
Dale Gass, Dalhousie U., Halifax, N.S., Canada

UUCP:   {seismo|watmath|utai|garfield}!dalcs!dalegass.UUCP
     				       or dalegass@dalcs.UUCP
        ...!dalcs!dalcsug!dalegass.UUCP  or dalegass@dalcsug.UUCP
CDN:    dalegass@cs.dal.cdn
CSNET:  dalegass%cs.dal.cdn@ubc.csnet
ARPA:   dalegass%cs.dal.cdn%ubc.csnet@CSNET-RELAY.ARPA