SCSI Pseudocode
Initialization:
Begin in the Bus Free state
Arbitrate and Win the SCSI Bus
Select the Zip Disk as a target
Send an IDENTIFY message to prevent the Zip disk from disconnecting
Send a TEST UNIT READY command
Ignore the status and message returned
Disconnect from the Zip disk
Return to the Bus Free state
When "dir" command is entered:
Begin in the Bus Free state
Arbitrate and Win the SCSI Bus
Select the Zip Disk as a target
Send a TEST UNIT READY command
Store the status code but ignore the message returned
Disconnect from the Zip disk
Return to the Bus Free state
If Zip disk is not ready, output appropriate error
Else Arbitrate and Win the SCSI Bus
Select the Zip Disk as a target
Send a READ command and get the root directory
Loop through the data returned and print relevant directory info
Ignore the status and message returned
Disconnect from the Zip disk
Return to the Bus Free state
When "eject" command is entered:
Arbitrate and Win the SCSI Bus
Select the Zip Disk as a target
Send a TEST UNIT READY command
Store the status code but ignore the message returned
Disconnect from the Zip disk
Return to the Bus Free state
If Zip disk is not ready, output appropriate error
Else
Arbitrate and Win the SCSI Bus
Select the Zip Disk as a target
Send a START/STOP UNIT command with eject bit true
Ignore the status and message returned
Disconnect from the Zip disk
Return to the Bus Free state
When picture is available:
Arbitrate and Win the SCSI Bus
Select the Zip Disk as a target
Issue READ commands to sort through the FAT tables
Issue WRITE commands to link 11 available clusters
Issue WRITE commands to create a directory entry for our new file
Issue WRITE commands to store the image to disk
Ignore the status and message returned
Disconnect from the Zip disk
Return to the Bus Free state
|