Chapter Seven

DEVICE
DEPENDENT
COMMANDS

A Device Dependent Command is any command which is not Open, Close, Get Byte, Put Byte, or Status. When the command value in the IOCB is greater than 15 ($OF), CIO will call the Device Handler Device Dependent Command routine. The Device Handler must determine if the command is a valid command for that device. The Device Dependent Commands that for FMS are:

Rename
Delete
Lock
Unlock
Point
Note
Format
The FMS Device Dependent Command routine starts at DFMDDC.
DFMDDC
Address — $BA7
Entry Registers — 
A = Don't Care
X = IOCB number times 16
Y = Don't Care.
Exit Registers —   
A = Unknown.
X = IOCB and FCB number times 16
Y = Unknown.

Function:

1) Call SETUP
2) If the command is Format (254), then go to the Format routine, XFORMAT at $D18.
3) If the command is not Format, then check that the command value is $20 through $26. If the command value is not in this range then exit via the ERDVDC (Command Error) routine.
4) If the command is valid, go to the command via the DCDCVT vector table.
XFORMAT
The XFORMAT routine executes the FORMAT Device Dependent Command.
 
Address — $D18 
 
Entry Registers — 
A = Don't Care.
X = IOCB and FCB number times 16.
Y = Don't Care.
Exit Registers —   
A = Unknown.
X = Unknown.
Y = Unknown.

Functions:

1) Issue the format I/O command to the drive. This will cause the drive to perform the physical formating of the disk. If the command returns with good status and there were no bad sectors reported, then continue with the logical format operations. In the event of physical format errors, exit via the ERDBAD error exit.
2) Clear the drive buffer to zero.
3) Set the sector count values into the DVDMSN (VTOC displacement one) and the DVDNSA (VTOC displacement three) fields.
4) Set all 90 sector bit map bits to one (available).
5) Deallocate the first four sectors for the hoot sectors.
6) Deallocate the middle nine sectors for the VTOC and the Directory.
7) Write the VTOC to the Disk.
8) Clear the eight directory sectors to zero.
9) Exit via the FOREAT exit.
XDELETE
The XDELETE routine executes the DELETE Device Dependent Command.
 
Address — $C32  
Entry Registers —  
A = Don't Care.
X = IOCB and FCB number times 16
Y = Don't Care
Exit Parameters — 
A = Unknown.
X = Unknown.
Y = Unknown.

Functions:

1) The filename is decoded via the FNDCODE routine.
2) The first filename is searched for via the SFDIR routine.
3) The file, if found, is deleted via the XDELO routine.
4) If the file just deleted was DOS.SYS then the boot record is re-written via the DELDOS routine.
5) The directory is searched for the next matching entry. If an entry is found then the process repeats at step three. If no further matching directory entries are found, then exit via FGREAT.
XDELO
The XDELO routine is used to delete the file whose directory entry is indicated by the CDIRD (current Directory Displacement) byte ($1305).
 
Address — $C53
Entry Registers — 
A = Don't Care.
X = IOCB and FCB number times 16.
Y = Don't Care
Exit Registers —   
A = Unknown.
X = Unknown.
Y = Unknown.

Functions:

1) The OPVTOC routine is called to insure that the disk is not write protected.
2) The TSTLOCK routine is called to insure that the file is not locked.
3) The file deleted bit is set in the directory entry flag and the directory sector is written back to the disk.
4) The VTOC sector bit map bits for the sectors in the file are set to one to make them eligible for reuse. This process is achieved by reading each sector in the file sector chain and calling the FRESECT routine to change the VTOC bit map.
5) The VTOC Write Required Bit is set so that the VTOC will be written back to the disk.
XRENAME
The XRENAME routine executes the RENAME Device Dependent Command.
 
Address — $BD9
Entry Registers — 
A = Don't Care.
X = IOCB and FCB number times 16.
Y = Don't Care.
Exit Registers —   
A = Unknown.
X = Unknown.
Y = Unknown.

Functions:

1) The filename is decoded via the FNDCODE routine.
2) The directory is searched for the first entry to be renamed. If no entry is found then the ERFNF (File not found) exit is taken.
3) The TSTLOCK routine is called to insure that the file is not locked.
4) If TSTDOS determines that the old filename is DOS.SYS then the boot record is rewritten via the DELDOS routine.
5) If new filename is DOS.SYS, then the boot record is rewritten via the SETDOS routine.
6) The filename in the directory is changed to the new filename.
7) The directory sector is rewritten.
8) The directory is searched for the next filename match. If a match is found, then the process repeats at step three. If no further match is found then, exit via FGREAT.
XLOCK And XUNLOCK
The XLOCK routine executes the LOCK Device Dependent Command. The XUNLOCK routine executes the UNLOCK Device Dependent Command.
 
Address — $C7C
Entry Registers — 
A = Don't Care.
X = IOCB and FCB number times 16.
Y = Don't Care.
Exit Registers —   
A = Unknown.
X = Unknown.
Y = Unknown.

Functions:

1) The XLOCK entry sets the LOCK bit value, DFDLOC ($20), into TEMP4. The XUNLOCK entry sets a zero value into TEMP4. Both routines then go to XLCOM.
2) The filename is decoded via the FNDCODE routine.
3) The directory is searched for the first file entry match. If no match is found, the ERFNF (file not found) exit is taken.
4) The files directory flag is modified to either LOCKED or UNLOCKED by means of the value previously set into TEMP4.
5) The Directory sector is written back to the disk.
6) The CSFDIR routine is called to find the next filename match. If a match is found, then the process repeats at step four. If no match is found, then exit via FGREAT.
XPOINT
The XPOINT routine executes the POINT Device Dependent Command.
 
Address — $CBA
Entry Registers — 
A = Don't Care.
X = IOCB and FCB number times 16.
Y = Don't Care.
Exit Registers —   
A = Unknown.
X = Unknown.
Y = Unknown
.
Functions:
1) If the FCBFLG indicates that the file can acquire sectors (Opened for Output or Append), then exit via the ERRPOT (point error) exit.
2) If the current sector is not the same as the sector POINTed to by the IOCB AUX3 and AUX4 fields, then write the current sector back to the disk (if it has been changed).
3) Read the POINTed to sector into the sector buffer.
4) Set the FCB next byte pointer, FCBDLN, to the value indicated by the user Point data in the IOCB AUX5 field.
5) Exit to FGREAT.
XNOTE
The XNOTE routine executes the NOTE Device Dependent Command.
 
Address — $D03
Entry Registers — 
A = Don't Care.
X = IOCB and FCB number times 16.
Y = Don't Care.
Exit Registers —   
A = Unknown.
X = Unknown.
Y = Unknown.

Functions:

1) The current sector number and data displacement into the sector is moved to the appropriate IOCB fields, ICAUX3, ICAUX4, ICAUX5.
2) Exit via GREAT.

Return to Table of Contents | Previous Chapter | Next Chapter