keyboard.h

00001 /***************************************************************************
00002                           keyboard.h  -  description
00003                              -------------------
00004     begin                : Fri Dec 26 2003
00005     copyright            : (C) 2003 by Dynacube Team
00006     email                : mdshah82@yahoo.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 /*
00019 ====================================================================
00020 SCANCODES FOR SCANCODE SET 1 (XT)
00021 ====================================================================
00022 US 104-key keyboard, set 1 scancodes
00023 
00024 
00025 "Make" code is generated when key is pressed.
00026 "Break" code is generated when key is released.
00027 Hex value of make code for each key is shown.
00028 
00029 Most keys:
00030         one-byte make code      = nn
00031         one-byte repeat code    = nn
00032         one-byte break code     = 80h + nn
00033 
00034 "Gray" keys (not on original 84-key keyboard):
00035         two-byte make code      = E0nn
00036         two-byte repeat code    = E0nn
00037         two-byte break code     = E0 followed by 80h + nn
00038 
00039 "Gray" keys noted by [1] are NumLock-sensitive.
00040 When the keyboard's internal NumLock is active:
00041         four-byte make code     = E02AE0nn
00042         two-byte repeat code    = E0nn
00043         four-byte break code    = E0 followed by 80h + nn followed by E0AA
00044 
00045  ____    ___________________    ___________________    ___________________
00046 |    |  |    |    |    |    |  |    |    |    |    |  |    |    |    |    |
00047 |Esc |  |F1  |F2  |F3  |F4  |  |F5  |F6  |F7  |F8  |  |F9  |F10 |F11 |F12 |
00048 |    |  |    |    |    |    |  |    |    |    |    |  |    |    |    |    |
00049 |  01|  |  3B|  3C|  3D|  3E|  |  3F|  40|  41|  42|  |  43|  44|  57|  58|
00050 |____|  |____|____|____|____|  |____|____|____|____|  |____|____|____|____|
00051 
00052  __________________________________________________________________________
00053 |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |
00054 |~   |!   |@   |#   |$   |%   |^   |&   |*   |(   |)   |_   |+   ||   |bksp|
00055 |`   |1   |2   |3   |4   |5   |6   |7   |8   |9   |0   |-   |=   |\   |    |
00056 |  29|  02|  03|  04|  05|  06|  07|  08|  09|  0A|  0B|  0C|  0D|  2B|  0E|
00057 |____|____|____|____|____|____|____|____|____|____|____|____|____|____|____|
00058 |    |    |    |    |    |    |    |    |    |    |    |    |    |         |
00059 |Tab |Q   |W   |E   |R   |T   |Y   |U   |I   |O   |P   |{   |}   |         |
00060 |    |    |    |    |    |    |    |    |    |    |    |[   |]   |         |
00061 |  0F|  10|  11|  12|  13|  14|  15|  16|  17|  18|  19|  1A|  1B|         |
00062 |____|____|____|____|____|____|____|____|____|____|____|____|____|         |
00063 |    |    |    |    |    |    |    |    |    |    |    |    |              |
00064 |Caps|A   |S   |D   |F   |G   |H   |J   |K   |L   |:   |"   |     Enter    |
00065 |    |    |    |    |    |    |    |    |    |    |;   |'   |              |
00066 |  3A|  1E|  1F|  20|  21|  22|  23|  24|  25|  26|  27|  28|            1C|
00067 |____|____|____|____|____|____|____|____|____|____|____|____|______________|
00068 |         |    |    |    |    |    |    |    |    |    |    |              |
00069 | L Shift |Z   |X   |C   |V   |B   |N   |M   |<   |>   |?   |   R Shift    |
00070 |         |    |    |    |    |    |    |    |,   |.   |/   |              |
00071 |       2A|  2C|  2D|  2E|  2F|  30|  31|  32|  33|  34|  35|            36|
00072 |_________|____|____|____|____|____|____|____|____|____|____|______________|
00073 |       |       |       |                  |       |       |       |       |
00074 |L Ctrl | L win | L Alt |       space      | R Alt | R win | menu  |R Ctrl |
00075 |       |[1]    |       |                  |       |[1]    |[1]    |       |
00076 |     1D|   E05B|     38|                39|   E038|   E05C|   E05D|   E01D|
00077 |_______|_______|_______|__________________|_______|_______|_______|_______|
00078 
00079 
00080 [2] For PrintScreen/SysRq key: make code = E02AE037,
00081 repeat code = E037, break code = E0B7E0AA
00082 
00083 [3] The Pause/Break key does not repeat, and it does not
00084 generate a break code. Its make code is E11D45E19DC5
00085 
00086  ____ ____ ____
00087 |    |    |    |
00088 |Prt |Scrl|Paus|
00089 |Scrn|Lock|Brk |
00090 | [2]|  46| [3]|
00091 |____|____|____|
00092 
00093  ____ ____ ____   ____ ____ ____ ____
00094 |    |    |    | |    |    |    |    |
00095 |Ins |Home|PgUp| |Num |/   |*   |-   |
00096 |[1] |[1] |[1] | |Lock|    |    |    |
00097 |E052|E047|E049| |  45|E035|  37|  4A|
00098 |____|____|____| |____|____|____|____|
00099 |    |    |    | |    |    |    |    |
00100 |Del |End |PgDn| |7   |8   |9   |    |
00101 |[1] |[1] |[1] | |Home|(U) |PgUp|    |
00102 |E053|E04F|E051| |  47|  48|  49|    |
00103 |____|____|____| |____|____|____|    |
00104                  |    |    |    |+   |
00105                  |4   |5   |6   |    |
00106                  |(L) |    |(R) |    |
00107                  |  4B|  4C|  4D|  4E|
00108       ____       |____|____|____|____|
00109      |    |      |    |    |    |    |
00110      |(U) |      |1   |2   |3   |    |
00111      |[1] |      |End |(D) |PgDn|    |
00112      |E048|      |  4F|  50|  51|Ent |
00113  ____|____|____  |____|____|____|    |
00114 |    |    |    | |         |    |    |
00115 |(L) |(D) |(R) | |0        |.   |    |
00116 |[1] |[1] |[1] | |Ins      |Del |    |
00117 |E04B|E050|E04D| |       52|  53|E01C|
00118 |____|____|____| |_________|____|____|
00119 
00120 
00121 code key        code key        code key        code key
00122 ---- ---        ---- ---        ---- ---        ---- ---
00123 01   Esc        0F   Tab        1D   L Ctrl     2B   \|
00124 02   1!         10   Q          1E   A          2C   Z
00125 03   2"         11   W          1F   S          2D   X
00126 04   3#         12   E          20   D          2E   C
00127 05   4$         13   R          21   F          2F   V
00128 06   5%         14   T          22   G          30   B
00129 07   6^         15   Y          23   H          31   N
00130 08   7&         16   U          24   J          32   M
00131 09   8*         17   I          25   K          33   ,<
00132 0A   9(         18   O          26   L          34   .>
00133 0B   0)         19   P          27   ;:         35   /?
00134 0C   -_         1A   [{         28   '"         36   R Shift
00135 0D   =+         1B   ]}         29   `~         37   *
00136 0E   BackSpace  1C   Enter      2A   L Shift    38   L Alt
00137 
00138 code key        code key        code key        code key
00139 ---- ---        ---- ---        ---- ---        ---- ---
00140 39   Space      41   F7         49   PageUp 9   51   PageDown 3
00141 3A   CapsLock   42   F8         4A   -          52   Insert 0
00142 3B   F1         43   F9         4B   (left) 4   53   Del .
00143 3C   F2         44   F10        4C   5
00144 3D   F3         45   NumLock    4D   (right) 6  57   F11
00145 3E   F4         46   ScrollLock 4E   +          58   F12
00146 3F   F5         47   Home  7    4F   End 1
00147 40   F6         48   (up) 8     50   (down) 2
00148 
00149 
00150 
00151 code            key
00152 ----            ---
00153 E01C            Enter (on numeric keypad)
00154 E01D            R Ctrl
00155 E02A            make code prefix for keyboard internal numlock
00156 E02AE037        PrintScreen make code
00157 E035            /
00158 E037            PrintScreen repeat code
00159 E038            R Alt
00160 E047            Home
00161 E048            (up)
00162 E049            PageUp
00163 E04B            (left)
00164 E04D            (right)
00165 E04F            End
00166 E050            (down)
00167 E051            PageDown
00168 E052            Insert
00169 E053            Del
00170 E05B            L Win
00171 E05C            R Win
00172 E05D            Menu
00173 E0AA            break code suffix for keyboard internal numlock
00174 E0B7E0AA        PrintScreen break code
00175 E11D45E19DC5    Pause
00176 
00177 */
00178 
00179 
00180 #ifndef __KEYBOARD_H
00181 #define __KEYBOARD_H
00182 
00183  #include "common/ktypes.h"
00184 
00185 #define ESC 0x80
00186 #define CTRL 0//(ESC + 1)
00187 #define SHIFT 0 //(ESC + 2)
00188 #define ALT   0//(ESC + 3)
00189 #define CAPS_LOCK 0//(ESC + 4)
00190 #define F1 (ESC+5)
00191 #define F2 (ESC + 6)
00192 #define F3 (ESC + 7)
00193 #define F4 (ESC + 8)
00194 #define F5 (ESC + 9)
00195 #define F6 (ESC + 10)
00196 #define F7 (ESC + 11)
00197 #define F8 (ESC + 12)
00198 #define F9 (ESC + 13)
00199 #define F10 (ESC + 14)
00200 #define F11 (ESC + 15)
00201 #define F12 (ESC + 16)
00202 #define NUM_LOCK (ESC + 17)
00203 #define SCROLL_LOCK (ESC + 18)
00204 #define HOME (ESC + 19)
00205 #define UP (ESC + 20)
00206 #define DOWN (ESC + 21)
00207 #define LEFT_A (ESC + 22)
00208 #define RIGHT_A (ESC + 23)
00209 #define PAGE_UP (ESC + 24)
00210 #define PAGE_DOWN (ESC + 25)
00211 #define INS (ESC + 26)
00212 #define DEL (ESC + 27)
00213 #define END (ESC + 28)
00214 
00215 #define VK_ENTER                        0xA
00216 #define VK_TAB                          0x9
00217 #define VK_BACKSPACE                    0x8
00218 
00219 #define _CTRL_PUSH      0x1D
00220 #define _CTRL_PULL      0x9D
00221 #define _SHIFT_PUSH     0x2A
00222 #define _SHIFT_PULL     0xAA
00223 #define _R_SHIFT_PUSH   0x36
00224 #define _R_SHIFT_PULL   0xB6
00225 #define _ALT_PUSH       0x38
00226 #define _ALT_PULL       0xB8
00227 #define _CAPS_TOGGLE    0x3A
00228 
00229 #define ST_SHIFT  0x1
00230 #define ST_CAPS   (0x1<<1)
00231 #define ST_CNTL   (0x1<<2)
00232 #define ST_ALT    (0x1<<3)
00233 
00234  void handle_KBD();
00235  DB decode(DB);
00236 
00237  extern boolean _ctrl, _alt, _shift, _caps;
00238 #endif

Generated on Thu Jul 27 23:52:26 2006 for Dynacube by  doxygen 1.4.7