Page 1 of 1

Scancodes/time

Posted: Tue Jun 29, 2004 11:00 pm
by Gordon
I have two really important questions, been stuck for a while now..
first of all.. how do I convert scancodes recieved from the keyboard (port 0x60) to "normal" characters... So I can write some nice stuff..

The second thing is, how do I get the system time? I want to do it in C (using DJGPP), mabye inline asm.. so far I´ve done:
        out(0x70,0x4);
        char hours = in(0x71);
        
        out(0x70,0x2);
        char minutes = in(0x71);
        
        out(0x70,0x0);
        char seconds = in(0x71);
But I need to know more and to convert that into local time

RE:Scancodes/time

Posted: Tue Jun 29, 2004 11:00 pm
by Gnome
Both questions are trivial.

1) A keymap. Each scancode maps to a button on the keyboard. You need to map that to the cap that's on top of the key. Remember to clear bit 7 before doing the conversion. That bit signifies whether the key is pressed or released. Then, it's just a matter of looking up the scancode in an array that stores the character mapping for that scancode. Obviously, some keys do not have such a mapping (shift, for example), and you'll have to handle those seperately.

2) Umm... you know what time zone the person is in, right?

RE:Scancodes/time

Posted: Wed Jun 30, 2004 11:00 pm
by Gordon
Alright thanks..

yes I do...