EasyManua.ls Logo

Atari ST series - Page 22

Atari ST series
420 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
CHAPTER 2
plays them on the monitor. The intelligent keyboard device,
on the other hand, permits communication with the ST key
board's own 8-bit microprocessor. This keyboard processor
controls the keyboard, mouse, joysticks, and time-of-day
clock. Since this device is complex and has a large set of
commands, it is treated separately in Appendix I.
The most basic input function is to wait for a single char
acter to be transferred from one of the devices. The BIOS call
that implements this function is called Bconin(). If a charac
ter is available from the input device when you call this func
tion, it will receive that character and return immediately. If
there is no character available at the time you call the func
tion, it won't return until the device has sent a character.
The C language macro defined for this function in the OS-
BIND.H file uses the following syntax:
int devnum;
long char;
char = B con in (devnum);
where devnum is the number of the device from which to re
ceive a character. Only numbers 1-3 are valid, since the
printer can't be used for input and the intelligent keyboard
doesn't return any information through its character device.
The character received from the device is returned in the low
byte of the variable char. Note that the Bconin() function re
turns an entire longword, instead of a single character. Only
the least significant byte of this longword is used for infor
mation received from the MIDI or serial device. The console
device, however, uses both words of the longword.
The ASCII code for the character that was received is re
turned in the least significant byte of the low word. The least
significant byte of the high word contains a special key code
that indicates the physical key that was struck. This allows
the program to differentiate between the number 1 on the
top row of the keyboard and the 1 on the numeric keypad.
Together, the ASCII value and the key code are known as
the scan code. This scan code is more commonly expressed
as a single word, with the keycode in the high byte and the
ASCII code in the low byte. Appendix J contains a complete
list of scan codes expressed in this format. To convert from
the longword char to the word scancode, use the following C
statement:
scancode = (int)((char»8) | char);
14

Related product manuals