[net.micro.mac] Undocumented driver control codes?

vishniac@wanginst.UUCP (Ephraim Vishniac) (08/26/85)

In the course of debugging a ramdisk driver, I've found that there are
several undocumented(?) control codes that the finder uses to interact with
disk drivers.  The clearly documented ones are:
	1 = kill (abort operation in progress and any queued operations)
	7 = eject (spit disk)
	8 = set tag buffer

The undocumented ones are:
	6 = erase (whole disk?  some fixed number of sectors?  some given
			number of sectors?)
	$14 = ?
	$15 = ?

Code 6 is used only when the disk is erased.  Codes 14 and 15 seem to be used
whenever the volume is mounted.  The .Sony driver does not support any of
these - it just returns -$11 (controlErr) for any code except 1, 7, or 8.
The Assimilation process ramdisk acts on code 6 by erasing as many sectors
as given by the word at ApplScratch in low ram.  I don't think that's right.
My disk behaves acceptably if I erase the boot, map, and directory sectors
in response to a 6.

Does anyone know what $14 and $15 are supposed to do?  Does anyone know
*for certain* what 6 is supposed to do?

Also, a bug in Macsbug:  when disassembling moveq instructions with negative
contants, the constant is complemented.  For example, moveq #-$11,d0 would
disassemble as moveq #-$6f,d0.  (And vice-versa!)

-- 
Ephraim Vishniac
  [apollo, bbncca, cadmus, decvax, harvard, linus, masscomp]!wanginst!vishniac
  vishniac%Wang-Inst@Csnet-Relay

steve@anasazi.UUCP (Steve Villee) (08/29/85)

> In the course of debugging a ramdisk driver, I've found that there are
> several undocumented(?) control codes that the finder uses to interact with
> disk drivers.  The clearly documented ones are:
> 	1 = kill (abort operation in progress and any queued operations)
> 	7 = eject (spit disk)
> 	8 = set tag buffer
> 
> The undocumented ones are:
> 	6 = erase (whole disk?  some fixed number of sectors?  some given
> 			number of sectors?)
> 	$14 = ?
> 	$15 = ?
> 
> Does anyone know what $14 and $15 are supposed to do?  Does anyone know
> *for certain* what 6 is supposed to do?

I have done a bit of poking around myself.  I think code 6 is supposed to
mean format (the entire disk).  There is also code 5, which I think means
verify formatting (on the entire disk).

I base this on a disassembly of the Disk Initialization Package (_Pack2),
which is quite interesting.  The code to handle _Pack2 function 6 (format),
for example, checks to see whether the drive is a Sony drive.  If it is,
it performs the formatting by itself using a bunch of very low level code,
some of which seems to be duplicated out of the Sony driver.  If the drive
is not a Sony drive, then it just does a _Control with csCode = 6.  The
code to handle _Pack2 function 8 (verify) is similar, but in the case of
a non-Sony drive it does a _Control with csCode = 5.

By the way, where is csCode 8 (set tag buffer) "clearly documented"?
There is a section of my Inside Macintosh labelled "Disk Driver", but it
is completely empty!  Do I just have an old/defective copy of IM?  I
would certainly be interested in any available information on the Sony
driver and the general disk driver interface.

--- Steve Villee (ihnp4!mot!anasazi!steve)
    International Anasazi, Inc.
    2219 East University Drive
    Phoenix, Arizona 85034
    (602) 275-0302

lsr@apple.UUCP (Larry Rosenstein) (08/30/85)

In article <984@wanginst.UUCP> you write:
>In the course of debugging a ramdisk driver, I've found that there are
>several undocumented(?) control codes that the finder uses to interact with
>...
>The undocumented ones are:
>	6 = erase (whole disk?  some fixed number of sectors?  some given
>			number of sectors?)
>	$14 = ?
>	$15 = ?
>

$14 and $15 are documented in the "May" Software Supplement in the
memo "Finders and Foreign Drives".  These are used to assign custom
icons to different types of hard disks.

$14 was issued by Finder 1.1g as a request for the ID of the icon to
use in displaying that disk.

$15 is issued by Finder 4.1 to do a similar thing, because an icon ID
is tied to a particular System file.  This new control call is
supposed to return a pointer to a block containing an ICN# followed by
a 1..31 byte Pascal string.  (The string is used in the GetInfo
boxes.)  If the $15 call fails, the Finder reverts to a $14 instead.


-- 
Larry Rosenstein
Apple Computer

UUCP:  {voder, idi, nsc, ios, mtxinu, dual}!apple!lsr
CSNET: lsr@Apple.CSNET