os-k/kaleid/kernel/io/scan.c

172 lines
6.4 KiB
C

//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Desc: Basic Scancode Tables //
// //
// //
// Copyright © 2018-2019 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#define WANT_AZERTY 1
#define NONE 0
#define INVISIBLE 1
#define CAPSLOCK 2
#define INVALID 256
#define ENTRY(index, character, flags) [2 * index] = character, \
[2 * index + 1] = flags
const uint RegularScanCodes[2 * 256] =
{
ENTRY (0x00, 0, INVISIBLE|INVALID),
ENTRY (0x01, KEY_ESC, INVISIBLE),
ENTRY (0x02, '&', NONE),
ENTRY (0x03, 'e', NONE),
ENTRY (0x04, '"', NONE),
ENTRY (0x05, '\'', NONE),
ENTRY (0x06, '(', NONE),
ENTRY (0x07, '-', NONE),
ENTRY (0x08, 'e', NONE),
ENTRY (0x09, '_', NONE),
ENTRY (0x0A, 'c', NONE),
ENTRY (0x0B, 'a', NONE),
ENTRY (0x0C, ')', NONE),
ENTRY (0x0D, '=', NONE),
ENTRY (0x0E, KEY_BS, NONE), // Backspace
ENTRY (0x0F, '\t', NONE),
ENTRY (0x10, 'a', CAPSLOCK),
ENTRY (0x11, 'z', CAPSLOCK),
ENTRY (0x12, 'e', CAPSLOCK),
ENTRY (0x13, 'r', CAPSLOCK),
ENTRY (0x14, 't', CAPSLOCK),
ENTRY (0x15, 'y', CAPSLOCK),
ENTRY (0x16, 'u', CAPSLOCK),
ENTRY (0x17, 'i', CAPSLOCK),
ENTRY (0x18, 'o', CAPSLOCK),
ENTRY (0x19, 'p', CAPSLOCK),
ENTRY (0x1A, '^', NONE),
ENTRY (0x1B, '$', NONE),
ENTRY (0x1C, '\n', NONE),
ENTRY (0x1D, 0, INVISIBLE|INVALID), // Left Control
ENTRY (0x1E, 'q', CAPSLOCK),
ENTRY (0x1F, 's', CAPSLOCK),
ENTRY (0x20, 'd', CAPSLOCK),
ENTRY (0x21, 'f', CAPSLOCK),
ENTRY (0x22, 'g', CAPSLOCK),
ENTRY (0x23, 'h', CAPSLOCK),
ENTRY (0x24, 'j', CAPSLOCK),
ENTRY (0x25, 'k', CAPSLOCK),
ENTRY (0x26, 'l', CAPSLOCK),
ENTRY (0x27, 'm', CAPSLOCK),
ENTRY (0x28, '%', NONE),
ENTRY (0x29, '2', NONE), // ²
ENTRY (0x2A, 0, INVISIBLE|INVALID), // Left Shift
ENTRY (0x2B, '*', NONE),
ENTRY (0x2C, 'w', CAPSLOCK),
ENTRY (0x2D, 'x', CAPSLOCK),
ENTRY (0x2E, 'c', CAPSLOCK),
ENTRY (0x2F, 'v', CAPSLOCK),
ENTRY (0x30, 'b', CAPSLOCK),
ENTRY (0x31, 'n', CAPSLOCK),
ENTRY (0x32, ',', CAPSLOCK),
ENTRY (0x33, ';', CAPSLOCK),
ENTRY (0x34, ':', CAPSLOCK),
ENTRY (0x35, '!', CAPSLOCK),
};
const uint LeftShiftScanCodes[2 * 256] =
{
ENTRY (0x00, 0, INVISIBLE|INVALID),
ENTRY (0x01, KEY_ESC, INVISIBLE),
ENTRY (0x02, '1', NONE),
ENTRY (0x03, '2', NONE),
ENTRY (0x04, '3', NONE),
ENTRY (0x05, '4', NONE),
ENTRY (0x06, '5', NONE),
ENTRY (0x07, '6', NONE),
ENTRY (0x08, '7', NONE),
ENTRY (0x09, '8', NONE),
ENTRY (0x0A, '9', NONE),
ENTRY (0x0B, '0', NONE),
ENTRY (0x0C, 'o', NONE),
ENTRY (0x0D, '+', NONE),
ENTRY (0x0E, KEY_BS, NONE), // Backspace
ENTRY (0x0F, '\t', NONE),
ENTRY (0x10, 'A', CAPSLOCK),
ENTRY (0x11, 'Z', CAPSLOCK),
ENTRY (0x12, 'E', CAPSLOCK),
ENTRY (0x13, 'R', CAPSLOCK),
ENTRY (0x14, 'T', CAPSLOCK),
ENTRY (0x15, 'Y', CAPSLOCK),
ENTRY (0x16, 'U', CAPSLOCK),
ENTRY (0x17, 'I', CAPSLOCK),
ENTRY (0x18, 'O', CAPSLOCK),
ENTRY (0x19, 'P', CAPSLOCK),
ENTRY (0x1A, '^', NONE),
ENTRY (0x1B, '$', NONE),
ENTRY (0x1C, '\n', NONE),
ENTRY (0x1D, 0, INVISIBLE|INVALID), // Left Control
ENTRY (0x1E, 'Q', CAPSLOCK),
ENTRY (0x1F, 'S', CAPSLOCK),
ENTRY (0x20, 'D', CAPSLOCK),
ENTRY (0x21, 'F', CAPSLOCK),
ENTRY (0x22, 'G', CAPSLOCK),
ENTRY (0x23, 'H', CAPSLOCK),
ENTRY (0x24, 'J', CAPSLOCK),
ENTRY (0x25, 'K', CAPSLOCK),
ENTRY (0x26, 'L', CAPSLOCK),
ENTRY (0x27, 'M', CAPSLOCK),
ENTRY (0x28, '%', NONE),
ENTRY (0x29, '2', NONE), // ²
ENTRY (0x2A, 0, INVISIBLE|INVALID), // Left Shift
ENTRY (0x2B, '*', NONE),
ENTRY (0x2C, 'W', CAPSLOCK),
ENTRY (0x2D, 'X', CAPSLOCK),
ENTRY (0x2E, 'C', CAPSLOCK),
ENTRY (0x2F, 'V', CAPSLOCK),
ENTRY (0x30, 'B', CAPSLOCK),
ENTRY (0x31, 'N', CAPSLOCK),
ENTRY (0x32, '?', NONE),
ENTRY (0x33, '.', NONE),
ENTRY (0x34, '/', NONE),
ENTRY (0x35, '!', NONE),
};
const uint LeftAltScanCodes[2 * 256];
const uint LeftControlScanCodes[2 * 256];