
*****************************************************************
*								*
*	NOTE:   IF YOU USE THE DISKSPARE.DEVICE FOR YOUR	*
*	PROGRAMS YOU HAVE TO COPY THIS DOC.FILE TOO !!!!	*
*								*
*	Note:                        				*
*	I can only support your program in future releases	*
*	of the device, if you send me a FREE copy.		*
*								*
*****************************************************************

TABLE OF CONTENTS

diskspare.device/CMD_Remove
diskspare.device/CMD_GetGeometry
diskspare.device/CMD_RawRead
diskspare.device/CMD_RawWrite
diskspare.device/CMD_Eject
diskspare.device/Open

The other commands work like the corresponding trackdisk cmds.

KNOWN BUGS:	* The value of dg_CylSectors returned by GetGeoMetry
		  is wrong.
		  Fixed in V2.0.
		* The Device doesn't support ETD_Cmds correctly.
		  Fixed in V2.1.
		* The Device returns an Error IOERR_BADADDRESS
		  if the adress of IO_DATA is odd (PFS only).
		  Fixed in V2.1.
		* If remove is called twice, the System crashes.
		  Fixed in V2.1.
		* Error in CloseDevice: Maybe a RemPort on a Port 
		  which wasn't added -> Crash (caused by register mistake)
		  Fixed in V2.1
		* Error in TD_FORMAT: Doesn't do an Update but flushes
		  the trackbuffer. (PFS only)
		  Fixed in V2.2
		* It was possible to read/write beyond the last track.
		  Fixed in V3.0
		* Error in CMD_READ: Trackbuffer not cleared although disk
		  changed. (PFS only)
		  Fixed in V3.0
		* Enforcer hit in initport.
		  Fixed in V3.0
		* Error in WaitIO: under some strange conditions, there might
		  be write errors (signalbits not cleared! V3.0 only)
		  Fixed in V3.1

NAME		Remove

FUNCTION	If you are not the FastFileSystem, and I guess 
		you aren't, NEVER call Remove ! 
		It's no use calling Remove !!
		The best thing is to forget that there's a 
		cmd called Remove !!! 
		IF you call this forgotten cmd and the DD<>HD
		autoswitch is enabled (Bit 2 in Flags is set), the 
		system WILL crash !!!!
		If you want to add a diskchange-int, use the
		addchangeint/remchangeint cmd instead.
		
		Why was this patch necessary ?
		Because there's a restriction in the FFS: It checks, 
		if the devicename is 'trackdisk.device' and if it 
		isn't, GetGeometry won't be called.
		
		I tried to fix the disksize in the dosenvec-struct
		and all programs like FixDisk, DiskSalv, Format etc 
		worked fine. BUT the FFS said 'Not a DOS Disk'...
		
SEE ALSO	Includes/exec/alerts.i

BUGS		If Remove was called twice, the System crashed.
		Fixed in V2.1.

NAME		GetGeometry

FUNCTION	Works like trackdisk.
		There are two possibilities for Sectors per Track:
		12 sectors/track and 24 sectors/track.
		You have to check this after each diskchange !
		New for V3.0:
		You get always the right disksize. 
		The HD mode always works (with HD drives). 
		Please check version number.
				
SEE ALSO	AutoDocs/trackdisk.doc

BUGS		There was a bug in the first release (V1.6):
		The value returned in dg_CylSectors was wrong.
		I forgot an 'ext.l', so the contents of the 
		high order word was rubbish. Fixed in V2.0.
		

		
NAME		RawRead

FUNCTION	No Function ! Returns IOERR_NOCMD. Use trackdisk
		device for rawread.

		
		
NAME		RawWrite

FUNCTION	No Function ! Returns IOERR_NOCMD. Use trackdisk
		device for rawwrite.
		
		
		
NAME		Eject

