[comp.sys.atari.st] Hard Disk info

schoepf@DMZRZU71.BITNET (06/06/87)

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
   <SCHOEPF@DMZRZU71.BITNET>

dyer@atari.UUCP (06/07/87)

in article <8706060844.AA10957@ucbvax.Berkeley.EDU>, schoepf@DMZRZU71.BITNET says:
>       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>       |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

Slight nitpick: Those aren't "don't care" bits --- they are
reserved and should be zero.  These bits are documented in the ST
BIOS Reference Manual....

-- 
-Landon Dyer, Atari Corporation	       {sun,amdcad,lll-lcc,imagen}!atari!dyer
The views expressed here do not necessarily reflect those	     SEGMENTS
of Atari or the AI software that has taken over my brain.	      ARE FOR
Yow!  I am waiting for my warranty-expired interrupt!			WORMS

fischer-michael@YALE.ARPA (Michael Fischer) (06/22/87)

Landon Dyer says:
> Slight nitpick: Those aren't "don't care" bits --- they are
> reserved and should be zero.  These bits are documented in the ST
> BIOS Reference Manual....

Maybe in your version, but not in the one I paid $300 for with my
Developer's Kit.  In fact, I've never seen the "ST BIOS Reference
Manual"; the documentation I have on the BIOS comes from "The
Hitchhiker's Guide".  How can I get reference manual or an updated
"Hitchhiker's Guide"?

*** FLAME ON ***
Why does Atari seem to work against its developers?  I called Atari
almost a year ago trying to find out how to read the partition sector
on the hard disk and was told that that information was not public
and that they would not tell me.  Now I know the answer because
of the kindness of Schoepf, but no thanks to Atari.  Similarly,
people at Atari have been booting from their hard disks for months
but they wouldn't let anyone else in on the act.  I now am also
booting from my hard disk, but courtesy of Konrad Hahn, not Atari.

Come on, guys.  Why do you want your developers wasting their time
reconstructing information and recreating programs that you already
have in-house?  Wouldn't you rather that they be spending their
time on nifty new software that will sell more machines?
*** FLAME OFF ***

--Mike Fischer  <fischer@yale.arpa>
-------

D.Wade@sysd.salford.ac.UK (02/23/90)

Will the Michael @ unido.informatik.uni-dortmund.de who tried to send mail
back via UKC either post his reply to the net or try sending it to MS2@UKACRL
as UKC won't talk to salf.d. Ta. (Sorry for using net bandwidth like this but
sometimes getting mail to the UK is about as easy as getting info from ATARI)
 
 Sorry no signature file but replies outside the UK may be sent to:-
 D.WADE@D.SALF.AC.UK - Most Places, MS2@UKACRL - Bitnet.