Page 1 of 1

keyboard ISR in pmode

Posted: Wed Feb 12, 2003 12:00 am
by OSNewbie
hi i have irq1 linked to interrupt 33 for my keyboard isr
right now i just have it output a colored letter in the corner of screen everytime this interrupt is called so i can see how often it is being called. i ran the os and the keyboard interrupt, along with the timer interrupt were each being called frequently. what i am wondering is how to get what data is waiting from the keyboard and how to check if there is more data there or not before i exit the isr. i think it has something to do with ports 60h and 61h but i am not sure exactly how to read/write these.

thanks in advance

RE:keyboard ISR in pmode

Posted: Wed Feb 12, 2003 12:00 am
by jamethiel
Supposedly, it's just a matter of reading port 0x60 to read and acknowledge the data byte.

And that reading is typically accomplished by an IN AL, 60h instruction.

RE:keyboard ISR in pmode

Posted: Thu Feb 13, 2003 12:00 am
by OSNewbie
i have done the in al, 0x60 and i get 0xFA coming from port 0x60 every time the interrupt occurs

i also read somewhere to reset the controller to do the following:

in al, 0x61
mov ah, al
or al, 0x80
out 0x60, al
mov al, ah
out 0x61, al

if i dont do this, then the interrupt only occurs once. if i do this after reading port 0x60 every time the interrupt is run, it continues to be triggered constantly, but every time 0xFA is returned from port 0x60, even when i do not press any keys. if i do press a key, every once in a while a different value is read, but most of the time 0xFA is returned...

RE:keyboard ISR in pmode

Posted: Thu Feb 13, 2003 12:00 am
by jamethiel
Please tell me that the "out 0x60, al" is a typo, and the real code says 0x61. Please?

If it isn't then I wouldn't be at all suprised that you're getting wierd behavior loke that.

RE:keyboard ISR in pmode

Posted: Thu Feb 13, 2003 12:00 am
by OSNewbie
lol sometimes thinking too technically causes me to overlook the obvious ones :) thanks, ill check that on my other computer tomorrow, i'll bet that's it because i copied the code

thanks

if that is it, then is that the entire procedure to acknowledge and clear the keypress?

RE:keyboard ISR in pmode

Posted: Fri Feb 14, 2003 12:00 am
by jamethiel
It should be, yes.