Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!math.fu-berlin.de!opal!unido!mcshh!abqhh!drdhh!bjoern From: bjoern@drdhh.hanse.de (Bjoern Kriews) Newsgroups: comp.sys.atari.st.tech Subject: Re: Hard Disk Sector 0 Questions Message-ID: <2231.03.91@drdhh.hanse.de> Date: 12 Mar 91 21:40:00 GMT References: <5208@mcrware.UUCP> Organization: Digital Island Lines: 78 From article <5208@mcrware.UUCP>, by ric@mcrware.UUCP (Ric Yeates): > I need to write some software to add partitions to the partition table > stored on sector 0 of a hard disk. > * the table entries are in the following form: > struct part_entry { WRONG !!! flag has to be here, bit 7 means bootable > char name[3]; > long start; /* 32-bit sector number */ > long length; /* 32-bit length in sectors */ > char flag; /* 1 byte flag where 0x01 means bootable */ > }; > 1. Is any of the above information inaccurate? Incomplete? Yes. :-) More questions answered below. > 5. How might an application read sector 0? All the GEMDOS calls I found > dealt with files only, not the whole device. If you detect an AHDI or compatible driver, you can set bit 3 in the Rwabs() mode-word to read physical sectors, but to be safe you will have to use direct DMA access. (Ask your Microware devdrvr writers) In germany, there's a VERY good book, called 'Scheibenkleister', published by Maxon. It's about all mass-storage devices on the ST. I don't think that there is an english version, so you'll have to search somebody reading ger-mish - it worth the action. I include the C definitions I use for such tools: (ICD/Supra Rootsectors only - there are official docs from Atari describing HDX 3.0 Format, but they are (c), so you have to ask Atari. Hope that helps, Bjoern --------- #define PART_EXIST 1 #define PART_BOOT 128 /* partition definition */ struct part { unsigned char flag; /* bit 0: exists bit 7: boot */ unsigned char id[3]; /* partition name */ unsigned long start; /* start sector */ unsigned long size; /* size in sectors */ }; /* rootsector structure */ typedef struct { unsigned char prg[0x150]; /* bootprogram */ unsigned char version; /* rootsector version number */ unsigned long cbhd; /* Driver magic longword */ struct part extp[8]; /* extended parts SED/ICD/Supra */ unsigned int hi_cc; /* cylinders on disk */ unsigned char hi_dhc; /* number of heads */ unsigned char filler; /* unused */ unsigned int hi_rwcc; /* reduced current start */ unsigned int hi_wpc; /* write precomp start */ unsigned char hi_lz; /* landing zone distance */ unsigned char hi_rt; /* steprate */ unsigned char hi_in; /* interleave */ unsigned char hi_spt; /* sectors per track */ unsigned long hi_size; /* total size in sectors */ struct part p[4]; /* atari hdx<3.0 partitions */ unsigned long bsl_start; /* bad sector list start */ unsigned long bsl_count; /* number of sectors in bsl */ unsigned int checksum; /* fixup for $1234 */ } ROOTBLK; * * bjoern@drdhh.hanse.de / Bjoern Kriews, D-2000 Hamburg 76 *