keyboard ?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: keyboard ?

Post by Combuster »

I am running into the problem of also not knowning if somebody pushed the same button twice or if I am just reading it to fast from port 0x60.
Does it make sense if the controller tells you that a button was pressed down multiple times without being released? :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Selenic
Member
Member
Posts: 123
Joined: Sat Jan 23, 2010 2:56 pm

Re: keyboard ?

Post by Selenic »

Combuster wrote:
I am running into the problem of also not knowning if somebody pushed the same button twice or if I am just reading it to fast from port 0x60.
Does it make sense if the controller tells you that a button was pressed down multiple times without being released? :wink:
I seem to remember Bochs sending multiple keydown events without a keyup, if you kept the key held, but that might be due to the Windows' key-repeat rather than due to anything Bochs-related.
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: keyboard ?

Post by neon »

Hello,

The "key repeat" isnt a Windows thing; its a feature on the keyboard controller (Command 0xF3 - Set Autorepeat delay and repeat rate.) Because Bochs emulates the hardware, it also emulates this functionality.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: keyboard ?

Post by Gigasoft »

Is their someway I can check if a new key was pressed before I start reading from port 0x60 for the scancode for it. I am running into the problem of also not knowning if somebody pushed the same button twice or if I am just reading it to fast from port 0x60.
To determine whether a new byte has been received, you read port 64h and check bit 0. Bit 5 then tells you if the byte was from the mouse port or the keyboard port.
Post Reply