Atari ST series Technical Reference Manual page 61

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

XBIOS Device and System Functions
printf("Insert disk to format in drive A and press Return\n\n");
Bconin(2);
/* format tracks 0-79 on both sides */
for(track=0;track<80;track++)
(
for(side=0;side<2;side++)
(
printf("\33A Track %d, Side %d\n",track,side);
/* format a track */
status = Flopfmt(buf,0L,0,9,track,side,1,0X87654321L,0xE5E5);
if (status != 0)
printf("Error %d at track %d, side %d\n",status, track,side);
e x i t (100);
) /* end of if */
) /* end of for side */
) /* end of for track */
/* Fill first two tracks on both sides with zeros */
for(track=0;track<4096;buf(track++]=0); /* fill buf w/o's */
for(track=0;track<2;track++)
for(side=0;side<2;side++) /* two sides each */
{
/* write zeros to track */
status = Flopwr(buf,0L,0,1,track,side,9);
if (status !=>0)
(
printf("Sector zero failed, error %d\n",status);
e x i t (100);
)
)
)
/* prototype a boot sector, and write to side 0, track 0, sector 1 */
Protobt(buf,0X01000000L,3,0);
status = Flopwr(buf,0L,0,1,0,0,1);
if (status 1«=0)
printf("Boot sector write failed, error %d\n",status);
exit(100);
)
/* if no errors, the disk is formatted! */
printf("Format successful\n");
/*********** End Of XFORMAT.C *********/
Though this program will format a disk, it is much sim­
pler than the typical formatting program. It only formats a
double-sided disk in drive A, and it quits the format proce­
dure at the first sign of an error. Typically, a format program
will retry formatting a track at least a couple of times before
giving up and will mark bad sectors as used in the File Allo­
cation Table instead of giving up on the whole disk if a cou­
ple of sectors are bad.
Accessing the I/O Chips
The ST uses a number of different I/O chips to perform its
various input/output chores. The XBIOS provides functions
/* wait for a key press */
/* if there's an error, quit */
/* for 2 tracks... */
/* if there's an error, quit */
/* if there's an error, quit */
/* for 80 tracks.. */
/* on 2 sides */
53

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents