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

Function BIOSgetch

outdated/sys/atari/tos.c:128–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126#define ALT 0x8
127
128static char
129BIOSgetch()
130{
131 unsigned char scan, shift, ch;
132 const struct pad *kpad;
133
134 long x;
135
136 /* Get scan code.
137 */
138 x = Crawcin();
139 ch = x & 0x0ff;
140 scan = (x & 0x00ff0000L) >> 16;
141 /* Get shift status.
142 */
143 shift = Kbshift(-1);
144
145 /* Translate keypad keys */
146 if (iskeypad(scan)) {
147 kpad = iflags.num_pad ? numpad : keypad;
148 if (shift & SHIFT)
149 ch = kpad[scan - KEYPADLO].shift;
150 else if (shift & CTRL)
151 ch = kpad[scan - KEYPADLO].cntrl;
152 else
153 ch = kpad[scan - KEYPADLO].normal;
154 }
155 /* Translate unassigned Alt-letters */
156 if ((shift & ALT) && !ch) {
157 if (inmap(scan))
158 ch = scanmap[scan - SCANLO];
159 return (isprint(ch) ? M(ch) : ch);
160 }
161 return ch;
162}
163
164static char
165DOSgetch()

Callers 1

tgetchFunction · 0.70

Calls 1

isprintFunction · 0.85

Tested by

no test coverage detected