FUNCTION	No Function ! Returns IOERR_NOCMD. Use trackdisk
		device to eject (if you've got a drive which ejects).
		
		
		
NAME		OpenDevice

FUNCTION	Opens the device with a drive-specific set of flags.
		There's something special about the flags:
		
		If the device wasn't opened yet, everything works as
		usual. If the device was already opened (via Mount)
		your flags will be ignored, but the device won't 
		return an error. (Some well known programs crash
		when an OPENFAIL was returned ??? They obviously
		don't use the fssm_Flags when opening AND don't 
		check for errors ?¿?)
		
		The active flags are returned in IO_ACTUAL. So you 
		can check whether the flags fit your needs or not.		
		
		Why ?
		If the user has mounted the device with HighCyl = 79
		then it's his decision not to use it and you HAVE TO 
		accept that. It's the users Amiga not yours. 

		The minimum you get is:
		
		heads:			  2
		tracks:			160
		sectors/track:  	 12/24
		bytes/sector:		512		
		
		# of sectors:	       1920/3840
		total bytes:	     983040/1966080


SEE ALSO	AutoDocs/exec.doc/opendevice
		 

FLAGS
		BIT	0	0: disable diskchange for DFX:
				1: enable diskchange for DFX:
		Works only when mounting the device with the FastFileSystem.
		When you open the device and don't call the forgotten
		cmd the diskchange-int of the corresponding trackdisk
		drive won't be affected.
		
		BIT	1	0: HighCyl is Cyl. 79
				1: HighCyl is Cyl. 81
		When set to '1' trackdisk WILL be patched everytime a
		track is read/written from/to disk!
		
		BIT	2	0: DD and HD mode are now available.
				   That's new. Check the device version.
				1: Autodetection of DD/HD-disks for the
				   FastFileSystem, too. It is patched.
		Call GetGeometry to get the right disksize. See above.
		The patch for the ffs is in the remove cmd. So if you
		open without bit 1 set and don't call the forgotten cmd
		NOTHING is patched !!
				
		Version 2.2:
		BIT	3	0: Use any Mem for trackbuffer
				1: Try to use Mem from $600000 - $A00000
				   If there's no memory at this location
				   any other mem is used.
		Why ? I've got an A2000 with A2630 (which has it's mem at
		$200000-$5FFFFF) and a 16bit Ramcard at $600000 - $A00000.
		So why should I use the 32bit ram (which is prefered when
		calling allocmem) for a trackbuffer ?
		This bit may be useful for A3/4000 with 16bit ramboards too.
		Version 3.0:
		BIT	3	isn't used.
		
		Version 3.0:
		BIT	4	0: Normal write mode.
				1: Verify write mode. Each write will be
				   verified by the device itself. This nearly
				   half the write speed but you're sure the
				   data on disk is ok. Useful with cheap
				   disks.				 
	
		BIT	5-31	are currently unused and RESERVED.				


NOTES		

	HD-Mode:
	To check if the drive is a highdensity one you may call
	GetUnitID from the disk.resource. Here are the Results:
		
	No Disk in any Drive	->	returns 0x00000000
	Any Disk in a DD Drive	->	returns 0x00000000
	A DD-Disk in a HD Drive ->	returns 0x00000000
	A HD-Disk in a HD Drive	->	returns 0xAAAAAAAA
	No Drive connected	->	returns 0xFFFFFFFF
		
	As you can see, it's not possible to check if the drive
	is a HD one, if there's no HD Disk in it.
	Don't care about that. Simply call GetGeometry to get the
	right disksize. BUT it may be differently for each disk (DD/HD).

        AddChangeInt:
        If you've already added a ChangeInt with the trackdisk.device,
        you needn't add one with diskspare.device because it's directly 
        passed through to the trackdisk.device.

	Inhibit:
	It's a good idea to inhibit the corresponding trackdisk drive
	(DFX) when accessing the disk via diskspare.device. Also
	check for mounted diskspare drives. Don't rely on the names 
	DS0: to DS3: when you inhibit the DOS. 
	The device itself can't inhibit the DOS because a task isn't 
	allowed to call a dos.lib function.
	
	
	General:
	The main purpose of this device is to be mounted with the
	FastFileSystem. So always remember that you may not be the 
	only accessor !!
		
	
