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]
Keyboard in Protected Mode
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard in Protected Mode
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
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
What's the inb function doing?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
Hello world!
Re: Keyboard in Protected Mode
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
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
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
viewtopic.php?f=1&t=16944
-thomtl
- MichaelFarthing
- Member
- Posts: 167
- Joined: Thu Mar 10, 2016 7:35 am
- Location: Lancaster, England, Disunited Kingdom
Re: Keyboard in Protected Mode
Well let's consider one of those rules:
That proper behaviour has been rewarded with two put downs.
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.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.
That proper behaviour has been rewarded with two put downs.
Re: Keyboard in Protected Mode
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.
I agree with the "put downs" - bumping a seventeen-year old thread is not good practice. If necessary start a new thread.