# File: pref-ibm.prf

#
# This file is used by Angband (when it was compiled using "main-ibm.c"
# or "main-dos.c" or "main-win.c") to specify various "user preferences",
# including "macros".
#
# This file defines some basic macros, which allow the use of the "keypad",
# alone, and with the shift and/or control modifier keys.  All "special"
# keys are translated by "main-ibm.c" (or "main-win.c") into special "macro
# triggers" of the encoded form "^_MMMxSS\r", where the "modifier" flags are
# stored in "MMM", and the two digit hexidecimal scan code of the keypress is
# stored in "SS".
#
# The "main-ibm.prf" and "main-dos.prf" files may not be able to recognize
# the "/" and "*" keys on the keypad, because it mistakenly classifies the
# "0x35" and "0x37" codes as the keycodes of "normal" keys.
#
# The "main-win.prf" file should not be using the final "control + keypad"
# section in this file, it was created for "main-ibm.c" and "main-dos.c".
#
# The "main-win.prf" file may actually send the "ascii" equivalent of some
# keypad keys after the keypad key itself, especially if "numlock" is down,
# which may cause problems.  Or it may not, it is hard to tell.  This is bad.
#
# See "main-ibm.c" and "main-dos.c" and "main-win.c" for more info.
#


#
# Macro Trigger configuration
#
# T:<trigger template>:<modifiers>:<modifier name1>:<modifier name2>:....
# '&' in <trigger template> specifies location of modifier character.
# '#' in <trigger template> specifies location of key code.
#
# If <trigger template> is null string, all trigger difinition will be cleared.

T:&x#:CSA:control-:shift-:alt-

# T:<trigger name>:<keycode>:<keycode with shiftkey>
# '\' in <trigger name> is escape character.

# These keycodes are actually direct keyboard scan code taken from the 'dinput.h'.

?:[EQU $KEYBOARD JAPAN]
# For Japanese keyboard.
T:-:0C
T:^:0D
T:@:1A
T:[:1B
T:;:27
T:\::28
T:]:2B
T:,:33
T:.:34
T:\/:35
T:_:73
?:1

