xref: /netbsd-src/sys/arch/macppc/include/keyboard.h (revision 0659c2f915c4d37717b31e4dfb53650ac89cb354)
1*0659c2f9Shamajima /*	$NetBSD: keyboard.h,v 1.5 2003/06/11 07:35:40 hamajima Exp $	*/
22be6df07Stsubai 
32be6df07Stsubai /*-
42be6df07Stsubai  * Copyright (C) 1993	Allen K. Briggs, Chris P. Caputo,
52be6df07Stsubai  *			Michael L. Finch, Bradley A. Grantham, and
62be6df07Stsubai  *			Lawrence A. Kesteloot
72be6df07Stsubai  * All rights reserved.
82be6df07Stsubai  *
92be6df07Stsubai  * Redistribution and use in source and binary forms, with or without
102be6df07Stsubai  * modification, are permitted provided that the following conditions
112be6df07Stsubai  * are met:
122be6df07Stsubai  * 1. Redistributions of source code must retain the above copyright
132be6df07Stsubai  *    notice, this list of conditions and the following disclaimer.
142be6df07Stsubai  * 2. Redistributions in binary form must reproduce the above copyright
152be6df07Stsubai  *    notice, this list of conditions and the following disclaimer in the
162be6df07Stsubai  *    documentation and/or other materials provided with the distribution.
172be6df07Stsubai  * 3. All advertising materials mentioning features or use of this software
182be6df07Stsubai  *    must display the following acknowledgement:
192be6df07Stsubai  *	This product includes software developed by the Alice Group.
202be6df07Stsubai  * 4. The names of the Alice Group or any of its members may not be used
212be6df07Stsubai  *    to endorse or promote products derived from this software without
222be6df07Stsubai  *    specific prior written permission.
232be6df07Stsubai  *
242be6df07Stsubai  * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
252be6df07Stsubai  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
262be6df07Stsubai  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
272be6df07Stsubai  * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
282be6df07Stsubai  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
292be6df07Stsubai  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
302be6df07Stsubai  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
312be6df07Stsubai  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
322be6df07Stsubai  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
332be6df07Stsubai  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
342be6df07Stsubai  */
352be6df07Stsubai 
362be6df07Stsubai #define ADBK_LEFT	0x3B
372be6df07Stsubai #define ADBK_RIGHT	0x3C
382be6df07Stsubai #define ADBK_UP		0x3E
392be6df07Stsubai #define ADBK_DOWN	0x3D
402be6df07Stsubai #define ADBK_PGUP	0x74
412be6df07Stsubai #define ADBK_PGDN	0x79
422be6df07Stsubai #define ADBK_HOME	0x73
432be6df07Stsubai #define ADBK_END	0x77
442be6df07Stsubai #define ADBK_CONTROL	0x36
452be6df07Stsubai #define ADBK_FLOWER	0x37
462be6df07Stsubai #define ADBK_SHIFT	0x38
472be6df07Stsubai #define ADBK_CAPSLOCK	0x39
482be6df07Stsubai #define ADBK_OPTION	0x3A
492be6df07Stsubai #define ADBK_F		0x03
502be6df07Stsubai #define ADBK_O		0x1F
512be6df07Stsubai #define ADBK_P		0x23
522be6df07Stsubai #define ADBK_Q		0x0C
532be6df07Stsubai #define ADBK_V		0x09
542be6df07Stsubai #define ADBK_1		0x12
552be6df07Stsubai #define ADBK_2		0x13
562be6df07Stsubai #define ADBK_3		0x14
572be6df07Stsubai #define ADBK_4		0x15
582be6df07Stsubai #define ADBK_5		0x17
592be6df07Stsubai #define ADBK_6		0x16
602be6df07Stsubai #define ADBK_7		0x1A
612be6df07Stsubai #define ADBK_8		0x1C
622be6df07Stsubai #define ADBK_9		0x19
632be6df07Stsubai #define ADBK_0		0x1D
642be6df07Stsubai 
652be6df07Stsubai #define ADBK_KEYVAL(key)	((key) & 0x7f)
662be6df07Stsubai #define ADBK_PRESS(key)		(((key) & 0x80) == 0)
672be6df07Stsubai #define ADBK_KEYDOWN(key)	(key)
682be6df07Stsubai #define ADBK_KEYUP(key)		((key) | 0x80)
692be6df07Stsubai #define ADBK_MODIFIER(key)	((((key) & 0x7f) == ADBK_SHIFT) || \
702be6df07Stsubai 				 (((key) & 0x7f) == ADBK_CONTROL) || \
712be6df07Stsubai 				 (((key) & 0x7f) == ADBK_FLOWER) || \
722be6df07Stsubai 				 (((key) & 0x7f) == ADBK_OPTION))
732be6df07Stsubai 
742be6df07Stsubai #ifndef KEYBOARD_ARRAY
759e10bd87Saymeric extern unsigned char keyboard[128][4];
762be6df07Stsubai #else
779e10bd87Saymeric unsigned char keyboard[128][4] = {
789e10bd87Saymeric 	  /* Scan code      Normal     Shifted     Controlled   XT */
799e10bd87Saymeric 	{ /*   0x00, */       'a',       'A',         0x01,	 30 },
809e10bd87Saymeric 	{ /*   0x01, */       's',       'S',         0x13,	 31 },
819e10bd87Saymeric 	{ /*   0x02, */       'd',       'D',         0x04,	 32 },
829e10bd87Saymeric 	{ /*   0x03, */       'f',       'F',         0x06,	 33 },
839e10bd87Saymeric 	{ /*   0x04, */       'h',       'H',         0x08,	 35 },
849e10bd87Saymeric 	{ /*   0x05, */       'g',       'G',         0x07,	 34 },
859e10bd87Saymeric 	{ /*   0x06, */       'z',       'Z',         0x1A,	 44 },
869e10bd87Saymeric 	{ /*   0x07, */       'x',       'X',         0x18,	 45 },
879e10bd87Saymeric 	{ /*   0x08, */       'c',       'C',         0x03,	 46 },
889e10bd87Saymeric 	{ /*   0x09, */       'v',       'V',         0x16,	 47 },
899e10bd87Saymeric #ifdef FIX_SV_X_KBDBUG
909e10bd87Saymeric 	{ /*   0x0A, */      0x00,      0x00,         0x00,	 41 },
919e10bd87Saymeric #else
929e10bd87Saymeric 	{ /*   0x0A, */      0x00,      0x00,         0x00,	 86 },
939e10bd87Saymeric #endif
949e10bd87Saymeric 	{ /*   0x0B, */       'b',       'B',         0x02,	 48 },
959e10bd87Saymeric 	{ /*   0x0C, */       'q',       'Q',         0x11,	 16 },
969e10bd87Saymeric 	{ /*   0x0D, */       'w',       'W',         0x17,	 17 },
979e10bd87Saymeric 	{ /*   0x0E, */       'e',       'E',         0x05,	 18 },
989e10bd87Saymeric 	{ /*   0x0F, */       'r',       'R',         0x12,	 19 },
999e10bd87Saymeric 	{ /*   0x10, */       'y',       'Y',         0x19,	 21 },
1009e10bd87Saymeric 	{ /*   0x11, */       't',       'T',         0x14,	 20 },
1019e10bd87Saymeric 	{ /*   0x12, */       '1',       '!',         0x00,	  2 },
1029e10bd87Saymeric 	{ /*   0x13, */       '2',       '@',         0x00,	  3 },
1039e10bd87Saymeric 	{ /*   0x14, */       '3',       '#',         0x00,	  4 },
1049e10bd87Saymeric 	{ /*   0x15, */       '4',       '$',         0x00,	  5 },
1059e10bd87Saymeric 	{ /*   0x16, */       '6',       '^',         0x1E,	  7 },
1069e10bd87Saymeric 	{ /*   0x17, */       '5',       '%',         0x00,	  6 },
1079e10bd87Saymeric 	{ /*   0x18, */       '=',       '+',         0x00,	 13 },
1089e10bd87Saymeric 	{ /*   0x19, */       '9',       '(',         0x00,	 10 },
1099e10bd87Saymeric 	{ /*   0x1A, */       '7',       '&',         0x00,	  8 },
1109e10bd87Saymeric 	{ /*   0x1B, */       '-',       '_',         0x1F,	 12 },
1119e10bd87Saymeric 	{ /*   0x1C, */       '8',       '*',         0x00,	  9 },
1129e10bd87Saymeric 	{ /*   0x1D, */       '0',       ')',         0x00,	 11 },
1139e10bd87Saymeric 	{ /*   0x1E, */       ']',       '}',         0x1D,	 27 },
1149e10bd87Saymeric 	{ /*   0x1F, */       'o',       'O',         0x0F,	 24 },
1159e10bd87Saymeric 	{ /*   0x20, */       'u',       'U',         0x15,	 22 },
1169e10bd87Saymeric 	{ /*   0x21, */       '[',       '{',         0x1B,	 26 },
1179e10bd87Saymeric 	{ /*   0x22, */       'i',       'I',         0x09,	 23 },
1189e10bd87Saymeric 	{ /*   0x23, */       'p',       'P',         0x10,	 25 },
1199e10bd87Saymeric 	{ /*   0x24, */      0x0D,      0x0D,         0x0D,	 28 },
1209e10bd87Saymeric 	{ /*   0x25, */       'l',       'L',         0x0C,	 38 },
1219e10bd87Saymeric 	{ /*   0x26, */       'j',       'J',         0x0A,	 36 },
1229e10bd87Saymeric 	{ /*   0x27, */       '\'',      '"',         0x00,	 40 },
1239e10bd87Saymeric 	{ /*   0x28, */       'k',       'K',         0x0B,	 37 },
1249e10bd87Saymeric 	{ /*   0x29, */       ';',       ':',         0x00,	 39 },
1259e10bd87Saymeric 	{ /*   0x2A, */      '\\',       '|',         0x1C,	 43 },
1269e10bd87Saymeric 	{ /*   0x2B, */       ',',       '<',         0x00,	 51 },
1279e10bd87Saymeric 	{ /*   0x2C, */       '/',       '?',         0x00,	 53 },
1289e10bd87Saymeric 	{ /*   0x2D, */       'n',       'N',         0x0E,	 49 },
1299e10bd87Saymeric 	{ /*   0x2E, */       'm',       'M',         0x0D,	 50 },
1309e10bd87Saymeric 	{ /*   0x2F, */       '.',       '>',         0x00,	 52 },
1319e10bd87Saymeric 	{ /*   0x30, */      0x09,      0x09,         0x09,	 15 },
1329e10bd87Saymeric 	{ /*   0x31, */       ' ',       ' ',         0x00,	 57 },
1339e10bd87Saymeric #ifdef FIX_SV_X_KBDBUG
1349e10bd87Saymeric 	{ /*   0x32, */       '`',       '~',         0x00,	 86 },
1359e10bd87Saymeric #else
1369e10bd87Saymeric 	{ /*   0x32, */       '`',       '~',         0x00,	 41 },
1379e10bd87Saymeric #endif
1389e10bd87Saymeric 	{ /*   0x33, */      0x7F,      0x7F,         0x7F,	211 }, /* Delete */
1399e10bd87Saymeric 	{ /*   0x34, */      0x00,      0x00,         0x00,	105 }, /* MODE/KP_Enter */
1409e10bd87Saymeric 	{ /*   0x35, */      0x1B,      0x1B,         0x1B,	  1 },
1419e10bd87Saymeric 	{ /*   0x36, */      0x00,      0x00,         0x00,	 29 },
1429e10bd87Saymeric 	{ /*   0x37, */      0x00,      0x00,         0x00,	219 },
1439e10bd87Saymeric 	{ /*   0x38, */      0x00,      0x00,         0x00,	 42 },
1449e10bd87Saymeric 	{ /*   0x39, */      0x00,      0x00,         0x00,	 58 },
1459e10bd87Saymeric 	{ /*   0x3A, */      0x00,      0x00,         0x00,	 56 }, /* L Alt */
1469e10bd87Saymeric 	{ /*   0x3B, */       'h',      0x00,         0x00,	203 },  /* Left */
1479e10bd87Saymeric 	{ /*   0x3C, */       'l',      0x00,         0x00,	205 },  /* Right */
1489e10bd87Saymeric 	{ /*   0x3D, */       'j',      0x00,         0x00,	208 },  /* Down */
1499e10bd87Saymeric 	{ /*   0x3E, */       'k',      0x00,         0x00,	200 },  /* Up */
1509e10bd87Saymeric 	{ /*   0x3F, */      0x00,      0x00,         0x00,	  0 }, /* Fn */
1519e10bd87Saymeric 	{ /*   0x40, */      0x00,      0x00,         0x00,	  0 },
1529e10bd87Saymeric 	{ /*   0x41, */       '.',       '.',         0x00,	 83 },
1539e10bd87Saymeric 	{ /*   0x42, */      0x00,      0x00,         0x00,	  0 },
1549e10bd87Saymeric 	{ /*   0x43, */       '*',       '*',         0x00,	 55 },
1559e10bd87Saymeric 	{ /*   0x44, */      0x00,      0x00,         0x00,	  0 },
1569e10bd87Saymeric 	{ /*   0x45, */       '+',       '+',         0x00,	 78 },
1579e10bd87Saymeric 	{ /*   0x46, */      0x00,      0x00,         0x00,	  0 },
1589e10bd87Saymeric 	{ /*   0x47, */      0x00,      0x00,         0x00,	 69 },
1599e10bd87Saymeric 	{ /*   0x48, */      0x00,      0x00,         0x00,	  0 },
1609e10bd87Saymeric 	{ /*   0x49, */      0x00,      0x00,         0x00,	  0 },
1619e10bd87Saymeric 	{ /*   0x4A, */      0x00,      0x00,         0x00,	  0 },
1629e10bd87Saymeric 	{ /*   0x4B, */       '/',       '/',         0x00,	181 },
1639e10bd87Saymeric 	{ /*   0x4C, */      0x0D,      0x0D,         0x0D,	156 },
1649e10bd87Saymeric 	{ /*   0x4D, */      0x00,      0x00,         0x00,	  0 },
1659e10bd87Saymeric 	{ /*   0x4E, */       '-',       '-',         0x00,	 74 },
1669e10bd87Saymeric 	{ /*   0x4F, */      0x00,      0x00,         0x00,	  0 },
1679e10bd87Saymeric 	{ /*   0x50, */      0x00,      0x00,         0x00,	  0 },
1689e10bd87Saymeric 	{ /*   0x51, */       '=',       '=',         0x00,	118 },
1699e10bd87Saymeric 	{ /*   0x52, */       '0',       '0',         0x00,	 82 },
1709e10bd87Saymeric 	{ /*   0x53, */       '1',       '1',         0x00,	 79 },
1719e10bd87Saymeric 	{ /*   0x54, */       '2',       '2',         0x00,	 80 },
1729e10bd87Saymeric 	{ /*   0x55, */       '3',       '3',         0x00,	 81 },
1739e10bd87Saymeric 	{ /*   0x56, */       '4',       '4',         0x00,	 75 },
1749e10bd87Saymeric 	{ /*   0x57, */       '5',       '5',         0x00,	 76 },
1759e10bd87Saymeric 	{ /*   0x58, */       '6',       '6',         0x00,	 77 },
1769e10bd87Saymeric 	{ /*   0x59, */       '7',       '7',         0x00,	 71 },
1779e10bd87Saymeric 	{ /*   0x5A, */      0x00,      0x00,         0x00,	  0 },
1789e10bd87Saymeric 	{ /*   0x5B, */       '8',       '8',         0x00,	 72 },
1799e10bd87Saymeric 	{ /*   0x5C, */       '9',       '9',         0x00,	 73 },
180*0659c2f9Shamajima 	{ /*   0x5D, */      0x00,      0x00,         0x00,	125 },
181*0659c2f9Shamajima 	{ /*   0x5E, */      0x00,      0x00,         0x00,	115 },
1829e10bd87Saymeric 	{ /*   0x5F, */      0x00,      0x00,         0x00,	 51 },
1839e10bd87Saymeric 	{ /*   0x60, */      0x00,      0x00,         0x00,	 63 }, /* F5 */
1849e10bd87Saymeric 	{ /*   0x61, */      0x00,      0x00,         0x00,	 64 }, /* F6 */
1859e10bd87Saymeric 	{ /*   0x62, */      0x00,      0x00,         0x00,	 65 }, /* F7 */
1869e10bd87Saymeric 	{ /*   0x63, */      0x00,      0x00,         0x00,	 61 }, /* F3 */
1879e10bd87Saymeric 	{ /*   0x64, */      0x00,      0x00,         0x00,	 66 }, /* F8 */
1889e10bd87Saymeric 	{ /*   0x65, */      0x00,      0x00,         0x00,	 67 }, /* F9 */
189*0659c2f9Shamajima 	{ /*   0x66, */      0x00,      0x00,         0x00,	123 },
1909e10bd87Saymeric 	{ /*   0x67, */      0x00,      0x00,         0x00,	 87 }, /* F11 */
191*0659c2f9Shamajima 	{ /*   0x68, */      0x00,      0x00,         0x00,	112 },
1929e10bd87Saymeric 	{ /*   0x69, */      0x00,      0x00,         0x00,	  0 },
1939e10bd87Saymeric 	{ /*   0x6A, */      0x00,      0x00,         0x00,	156 },
1949e10bd87Saymeric 	{ /*   0x6B, */      0x00,      0x00,         0x00,	  0 },
1959e10bd87Saymeric 	{ /*   0x6C, */      0x00,      0x00,         0x00,	  0 },
1969e10bd87Saymeric 	{ /*   0x6D, */      0x00,      0x00,         0x00,	 68 }, /* F10 */
1979e10bd87Saymeric 	{ /*   0x6E, */      0x00,      0x00,         0x00,	  0 },
1989e10bd87Saymeric 	{ /*   0x6F, */      0x00,      0x00,         0x00,	 88 }, /* F12 */
1999e10bd87Saymeric 	{ /*   0x70, */      0x00,      0x00,         0x00,	  0 },
2009e10bd87Saymeric 	{ /*   0x71, */      0x00,      0x00,         0x00,	  0 },
2019e10bd87Saymeric 	{ /*   0x72, */      0x00,      0x00,         0x00,	  0 },
2029e10bd87Saymeric 	{ /*   0x73, */      0x00,      0x00,         0x00,	199 },
2039e10bd87Saymeric 	{ /*   0x74, */      0x00,      0x00,         0x00,	201 },
2049e10bd87Saymeric 	{ /*   0x75, */      0x00,      0x00,         0x00,	  0 },
2059e10bd87Saymeric 	{ /*   0x76, */      0x00,      0x00,         0x00,	 62 }, /* F4 */
2069e10bd87Saymeric 	{ /*   0x77, */      0x00,      0x00,         0x00,	207 },
2079e10bd87Saymeric 	{ /*   0x78, */      0x00,      0x00,         0x00,	 60 }, /* F2 */
2089e10bd87Saymeric 	{ /*   0x79, */      0x00,      0x00,         0x00,	209 },
2099e10bd87Saymeric 	{ /*   0x7A, */      0x00,      0x00,         0x00,	 59 }, /* F1 */
2109e10bd87Saymeric 	{ /*   0x7B, */      0x00,      0x00,         0x00,	  0 },
2119e10bd87Saymeric 	{ /*   0x7C, */      0x00,      0x00,         0x00,	  0 },
2129e10bd87Saymeric 	{ /*   0x7D, */      0x00,      0x00,         0x00,	  0 },
2139e10bd87Saymeric 	{ /*   0x7E, */      0x00,      0x00,         0x00,	  0 },
2149e10bd87Saymeric 	{ /*   0x7F, */      0x00,      0x00,         0x00,	  0 } /* pwr */
2152be6df07Stsubai };
2162be6df07Stsubai #endif /* KEYBOARD_ARRAY */
217