EasyManua.ls Logo

Atari ST series - Page 28

Atari ST series
420 pages
Print Icon
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
Program 2-1. BCHARDEV.C
/* */
/* BCHARDEV.C */
/* */
/* Demonstrates some of the BIOS */
/* character device functions */
/* */
/**********************************************/
#include <osbind.h> /* For BIOS macro definitions */
Idefine CON 2 /* alias for Console device number */
main()
{
long ch;
int sh, count = 4999;
while((char)ch != 'q') /* End program when 'q' is struck */
(
while(!Bconstat(CON)) /* until then, wait for key */
{
if ( (count++) == 5000) /* print a dot every so often */
{
Bconout(CON,'.')?
count=0;
) /* When key is struck, */
ch = Bconin(CON); /* get the key value */
sh = Kbshift(-l); /* and shift status code. */
/* Print the ASCII character and value, */
printf (" \n%c%6x", (char)ch, (char);
/* shift status and key scan codes */
printf (" %4x%8x\n",sh, (int) ((ch»8) |ch) );
)
)
/******** end of BCHARDEV.C *****/
Machine language programmers should refer to the
XSCREEN.X program in Chapter 4 for examples on using the
BIOS functions Bconin() and Bconout() in machine lan
guage.
Disk Device I/O
The ST BIOS contains four disk I/O routines, three of which
merely return information about the drives. These routines
are included mainly for use by other, higher-level operating
system routines and may not be of much use to the average
programmer. The first function, Drvmap(), can be used to
determine which drives are available. The syntax for this call,
using the C macro, is
long drives;
drives = Drvmap();
where drives is a bitflag that indicates which drives are con
nected. Each bit of the drives variable corresponds to a differ
ent drive. Bit 0 is assigned to drive A, bit 1 to drive B, and
20

Related product manuals