Atari ST series Technical Reference Manual page 23

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

This shifts the keycode into the high byte of the low
word, and discards the high word.
Although the scan code tells what key was pressed and
if it was pressed in combination with one of the shift keys, it
still can't give you complete information about the Shift, Al­
ternate, and Control keys. For example, if you press the
Shift, Alternate, and A keys together, the scan code you re­
ceive is the same one you would get from pressing Alternate
and A. The Control-cursor up combination yields the same
value as the cursor up key alone. To get complete informa­
tion about the status of the shift keys, you must use another
BIOS routine called Kbshift. The C language macro for this
function takes the following form:
int shiftcode, mode;
shiftcode = Kbshift(mode);
where mode is a flag that indicates whether you wish to read
or to set the shift key status code. A nonnegative number in
mode sets the status code to the value indicated after reading
the current code value. A negative number in mode causes
the function to return the shift key status code in shiftcode.
Each of the eight least significant bits in shiftcode represents a
particular shift key. If a bit is set to 1, it indicates that the
corresponding key was pressed at the time the function call
was made. Otherwise, the key was not pressed. The bit as­
signments for the shiftcode flag are shown in Table 2-2.
Since shiftcode is a bit flag, any or all of shift keys can be
detected at once. For example, a shiftcode value of 14
(8 + 4 + 2) would mean that the Alternate, Control, and left
Shift keys were all pressed at the same time.
Table 2-2. Bit Assignments for the shiftcode Flag
Bit
Bit
Number
Value
0
1
1
2
2
4
3
8
4
16
5
32
6
64
7
128
BIOS
Right shift key
Left shift key
Control key
Alternate key
Caps lock on
Altemate-Clr/Home key combination (Keyboard
equivalent for right mouse button)
Altemate-Insert key combination (Keyboard
equivalent for left mouse button)
Reserved (currently zero)
Shift Key
15

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents