Skip to content

Keyboard module

Konstantin (Vyacheslav) Kompan edited this page Mar 1, 2018 · 3 revisions

Functions

Name Decription Arguments Return value Used registers Note
tgbl_clearKeyHandlersTable Clean keyboard handlers table AX, BX
tgbl_keyboardHandler Keyboard handler AH, BX
tgbl_getChar Get ASCII character of the key pressed AL = ASCII character AH
tgbl_getString Read input string until Enter is pressed DI = string address, BX = max length including zero terminator AX, BX, CX, DI Can be called with a macro tgblm_getString

Macros

Name Decription Arguments Used registers
tgblm_setKeyHandlers Enable/disable keystroke handlers KBD_HANDLERS_ENABLED or KBD_HANDLERS_DISABLED
tgblm_initKey Set keystroke handler key, handler
tgblm_deinitKey Clear keystroke handler key
tgblm_getString Read input string until Enter is pressed string address, max length including zero terminator AX, BX, CX, DI

Variables

tgbl_kbd_handlers_enable - Keystroke handlers switcher, enabled by default

Constants

Name Description Value
tgbl_kbd_table Keystroke handlers table pointer (0x7c00 - 4096 bytes stack - 2 * 0x87) 0x6b52
KBD_HANDLERS_ENABLED 1
KBD_HANDLERS_DISABLED 0

Keyboard scan codes

Key Value
KEY_A 0x1E
KEY_B 0x30
KEY_C 0x2E
KEY_D 0x20
KEY_E 0x12
KEY_F 0x21
KEY_G 0x22
KEY_H 0x23
KEY_I 0x17
KEY_J 0x24
KEY_K 0x25
KEY_L 0x26
KEY_M 0x32
KEY_N 0x31
KEY_O 0x18
KEY_P 0x19
KEY_Q 0x10
KEY_R 0x13
KEY_S 0x1F
KEY_T 0x14
KEY_U 0x16
KEY_V 0x2F
KEY_W 0x11
KEY_X 0x2D
KEY_Y 0x15
KEY_Z 0x2C
KEY_1 0x02
KEY_2 0x03
KEY_3 0x04
KEY_4 0x05
KEY_5 0x06
KEY_6 0x07
KEY_7 0x08
KEY_8 0x09
KEY_9 0x0A
KEY_0 0x0B
KEY_MINUS 0x0C
KEY_EQUAL 0x0D
KEY_SQBRKT_OP 0x1A
KEY_SQBRKT_CL 0x1B
KEY_SEMICOLON 0x27
KEY_APOSTROPH 0x28
KEY_GRAVIS 0x29
KEY_BACKSLASH 0x2B
KEY_COMMA 0x33
KEY_DOT 0x34
KEY_SLASH 0x35
KEY_F1 0x3B
KEY_F2 0x3C
KEY_F3 0x3D
KEY_F4 0x3E
KEY_F5 0x3F
KEY_F6 0x40
KEY_F7 0x41
KEY_F8 0x42
KEY_F9 0x43
KEY_F10 0x44
KEY_F11 0x85
KEY_F12 0x86
KEY_BKSP 0x0E
KEY_DEL 0x53
KEY_DOWN_ARR 0x50
KEY_END 0x4F
KEY_ENTER 0x1C
KEY_ESC 0x01
KEY_HOME 0x47
KEY_INS 0x52
KEY_KPD_5 0x4C
KEY_KPD_MUL 0x37
KEY_KPD_MINUS 0x4A
KEY_KPD_PLUS 0x4E
KEY_KPD_SLASH 0x35
KEY_LEFT_ARR 0x4B
KEY_PGDN 0x51
KEY_PGUP 0x49
KEY_RIGHT_ARR 0x4D
KEY_SPACE 0x39
KEY_TAB 0x0F
KEY_UP_ARR 0x48

Clone this wiki locally