detecting Keyboard in P mode: how do I do it
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
detecting Keyboard in P mode: how do I do it
I am trying to detect keyboard in the protected mode.
I am able to print values that are typed using scan codes but i want to halt the system after grub if the keyboard is not present can any one help.
the error is not thrown if keyboard is unavailable.
I know this is really stupid thing to ask but am missing some thing and cant figure out what .
I am able to print values that are typed using scan codes but i want to halt the system after grub if the keyboard is not present can any one help.
the error is not thrown if keyboard is unavailable.
I know this is really stupid thing to ask but am missing some thing and cant figure out what .
Learning a lot these days THANKS to OSdev users
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
what AlexExtreme said is true.
i want to check if keyboard is plugged in or not in simillar way that the bios does but in pmode.
i have not written the driver as such for key board it just uses scan codes that I have defined to get the key pressed will post it after some changes
i want to check if keyboard is plugged in or not in simillar way that the bios does but in pmode.
i have not written the driver as such for key board it just uses scan codes that I have defined to get the key pressed will post it after some changes
Learning a lot these days THANKS to OSdev users
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
i tried a lot using the following code
I am trying to get the value in c code and then display if the key board is present or not...
but every time its returning garbage value....
pls help
Code: Select all
[GLOBAL keybdpre]
[bits 32]
xor eax,eax;
in al,0x60; // read from key board ctrl staus register
kbdpre:
xor eax,eax;
in al,0x64; // get port status
bt ax,1; // test bit 1 of command register to check if it is set
// and will set carry flag
jc print;
jnc areho;
print: mov ah,0x01
ret
areho: mov ah,0x00
ret
but every time its returning garbage value....
pls help
Last edited by naiksidd_85 on Mon Feb 18, 2008 5:46 am, edited 2 times in total.
Learning a lot these days THANKS to OSdev users
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
Wouldn't "al" still have garbage data in? You clear eax, then set ax = in(0x60), test bit one, then set ah, but al will still have some garbage.
Try:
Try:
Code: Select all
print:
mov ax,0x01
ret
areho:
mov ax,0x00
ret
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
HI all,
the tips that you guys gave was quite helpful but i think i messed up some where the key board is detected...
but i still need to give a input in the buffer to validate .....
I want to know how can i do that without even giving any input....
we used to send a interrupt in real mode but in Pmode am not able to figure it out as I am new to coding and not from Computers Background.
the tips that you guys gave was quite helpful but i think i messed up some where the key board is detected...
but i still need to give a input in the buffer to validate .....
I want to know how can i do that without even giving any input....
we used to send a interrupt in real mode but in Pmode am not able to figure it out as I am new to coding and not from Computers Background.
Learning a lot these days THANKS to OSdev users
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am