[comp.sys.mac.programmer] trapping for floppy diskDOWN

jmatthews@desire.wright.edu (03/27/91)

>>>I am working on an init that traps on MountVol.  What I want to do
>>>is to distinguish between floppies and hard disks.  Can anybody help 
>>>me out?  Sample code would be appreciated.  Thanks in advance.

Here's some code to call the disk driver. The first drive in the
queue is

  currentDrive := GetDrvQHdr^.qHead^.drvQElem;

subsequent elements are

  currentDrive := currentDrive.qLink^.drvQElem;

You can call the driver's Control routine thus:

  function FloppySize (currentDrive: DrvQEl): Integer;
    var
      info: Integer;
      pBlock: ParamBlockRec;
  begin
    FloppySize := 0;
    with pBlock, currentDrive do
      begin
        ioVRefNum := dQDrive;
        ioRefNum := dQRefNum;
        csCode := 23; {IM V p 470}
        if PBControl(@pBlock, false) = noErr then
          begin
            info := BitAnd(csParam[1], $F);
            if info = 2 then
              FloppySize := 400
            else if info = 3 then
              FloppySize := 800
          end
      end
  end;

You might look at bits 8 through 11 for information about whether
a drive is SCSI/IWM (bit 9), or fixed/removable (bit 10).

The real question: "is the drive queue initialized at INIT
time?"

o----------------------------------------------------------------------------o
| John B. Matthews, jmatthews@desire.wright.edu, am103@cleveland.freenet.edu |
| "Say...what's a mountain goat doing way up here in a cloud bank?" - Larson |
o----------------------------------------------------------------------------o

russotto@eng.umd.edu (Matthew T. Russotto) (03/28/91)

In article <1991Mar26.231454.3002@desire.wright.edu> jmatthews@desire.wright.edu writes:

>The real question: "is the drive queue initialized at INIT
>time?"

Yes, though exactly which drives are in there I don't know.  Certainly the
boot drive is, and I think the floppies and all SCSI drives with drivers are.
I think CD-Rom drives are put in by the CD-ROM init.


--
Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
     .sig under construction, like the rest of this campus.