?:[EQU $KEYBOARD 0]
# For US keyboard.
T:-:0C
T:=:0D
T:[:1A
T:]:1B
T:;:27
T:\':28
T:`:29
T:\\:2B
T:,:33
T:.:34
T:\/:35
?:1

############
# Common keycodes (except NEC PC-98x1)

?:[NOT [EQU $KEYBOARD NEC98]]
T:1:02
T:2:03
T:3:04
T:4:05
T:5:06
T:6:07
T:7:08
T:8:09
T:9:0A
T:0:0B
T:Backspace:0E
T:Q:10
T:W:11
T:E:12
T:R:13
T:T:14
T:Y:15
T:U:16
T:I:17
T:O:18
T:P:19
T:Enter:1C
T:A:1E
T:S:1F
T:D:20
T:F:21
T:G:22
T:H:23
T:J:24
T:K:25
T:L:26
T:Zenkaku_Hankaku:29
T:Z:2C
T:X:2D
T:C:2E
T:V:2F
T:B:30
T:N:31
T:M:32
T:KP_Divide:K35
T:KP_Multiply:K37
T:CapsLock:3A
T:F1:3B
T:F2:3C
T:F3:3D
T:F4:3E
T:F5:3F
T:F6:40
T:F7:41
T:F8:42
T:F9:43
T:F10:44
T:Numlock:45
T:Scroll:46
T:KP_7:K47
T:Home:47
T:KP_8:K48
T:Up:48
T:KP_9:K49
T:Page_Up:49
T:KP_Subtract:K4A
T:KP_4:K4B
T:Left:4B
T:KP_5:K4C
T:KP_6:K4D
T:Right:4D
T:KP_Add:K4E
T:KP_1:K4F
T:End:4F
T:KP_2:K50
T:Down:50
T:KP_3:K51
T:Page_Down:51
T:KP_0:K52
T:Insert:52
T:KP_Decimal:K53
T:Delete:53
T:Oem_102:56
T:F11:57
T:F12:58
T:Menu:5D
T:F13:64
T:F14:65
T:F15:66
T:Hiragana_Katakana:70
T:Abnt_C1:73
T:Henkan:79
T:Muhenkan:7B
T:Yen:7D
T:Abnt_C2:7E
T:KP_equals:K8D
T:Prevtrack:90
T:Kanji:94
T:Stop:95
T:Ax:96
T:Unlabeled:97
T:Nexttrack:99
T:KP_Enter:K9C
T:Mute:A0
T:Calculator:A1
T:Playpause:A2
T:Mediastop:A4
T:Volumedown:AE
T:Volumeup:B0
T:Webhome:B2
T:KP_Comma:KB3
T:KP_Divide:KB5
T:Sys_Req:B7
T:Pause:C5
#T:Home:C7
#T:Up:C8
#T:Prior:C9
#T:Left:CB
#T:Right:CD
#T:End:CF
#T:Down:D0
#T:Next:D1
#T:Insert:D2
#T:Delete:D3
T:Lwin:DB
T:Rwin:DC
T:Apps:DD
T:Power:DE
T:Sleep:DF
T:Wake:E3
T:Websearch:E5
T:Webfavorites:E6
T:Webrefresh:E7
T:Webstop:E8
T:Webforward:E9
T:Webback:EA
T:Mycomputer:EB
T:Mail:EC
T:Mediaselect:ED
?:1


######################
# For NEC PC-98x1

?:[EQU $KEYBOARD NEC98]
T:1:01
T:2:02
T:3:03
T:4:04
T:5:05
T:6:06
T:7:07
T:8:08
T:9:09
T:0:0A
T:-:0B
T:^:0C
T:Yen:0D
T:Backspace:0E
T:Q:10
T:W:11
T:E:12
T:R:13
T:T:14
T:Y:15
T:U:16
T:I:17
T:O:18
T:P:19
T:@:1a
T:[:1b
T:Enter:1C
T:A:1D
T:S:1E
T:D:1F
T:F:20
T:G:21
T:H:22
T:J:23
T:K:24
T:L:25
T:;:26
T:\::27
T:[:28
T:Z:29
T:X:2A
T:C:2B
T:V:2C
T:B:2D
T:N:2E
T:M:2F
T:,:30
T:.:31
T:\/:32
T:_:33
T:Henkan:35
T:Page_Down:36
T:Page_Up:37
T:Insert:38
T:Delete:39
T:Up:3A
T:Left:3B
T:Right:3C
T:Down:3D
T:Home:3E
T:End:3F
T:KP_Subtract:K40
T:KP_Divide:K41
T:KP_7:K42
T:KP_8:K43
T:KP_9:K44
T:KP_Multiply:K45
T:KP_4:K46
T:KP_5:K47
T:KP_6:K48
T:KP_Add:K49
T:KP_1:K4A
T:KP_2:K4B
T:KP_3:K4C
T:KP_Equal:K4D
T:KP_0:K4E
T:KP_Comma:K4F
T:KP_Decimal:K50
T:Muhenkan:51
T:F11:52
T:F12:53
T:F13:54
T:F14:55
T:F15:56
T:Pause:60
T:F1:62
T:F2:63
T:F3:64
T:F4:65
T:F5:66
T:F6:67
T:F7:68
T:F8:69
T:F9:6A
T:F10:6B
T:CapsLock:71
T:Hiragana_Katakana:72
T:Menu:79

?:[NOT [EQU $KEYBOARD NEC98]]


#
# Hack -- Some foreign keyboards have a special key on the keyboard, which
# is used to generate the "<", ">", and "|" keys (alone, shifted, alt-ed).
#

A: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