Scancodes/time

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Gordon

Scancodes/time

Post 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
Gnome

RE:Scancodes/time

Post 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?
Gordon

RE:Scancodes/time

Post by Gordon »

Alright thanks..

yes I do...
Post Reply