Atari ST series Technical Reference Manual page 28

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

Program 2-1. BCHARDEV.C
/*
/*
BCHARDEV.C
/*
/*
Demonstrates some of the BIOS
/*
character device functions
/*
/**********************************************/
#include <osbind.h>
Idefine CON
2
main()
{
long ch;
int sh, count = 4999;
w h i l e ((char)ch != 'q') /* End program when 'q' is struck */
(
w h i l e (!Bconstat(CON))
{
if ( (count++) == 5000)
{
Bconout(CON,'.')?
count=0;
)
ch = Bconin(CON);
sh = Kbshift(-l);
/* Print the ASCII character and value, */
printf ("
\n%c%6x", (char)ch, ( c h a r ) ;
/* shift status and key scan codes */
printf ("
%4x%8x\n",sh,
)
)
/******** 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 = D rvm ap();
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
CHAPTER 2
/* For BIOS macro definitions */
/* alias for Console device number */
/* until then, wait for key */
/* print a dot every so often */
/ *
When key is struck, */
/*
get the key value */
/* and shift status code. */
(int) ((ch»8) |ch)
*****/
*/
*/
*/
*/
*/
*/
);

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents