MCPcopy Create free account
hub / github.com/NetHack/NetHack / BIOSgetch

Function BIOSgetch

outdated/sys/os2/os2.c:124–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122#define ALT_KEY 0x8
123
124static char
125BIOSgetch()
126{
127 unsigned char scan, shift, ch;
128 const struct pad *kpad;
129
130 KBDKEYINFO CharData;
131 USHORT IOWait = 0;
132 HKBD KbdHandle = 0;
133
134 KbdCharIn(&CharData, IOWait, KbdHandle);
135 ch = CharData.chChar;
136 scan = CharData.chScan;
137 shift = CharData.fsState;
138
139 /* Translate keypad keys */
140 if (iskeypad(scan)) {
141 kpad = iflags.num_pad ? numpad : keypad;
142 if (shift & SHIFT_KEY)
143 ch = kpad[scan - KEYPADLO].shift;
144 else if (shift & CTRL_KEY)
145 ch = kpad[scan - KEYPADLO].cntrl;
146 else
147 ch = kpad[scan - KEYPADLO].normal;
148 }
149 /* Translate unassigned Alt-letters */
150 if ((shift & ALT_KEY) && !ch) {
151 if (inmap(scan))
152 ch = scanmap[scan - SCANLO];
153 return (isprint(ch) ? M(ch) : ch);
154 }
155 return ch;
156}
157
158static char
159DOSgetch()

Callers 2

tgetchFunction · 0.70
tgetchFunction · 0.50

Calls 1

isprintFunction · 0.85

Tested by

no test coverage detected