[comp.sys.mac.programmer] How does DIZero

dan@hpnmdla.HP.COM (Dan Pleasant) (02/01/91)

Here's a wildly arcane questions for all the Mac disk experts on the net
which I'm asking for a friend who does not have net access.

As the last step of disk initialization, the system makes a call
to DIZero(), which writes zeros on all the sectors of a disk.
How does DIZero() know how many tracks/sectors to zero out?
For a floppy disk, I assume DIZero() just queries the hardware
to find out what kind of foppy is in the drive.  But what about
removeable hard disks and other non-floppy drives?

My friend, who has spent some time trying to figure this out, claims
that he has seen the system zero out 1004 (hex) blocks on a large
drive and 1008 (hex) on a smaller drive, which seems strange to me.

Anybody know the internals of DIZero()?  What in the world is it
doing?

Many thanks to all responders.  If there is interest, I'll be happy
to re-post the answer to the net.

Dan Pleasant

time@tbomb.ice.com (Tim Endres) (02/02/91)

In article <450016@hpnmdla.HP.COM>, dan@hpnmdla.HP.COM (Dan Pleasant) writes:
> As the last step of disk initialization, the system makes a call
> to DIZero(), which writes zeros on all the sectors of a disk.
> How does DIZero() know how many tracks/sectors to zero out?
> For a floppy disk, I assume DIZero() just queries the hardware
> to find out what kind of foppy is in the drive.  But what about
> removeable hard disks and other non-floppy drives?

The code simply looks in the Drive Queue data structure for the drive
that is being zeroed for the number of Macintosh sectors on the drive.
Since DIZero() works through the drive's driver, the driver handles
mapping these Macintosh sectors to the appropriate device sectors.

tim.

-------------------------------------------------------------
Tim Endres                |  time@ice.com
ICE Engineering           |  uupsi!ice.com!time
8840 Main Street          |  Voice            FAX
Whitmore Lake MI. 48189   |  (313) 449 8288   (313) 449 9208