EasyManua.ls Logo

Atari ST series - Page 61

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...
XBIOS Device and System Functions
printf("Insert disk to format in drive A and press Return\n\n");
Bconin(2); /* wait for a key press */
/* format tracks 0-79 on both sides */
for(track=0;track<80;track++) /* for 80 tracks.. */
(
for(side=0;side<2;side++) /* on 2 sides */
(
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) /* if there's an error, quit */
printf("Error %d at track %d, side %d\n",status, track,side);
exit(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 2 tracks... */
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) /* if there's an error, quit */
(
printf("Sector zero failed, error %d\n",status);
exit(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) /* if there's an error, quit */
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
53

Related product manuals