keycodes are 32-bit integers. the low byte indicates the key itself. for printable characters (and keys with reasonable translations to ascii control codes), this is the ascii code. for other ones, something in the range of 0x80 to 0xef is used, seen in table 1. the top 24 bits indicate several flags. these are seen in table 2, where bit 0 is the lowest bit of the second lowest byte of the keycode, and bit 23 is the highest bit of the highest byte of the keycode. the "get key" system call returns 0 if there is not a key available. it is recommended to make the system call and, if it returns 0, yield to the scheduler and then loop back to making the system call. this way your task does not block the cpu while waiting for keyboard input. see the "get_key_char" function in user.c of the "knob" library for an example of this. table 1: code | key ------|--------------- 0x80 | caps lock 0x81 | insert 0x82 | num lock 0x83 | scroll lock 0x84 | left shift 0x85 | right shift 0x86 | left alt 0x87 | right alt 0x88 | left control 0x89 | right control 0x8a | left meta 0x8b | right meta 0x8c | reserved .... | reserved 0x97 | reserved 0x98 | unassigned .... | unassigned 0x9f | unassigned 0xa0 | F1 0xa1 | F2 0xa2 | F3 0xa3 | F4 0xa4 | F5 0xa5 | F6 0xa6 | F7 0xa7 | F8 0xa8 | F9 0xa9 | F10 0xaa | F11 0xab | F12 0xac | unassigned .... | unassigned 0xaf | unassigned 0xb0 | numpad 0 0xb1 | numpad 1 0xb2 | numpad 2 0xb3 | numpad 3 0xb4 | numpad 4 0xb5 | numpad 5 0xb6 | numpad 6 0xb7 | numpad 7 0xb8 | numpad 8 0xb9 | numpad 9 0xba | numpad * 0xbb | numpad + 0xbc | numpad Enter 0xbd | numpad - 0xbe | numpad . 0xbf | numpad / 0xc0 | unassigned 0xc1 | delete 0xc2 | home 0xc3 | end 0xc4 | page up 0xc5 | page down 0xc6 | up 0xc7 | down 0xc8 | left 0xc9 | right 0xca | escape 0xcb | menu 0xcc | pause 0xcd | print screen 0xce | unassigned .... | unassigned 0xef | unassigned table 2: bit 0: left shift bit 1: right shift bit 2: caps lock bit 3: insert bit 4: num lock bit 5: scroll lock bit 6: left alt bit 7: right alt bit 8: left control bit 9: right control bit 10: left meta bit 11: right meta bits 12-23 are reserved for future versions. in this version, they should be set to zero when giving a keycode, and should be ignored when recieving a keycode.