OSDev.org
https://forum.osdev.org/

Keyboard in Protected Mode
https://forum.osdev.org/viewtopic.php?f=1&t=6905
Page 1 of 1

Author:  kernel [ Thu Aug 01, 2002 11:44 am ]
Post subject:  Keyboard in Protected Mode

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]

Author:  Pype.Clicker [ Thu Aug 01, 2002 2:04 pm ]
Post subject:  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

Author:  xSlendiX [ Fri Jan 11, 2019 4:39 am ]
Post subject:  Re: Re:Keyboard in Protected Mode

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?

Author:  zity [ Fri Jan 11, 2019 5:24 am ]
Post subject:  Re: Keyboard in Protected Mode

Reviving a 17 year old post? :shock:

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

Author:  thomtl [ Fri Jan 11, 2019 11:07 am ]
Post subject:  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

Author:  MichaelFarthing [ Fri Jan 11, 2019 1:01 pm ]
Post subject:  Re: Keyboard in Protected Mode

Well let's consider one of those rules:

Quote:
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.

Author:  iansjack [ Fri Jan 11, 2019 1:22 pm ]
Post subject:  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.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/