Apple II Technical Notes _____________________________________________________________________________ Developer Technical Support GS/OS #11: About EraseDisk and Format Revised by: Matt Deatherage November 1990 Written by: Dave Lyons & Matt Deatherage July 1990 This Technical Note explains how an application can tell when a user chooses Cancel from an EraseDisk or Format dialog box and explains why thefile_sys_ID field is ignored in class-zero calls. Changes since July 1990: Noted that System Software 5.0.3 fixes some of these anomalies. _____________________________________________________________________________ Detecting a Canceled Erase or Format Dialog Box GS/OS Reference says that EraseDisk and Format return with the carry flag set and A equal to zero when the user cancels the operation. This is great, except that the calls actually return with the carry clear, making a Cancel hard to distinguish from a successful EraseDisk or Format operation. This happens in System Software 5.0.2 and earlier; it works as documented in GS/OS Reference in System Software 5.0.3 and later. If you must use 5.0.2 or earlier versions of the system software, this Note presents a safe way around the problem, which works with all versions of the System Software: 1. In the parameter block for class-one EraseDisk or Format, set the fileSysID field to 0. (See note below.) 2. Make the call. 3. If the error code is non-zero, there was an error. Handle it. 4. Otherwise, the error code is zero. Check the fileSysID field in the parameter block. If it is still zero, the user chose to cancel the operation. Note that this method only works for class-one calls. For the class-zero ERASE_DISK and FORMAT calls, the file_sys_ID word is only an input parameter and always remains unchanged. About the Class-Zero file_sys_ID Parameter Even though fileSysID is an input parameter for the class-zero calls ERASE_DISK and FORMAT, all versions of the system software ignore thesupplied value and always give the user a dialog for selecting a file system. This means no functionality is lost by putting a zero there. The reasons for this decision are historical. Although the Apple IIgs ProDOS 16 Reference indicates that the input parameter file_sys_ID would be used in future versions to choose destination file systems, ProDOS 16 always returned an error if the file system specified was not $0001 (ProDOS). Since this effectively means no ERASE_DISK or FORMAT call can be made under ProDOS 16 with any file_Sys_ID other than $0001, the GS/OS team chose to ignore the parameter and always give users the choice when using class zero calls. Otherwise, no program that existed when GS/OS was released would ever allow users to choose interleaves or file systems (they would always format for ProDOS, file system $0001). (Note that the class-one Format andEraseDisk calls have a new reqFileSysID parameter; if this field is present, the dialog box is bypassed.) Further Reference _____________________________________________________________________________ o GS/OS Reference o Apple IIgs ProDOS 16 Reference