How do I get key pressed without INT 16h?

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.
Post Reply
stevewoods1986
Member
Member
Posts: 80
Joined: Wed Aug 09, 2017 7:37 am

How do I get key pressed without INT 16h?

Post by stevewoods1986 »

Hello.

How do I get key pressed without INT 16h on a keyboard? Do I have to communicate with PS/2 and make a keyboard driver? Anyway, how do you communicate? Can you get input or do you have to read the scan codes?

Do I need to know if 0x1E (A) is pressed for example? Do I do something with the

Code: Select all

in
or

Code: Select all

out
instructions?
Yes, I've checked out the PS2_Keyboard page.

I might just experiment.

Any help would be appreciated.

Thanks
Steve.

@Geri I don't accept answers from you. Sorry.
LtG
Member
Member
Posts: 384
Joined: Thu Aug 13, 2015 4:57 pm

Re: How do I get key pressed without INT 16h?

Post by LtG »

There's two ways you get keyboard input:
1) You do it yourself, which means you write drivers. This is the proper solution after boot is done, after which you should not rely on firmware (BIOS/UEFI).
2) Use a "library" to do it for you, BIOS or UEFI.

Since you said you don't want BIOS, then you have to do it yourself.

Check the wiki for PS/2 controller and PS/2 keyboard. They are two different things, so you should make two separate drivers, one for controller and one for keyboard.

A keyboard doesn't really have an "a" key or a "b" (etc) key, it just has keys. In different countries those keys have different labels printed on them. In Windows for example you can easily switch the keyboard layout that Windows uses. So you get the key presses from the keyboard and you map them to what ever you want, for instance "char"'s, but remember that not all keys are printable characters, for instance backspace.

There are also USB keyboards, most (all?) MoBo's support translating USB keyboard into a PS/2, so you don't have to deal with USB. USB is significantly more complex and takes a lot more effort. PS/2 I think is pretty simple, read the wiki and the specs.
Post Reply