[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference 7.286::atarist

Title:Atari ST, TT, & Falcon
Notice:Please read note 1.0 and its replies before posting!
Moderator:FUNYET::ANDERSON
Created:Mon Apr 04 1988
Last Modified:Tue May 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1433
Total number of notes:10312

935.0. "Formatters written in C" by COMICS::HOGGAN (No, I am not kidding !!!) Fri Aug 10 1990 08:03

    I'm busy learning C and GEM programming and decided to do something
    useful(?) and write a control panel - STe / MONO / 2MB+ only.
    
    Obviously, I've included a formatter, but I have run into a problem in
    that the C call for laying the boot block only allows a max value of
    726K to be written ! Does anyone have any ideas???????
    
T.RTitleUserPersonal
Name
DateLines
935.1Some help from UsenetYNOTME::WALLACEFri Aug 10 1990 14:1724
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. 
935.2From earlier in this conferencePRNSYS::LOMICKAJJeffrey A. LomickaFri Aug 10 1990 16:4770
             <<< 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 */

}

935.3No luck yet!COMICS::HOGGANNo, I am not kidding !!!Thu Aug 16 1990 07:197
    Hi,
    
    I tried the program in preceding note (well, I ripped the main bits
    out) and it didna work :-(  I am sure that I removed the important bits.
    Is writing the volume name to the floppy important? My program picks up
    the number of sectors per track from an integer variable...
     
935.4The "disk name" code looks like it will screw up the diskYNOTME::WALLACEThu Aug 16 1990 13:1810
>    Is writing the volume name to the floppy important?
No! In fact as near as I can tell the code in .2 is clobbering the FAT where
it claims to be writing the disk name. Using the wrong sector is not the only
thing wrong with the code that looks to be attempting to write the volume
name.

So I would definitly leave off the last Flopwr() in .2 (and obviously the code
that sets up buf for it).

	Ray
935.5What about the checksum?NRMACU::CB430I am the hoi polloiThu Feb 28 1991 04:0912
I've been trying to write a simple extended formatter - and have been having
some problems, of course!  One thing that had been bugging me is what the
checksum on the boot block is there for - it is set up by Protobt, then
invalidated (by both my program & the example program in this note) and not
reset.  Does anyone know if it is actually used anywhere?  Also, I couldn't
find any indication of how it is calculated - and I'm too lazy to muck around
to find out (compiling & linking on my ST is a slow and tedious process!).

Thanks for any enlightenment,

Chris.

935.6It's for boot disksPRNSYS::LOMICKAJJeffrey A. LomickaThu Feb 28 1991 10:5314
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.

935.7How many sectors/track maximum?JURA::LAROCHENe Suze que si l&#039;on SancerreMon Mar 18 1991 06:145
I wonder how many sectors per track you can have as a maximum?
Is it 10 or more?
Thanks for any information on this topic,

Pierre
935.811 is possible - but...BAHTAT::REIDTue Mar 19 1991 03:235
    Format11 will write 11 sectors per track which get about 900k on each
    disk. I don't use it for any disks which I may want to keep for a
    length of time.
    
    Kev
935.9A bizarre ideaSTAR::PARKEI&#039;m a surgeon, NOT Jack the RipperTue May 21 1991 14:117
Has any one played with the idea of writing the floppy's FULL track (not
sectored) and disassembling into sectors in memory with cutout drivers ??

I wonder how much we could pack on such a beast then
(perhaps one real MB }8-)} ) ?

Bill