Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-lcc!ames!ucbcad!ucbvax!DMZRZU71.BITNET!schoepf From: schoepf@DMZRZU71.BITNET Newsgroups: comp.sys.atari.st Subject: hard disk info Message-ID: <8706060844.AA10957@ucbvax.Berkeley.EDU> Date: Sat, 6-Jun-87 04:45:30 EDT Article-I.D.: ucbvax.8706060844.AA10957 Posted: Sat Jun 6 04:45:30 1987 Date-Received: Wed, 10-Jun-87 02:58:24 EDT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 62 Gerry Wheeler (wheels@mks.uucp) asked me how to look at the partition info on the hard disk. Since it seems that my answer didn't get through the gateways, and since this is certainly of general interest, I send it to this list. So here's how I read and modified the hard disk's partition information: The partition info is located on logical sector 0. Normally you cannot access it because this is the sector just before the boot sector of the first partition (i.e. BEFORE sector 0 of this partition). The reason for this is that all sector numbers you specify are translated according to the partition information. But there is a hook! Take the BIOS function rwabs (function #4). It's calling sequence is rwabs(rwflag,buffer,count,recnr,dev) long buffer; int rwflag,count,recnr,dev; where: dev: number of device (A = 0, B = 1,...) recnr: number of first sector you want to read count: number of sectors buffer: buffer to read into rwflag: special parameter, individual bits are interpreted as follows: +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |X|X|X|X|X|X|X|X|X|X|X|X| | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \__________ __________/ | | | \______ 0 = read, 1 = read V | | |________ 1 = ignore media change "don't care" | |__________ (hard disk only) | 1 = no retries |____________ (hard disk only) 1 = recno is absolute This means: if you set rwflag = 0/1, you read/write the sectors of the specified partition. If you set it to 8/9 you read/write the sectors of the whole hard disk INDEPENDENT OF THE PARTITION. (This is an undocumented feature, I discovered it by disassembling the hard disk driver program.) To read the hard disk's boot sector you write rwabs(8,buffer,1,0,2); To write it, call rwabs(9,...) The length of the sector is 512 bytes, so buffer should be at least as long as this. Content of the boot sector: In the little booklet you got together with your hard disk there is a table what is contained in sector 0 and how the partition information is written. Just look at the addresses given there. The rest of the boot sector you can use for your own purposes. (Konrad Hahn's hard disk boot program does this.) Rainer Schoepf