ADC Home > Reference Library > Technical Notes > Legacy Documents > Hardware & Drivers >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Forcing Floppy Disk Size to be Either 400K or 800K

CONTENTS

This document explains how to initialize a disk as either single- or double-sided. It only applies to 800K drives, of course.

Updated: [February 01 1986]






Calling the disk driver

You can call the disk driver to initialize a disk and determine programmatically whether it should be initialized as single- (MFS) or double- (HFS) sided. All you have to do is call the .Sony driver directly to do the formatting then the Disk Initialization Package to write the directory information.


Note:
This is not the way you should normally format disks within an application. If the user puts in an unformatted disk, you should let her or him decide whether it becomes single- or double-sided via the Disk Initialization dialog. This automatically happens when you call DIBadMount or the user inserts a disk while in Standard File. The intent of this technical note is to provide a means for specific applications to produce, say, 400K disks. An example might be a production disk copying program.


From MPW Pascal:

    VAR
      error:      OSErr;
      IPtr:       ^INTEGER;
      paramBlock: ParamBlockRec;     {needs OSIntf}
    ...
    WITH paramBlock DO BEGIN
       ioRefNum := -5;            {.Sony driver}
       ioVRefNum := 1;            {drive number}
       csCode := 6;            {format control code}
       IPtr:=@csParam;            {pretend it's an INTEGER}
       IPtr^:=1;                {number of sides}
    END;
    error:=PBControl(@paramBlock, FALSE);    {do the call}
    IF error=ControlErr THEN

    {you are under MFS, which doesn't support control code 6, but it}
    {would always get formatted single-sided anyway.}
    {other errors are possible: ioErr, etc.}

    END;

From MPW C:

    OSErr            error;
    CntrlParam        paramBlock;


    paramBlock.ioCRefNum = -5;    /*.Sony driver*/
    paramBlock.ioVRefNum = 1;    /*drive number*/
    paramBlock.csCode = 6;    /*format control code*/
    paramBlock.csParam[0]=1;     /*for single sided,2 for double-sided*/


    error=PBControl(&paramBlock, false);/*do the call*/
    if (error==controlErr) ;
    /*you are under MFS, which doesn't support control code 6, but it*/
    /*would always get formatted single-sided anyway.*/
    /*other errors are possible: ioErr, etc.*/

You then call DIZero to write a standard (MFS or HFS) directory. It will produce MFS if you formatted it single-sided, and HFS if you formatted double-sided.

Back to top

References

The Disk Driver

The Disk Initialization Package

Back to top

Downloadables

Acrobat gif

Acrobat version of this Note (52K)

Download


Back to top


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.