| A similiar questions was asked a few months ago on Usenet. I have appended
the question and answer.
Ray
From: [email protected] (Claus Brod )
Newsgroups: comp.sys.atari.st
Subject: Re: format program
Date: 8 May 90 07:50:14 GMT
Organization: CSD, University of Erlangen, W-Germany
[email protected] (Sam Alan EZUST) writes:
>I also want to be able to format 10 sectors/track. Unfortunately, the
>procedure which writes boot sectors, Protobt, has 4 possible disk
>types, none of which are 10sectors/track.
Right, Protobt can give you four different standard disk parameter
sets only. If you want to have your own non-standard format (and
10 sectors are non-standard though perfectly safe) you'll have to
patch your bootsector yourself. No big deal, really, because you can
call Protobt first to create a standard BPB block in your bootsector
and then change some values like sectors per track, sectors per disk
and so on.
|
| <<< BOLT::MAY14$DUA1:[NOTES$LIBRARY]ATARIST.NOTE;1 >>>
-< Atari's 68000 based systems. >-
================================================================================
Note 516.3 C/xbios format problem 3 of 3
CALYPS::SHARPE 63 lines 4-JUL-1989 15:46
-< BOOTBLOCK Program here >-
--------------------------------------------------------------------------------
Andrew, here is a program that I use to format floppy's on my ST. I
lifted most of the code from on of the START magazines if I remember
correctly. It has the BOOTBLOCK info you want in it. Have Fun!
Mike Sharpe
/*
Program to format a floppy disk with a disk name
*/
#include <osbind.h>
#include <stdio.h>
main()
{
static char buf[20000];
int i;
long l;
for (i=0; i<81; i++) {
printf("\rFormat track %02d", i); fflush(stdout);
if (Flopfmt(buf, 0L, 1, 10, i, 0, 1, 0x87654321L, 0xe5e5))
printf(" Error on track %02d", i);
if (Flopfmt(buf, 0L, 1, 10, i, 1, 1, 0x87654321L, 0xe5e5))
printf(" Error on track %02d", i);
}
for (i=0; i<10*512; i++)
buf[i] = 0;
puts("Zero track 0 & 1");
Flopwr(buf, 0L, 1, 1, 0, 0, 10);
Flopwr(buf, 0L, 1, 1, 0, 1, 10);
Flopwr(buf, 0L, 1, 1, 1, 0, 10);
Flopwr(buf, 0L, 1, 1, 1, 1, 10);
puts("Build prototype boot block");
Protobt(buf, 0x01000000L, 3, 0);
/* buf[X] = Y where X and Y are DECIMAL EQUIVELENTS of HEX VALUES */
/* now change the number of sectors */
buf[19] = 64;
buf[20] = 06;
/* now change the sectors per track entry. (10 not 9) */
buf[24] = 10;
puts("Write it to disk");
Flopwr(buf, 0L, 1, 1, 0, 0, 1);
/* buf[X] = Y where X and Y are DECIMAL EQUIVELENTS of HEX VALUES */
/* begin entering the disk name here */
/* put zeros into floppy buffer here */
for (i=0; i<10*512; i++)
buf[i] = 0;
printf("Enter Disk Name here: ");
/* input disk name here */
scanf("%s", buf);
/* put end of disk name byte in buffer here */
buf[11] = 08;
Flopwr(buf, 0L, 1, 2, 0, 1, 1);
/* end disk name entry here */
}
|
| Make sure the sum of all words (256 16 bit words) in the boot block is
NOT 0x1234. If they are, the ST will think that this is a BOOT disk,
and attempt to execute code in the boot block instead of the usual ROM
code. That is, of course, unless you are trying to write a boot
bprogram (such as Virus program), in which case, you WANT the checksum
to be 1234, so you can get the ST to run your Virus code instead of the
ROM code.
Therefore, as a side effect, a good quick check for most virus
infections is to check the boot block to see if it sums to 0x1234.
The checksum word is used to store an "adjust" value, such that the
checksum of the block will equal (or intentionally not equal) 0x1234.
|