Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What are all of the ports for keyboard i/o?

Status
Not open for further replies.

CubeE101

Programmer
Nov 19, 2002
1,492
0
0
US
I know most (if not all) scan codes come through Port 96...
(right?)

But what about the windows keys, and the extra multi media keys...???

Does any one know what port these keys come through?

Or is there a Windows DLL that exculsively handles these???

I want to be able to trap these keys with a port without usuing any windows DLLs...

Is this possible?

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif

 
Yes it is possible. But you must bypass windows protection (especially NT based). In order to do that you must create your own virtual driver (SYS for NT, VXD for Win9X/ME).

About the port itself you can see it from Device Manager and look for I/O Resources.

Regards

-- AirCon --
 
If you are in Windows, the best way to trap keys is not by using ports but by using a DLL. Writing a DLL for handling these is probably more easier anyway.

However, there are several ports for the keyboard depending on what you want to do. To fetch key scan codes, you use port 96 (60h hex). To set the LEDs on the keyboard and fix typematic rates etc. you use port 64h. To enable/disable the keyboard you need to set bit 7 (0=enable,1=disable) and out to port 61h.
Direct use of these ports doesn't work in Windows, unless via a DOS prompt in a DOS binary file, but that restricts it to only that DOS prompt.

About the extra keys...
The problem existed when the keyboard was first extended to include new keys (as standard now). The right alt,ctrl and additional insert,delete,home,end keys and a few others send two keyscan codes when they are pressed. The first for all of them is 0E0h ('E' for extended perhaps...), and the second actually identifies the key. For example:
Code:
   right alt  = 0E0h 38h
   right ctrl = 0E0h 1Dh
I am sure that the other keys work in the same way, but cannot confirm any scancode values.

It depends on what you actually need this keyboard handling for, but I suspect that a DLL is the way to go. I have written a DLL for trapping keys before if you need any help.
:)


The mind is like a parachute - it works better when open...
 
adholioshake

Direct use of these ports doesn't work in Windows

Nope, You can make it works. Please read my reply :)


-- AirCon --
 
(I know it can be done, but it is harder and would suggest not doing it)
But if you have coded system drivers and stuff like that it would be interesting...:)

Thanx for the correction Aircon.


The mind is like a parachute - it works better when open...
 
I know it can be done, but it is harder and would suggest not doing it
Ahh..I get what you mean now :)

If you want to see the example, go to:

Search for Kernel Kit (for NT) by Four-F. Coded for MASM but you can make it work for other Asm too (I think).

Also you can search for Windows DDK on MS site

Regards

-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top