Keyboard input...How do I get keys?
Keyboard input...How do I get keys?
Hello, I've just got the itoa function in FritzOS working.
Now, how do I get a key in PMode?
Thank you
Now, how do I get a key in PMode?
Thank you
Re:Keyboard input...How do I get keys?
Basically using port 0x60. see:
http://www.clipx.net/ng/hardware/ng15f80.php
This has been already post at:
http://www.mega-tokyo.com/forum/index.p ... eadid=1460
http://www.mega-tokyo.com/forum/index.p ... eadid=1541
http://www.mega-tokyo.com/forum/index.p ... eadid=1543
Hope it helps
http://www.clipx.net/ng/hardware/ng15f80.php
This has been already post at:
http://www.mega-tokyo.com/forum/index.p ... eadid=1460
http://www.mega-tokyo.com/forum/index.p ... eadid=1541
http://www.mega-tokyo.com/forum/index.p ... eadid=1543
Hope it helps
Re:Keyboard input...How do I get keys?
in my key handeler...
I do
if ( scan >= ' ' )
putch( scan );
and when I type 'a' a * comes out, and so on.
whats wrong?
I do
if ( scan >= ' ' )
putch( scan );
and when I type 'a' a * comes out, and so on.
whats wrong?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard input...How do I get keys?
well, your keyboard does not send ascii codes but SCANCODES instead (which is just numbers associated to the keys). The mapping from scancodes to ascii codes is keyboard-specific (i.e. different on a US keyboard than on a swiss one or french).
However, the repartition of scancodes along the keyboard is always the same (say, [ESC] will always be 1, left arrow is 75, etc.)
so what you have to do is defining
char charmap[]={ SCAN_1:'1','2','3','4', ... , SCAN_Q:'q','w','e','r','t','y' ... };
and then
Code: Select all
if (scan>128) putch(charmap[scan]);
Re:Keyboard input...How do I get keys?
oh, that's what I thought...I was thinking Isn't it ASCII?
Ok, ty
Ok, ty
Re:Keyboard input...How do I get keys?
now I know how to get keys, is there a PMode way of detecting the keyboard scan-code type the user's using?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard input...How do I get keys?
I've seen many ppl in this forum sending something on the 61h port after reading the scancode with in al,60h.
That's something i've never done and my code always worked on real hardware (ranging from i386 to PIII), but when i come to BOCHS, the single "in 60,al" thing hangs the virtual PC after a few keystrokes ...
any clue ?
That's something i've never done and my code always worked on real hardware (ranging from i386 to PIII), but when i come to BOCHS, the single "in 60,al" thing hangs the virtual PC after a few keystrokes ...
any clue ?
Re:Keyboard input...How do I get keys?
Hm...
I've seen the 0x61 stuff also in the MINIX source code, so I use it, too...
I have also some problems with Bochs and IRQ1, but I have no idea what's the problem...Bochs seems to suck
I've seen the 0x61 stuff also in the MINIX source code, so I use it, too...
I have also some problems with Bochs and IRQ1, but I have no idea what's the problem...Bochs seems to suck
Re:Keyboard input...How do I get keys?
char _retchar;
// Non-Shifted:
char asciiNonSh[] = { NULL, ESC, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '\t',
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', NULL, 'a', 's', 'd', 'f', 'g', 'h',
'j', 'k', 'l', ';', '\'', '`', NULL, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', NULL,'*',
NULL, ' ' };
_retchar = asciiNonSh[ scancode ];
and I can't get keys.
whats wrong? ( I am using the US 104 scancode, but have my kernel loading at 4000h without the a20 )
Thank you,
// Non-Shifted:
char asciiNonSh[] = { NULL, ESC, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '\t',
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', NULL, 'a', 's', 'd', 'f', 'g', 'h',
'j', 'k', 'l', ';', '\'', '`', NULL, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', NULL,'*',
NULL, ' ' };
_retchar = asciiNonSh[ scancode ];
and I can't get keys.
whats wrong? ( I am using the US 104 scancode, but have my kernel loading at 4000h without the a20 )
Thank you,
Re:Keyboard input...How do I get keys?
But:
when I do this:
char asciiNonSh[] = { NULL, ESC, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '\t' };
I can get keys.
???
when I do this:
char asciiNonSh[] = { NULL, ESC, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '\t' };
I can get keys.
???
Re:Keyboard input...How do I get keys?
i'm also having the same trouble, i can make a list of all the scancodes and if else if else if else then all, but i wanted to do the char array. I saw it somewhere once, but i couldn't figure out how it worked.
So basically,
you take your scanCode, put it into the array and it shold figure it out for you??
???
lost! heh. Does it actualyl know which one equals what?
thanks in advanced. And Tom, i hope you get this working cause your OS is really shippin up
So basically,
you take your scanCode, put it into the array and it shold figure it out for you??
???
lost! heh. Does it actualyl know which one equals what?
thanks in advanced. And Tom, i hope you get this working cause your OS is really shippin up
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Keyboard input...How do I get keys?
i think you should *not* use NULL in your table as this is a void* (and thus it will not fit in a char array ... compiling with -Wall will certainly confirm this). try using '\0' instead ...
Re:Keyboard input...How do I get keys?
nope, didn't work. I run out of space I think after I put w in.