Page 1 of 1
Keyboard in Protected Mode
Posted: Thu Aug 01, 2002 11:44 am
by kernel
I'm moving from real mode ;D to protected mode, but My procedure I used in rmode for detecting keypresses won't work in pmode because it uses interrupts! How do I get keyboard input in protected mode? (i sure hope it doesn't involve v86 mode or programming the PIC
)
[glow=red,2,300]Thanx[/glow]
Re:Keyboard in Protected Mode
Posted: Thu Aug 01, 2002 2:04 pm
by Pype.Clicker
well, the most basic technique you can do is polling the 0x60 port for new datas:
char waitkey()
{ char k;
while ((k=inb(0x60))<128);
while (inb(0x60)>128);
}
Otherwise, you'll have to remap the interrupt vectors of 8259a to avoid collision with pmode exception and then ... you're back in terra cognita
sample code for 8259a re-programming can be found in my SOS system
here
Re: Re:Keyboard in Protected Mode
Posted: Fri Jan 11, 2019 4:39 am
by xSlendiX
Pype.Clicker wrote:well, the most basic technique you can do is polling the 0x60 port for new datas:
char waitkey()
{ char k;
while ((k=inb(0x60))<128);
while (inb(0x60)>128);
}
Otherwise, you'll have to remap the interrupt vectors of 8259a to avoid collision with pmode exception and then ... you're back in terra cognita
sample code for 8259a re-programming can be found in my SOS system
here
What's the inb function doing?
Re: Keyboard in Protected Mode
Posted: Fri Jan 11, 2019 5:24 am
by zity
Reviving a 17 year old post?
The inb function reads a byte from an I/O port. It is an assembly instruction, have look in the wiki to see how it can be used from C:
https://wiki.osdev.org/Inline_Assembly/ ... 2FO_access
Re: Keyboard in Protected Mode
Posted: Fri Jan 11, 2019 11:07 am
by thomtl
Please don't bump old posts, especially posts from almost 17 years ago. I'll assume you haven't been on a lot of forums, so please read the forum rules so this won't happen again
viewtopic.php?f=1&t=16944
-thomtl
Re: Keyboard in Protected Mode
Posted: Fri Jan 11, 2019 1:01 pm
by MichaelFarthing
Well let's consider one of those rules:
The Official Forum Rules
1: Please try not to ask answered questions.
Many questions have been asked, and many have been answered. Before you post it's a very good idea to search the forum, the wiki, and even the entire web.
Strikes me that is exactly what has been done here. The answer sought for and found didn't quite answer everything and clarification was sought.
That proper behaviour has been rewarded with two put downs.
Re: Keyboard in Protected Mode
Posted: Fri Jan 11, 2019 1:22 pm
by iansjack
You're ignoring the fact that the simplest of searches (Google "inb function") will give a wealth of results showing exactly what the function does.
I agree with the "put downs" - bumping a seventeen-year old thread is not good practice. If necessary start a new thread.