Scsi Version 1.0

     The code you received with this file is a very simple SCSI device
driver that uses the Seagate ST-01 interface card.  As this driver is
my first PC assembler project other then "hello world", please don't
snicker to loudly.

     The package includes the source for a device driver that will scan
the SCSI bus for disk drives and partition any drives found into chunks
of 32Meg plus any leftovers.  As soon as I discover a way to get DOS to
let me use > 512 byte sectors, It will just allocate the entire disk to
a single logical drive.  It also includes a utility to access the low
level SCSI format function for any disk found.  You may specify the
interleave when the low level format is done and the version of the
driver here seems to work fine at 1:1 with my 8Mhz NEC.

     Some of the things to look out for are:

#1 The receive_data and send_data functions in subs.asm use polled I/O
   to transfer data to/from the card.  I would have loved to just use
   the I/O Channel Ready line that the card is suppose to support, but
   my NEC does not seem to use that line.  Hence the polling of the REQ
   bit in the status port.

#2 I did not know how to do clock speed independent timing loops, so there
   is a wait100us function in subs.asm that is very processor speed
   dependent :-(

#3 In ioctl.asm there is a commented out call to scsi_verify.  This is
   used by the DOS format utility to scan for errors.  You may want to
   enable the call after you get everything setup.  I shut it off while
   I was testing as I didn't want to wait for the verify everytime I
   changed the interleave.

     To bring up the driver.  Assemble and link scsi.sys and add it to
your config.sys file.  After rebooting, you may optionaly do a low level
format of each disk found using sformat.exe.  You then use the DOS format
utility on each logical drive.  I did figure out just what format needed
in the way of ioctl support to get it to do the high level format for me.
At this point you should have fully functional DOS drives.  In testing
I found that with multi_sector support (subs.asm) enabled, the SCSI drives
were just about as fast as the ST-412 C: that came with the machine.  I
am sure that the speed problem is basic to the inner loop of the data
transfer routines, but I'm at a loss to figure out how to speed it up.

     Anyway, maybe someone can find some use for the code.  I got the
card for free, so I can't really complain about the speed or cost too
much :-)

     Also thanks to the people that sent me samples of other device drivers
for the PC.  I lost the names to a disk crash, but here is the result of
your help and my thanks.

Scsi Version 1.1

     This version of the driver add support for a single tape drive, and
cleans up some of the code a little.  It also adds a file that has equates
to customize some of the major areas of the driver.

     When the driver is initialized it does a scan of the SCSI bus for
devices.  The FIRST tape device found is assigned to a char device with the
name "SCSITAPE".  If no tape drive is found, the char device is still valid
but will generate a "bad unit" error when accessed.

     The SCSITAPE device expects reads and writes to be done in some variation
of 512 bytes.  I/O done where (size mod 512) is non-zero will generate an
error.  Tape access must be done in RAW mode, and this is where I had to
some code in the driver that I'm not sure is very pretty.  The problem is
that DOS insists on opening char devices in cooked mode.  It does give you
the ability to switch to RAW mode, but only by using 'intdos()' to access
the ioctl interface.  The MSC 'setmode()' call for binary will not effect
char devices, nor will opening the file with O_BINARY.  So I had two choices.
I could modify every program that expected to talk to the tape so that it
also issued the ioctl stuff (see binmode.c), or I could kludge the driver
to issue the required calls.

     In the end, I punted and did both.  The code in binmode.c is the function
that along with 'setmode()', will make sure that ANYTHING you open is accessed
in RAW mode.  Simply check for any call to 'setmode()' that is switching to
O_BINARY, and add another call to 'binmode()'.  This assumes that you have
the source to the utility in question.  For those who are don't mind a little
kludge amount friends.  The file options.inc has an equate called 'use_kludge'
that when enabled turns on some code in kludge.asm.  This code links into the
INT 21h vector and waits for a DOS open request to go by.  When it sees an
open request, it 'calls' rather then 'jmps' to the normal vector.  This allows
the driver to get the 'handle' returned by DOS.  Because the SCSITAPE device
enables the driver_open function, I can tell from the fact that an open is
in progress and wether the driver just got an open request, wether any
particular open was for me.  When the open was in fact for the SCSITAPE device,
I take the 'handle' returned by DOS and forge the required ioctl calls to
switch to RAW mode.

     With the addition of tape support.  I now use GNU Tar to swap tapes with
my normal UN*X system at work.  The driver works well enough that I have yet
to have a format problem with the different systems.  It is also a lot faster
when doing backups on the PC.  Using 'fastback' I would get about 1 Meg a
minute thruput on my 8 Mhz AT.  Using GNU Tar and the SCSITAPE device I get
> 2.5 Meg a minute to the tape and don't have to swap disks quite so often :-)

     Anyway, I hope that someone out there actually gets some use out of this
code.  It has been a real adventure for me.

Scsi Version 1.2

     This version of the driver enhances the tape drive support by adding
a program to control the action of the tape drive, and move around within
multiple containers on the tape.  As I used the Bezerkley 'mt' command for
ideas, the program is naturally called 'mt'.  You can tell the driver to:

#1 Rewind/No Rewind on close.
#2 Erase the tape.
#3 Step forwards or backwards X tape marks.
   Note: the command 'mt -s 0' steps to End Of Data.

     I also did a little more work on the routines that actually transfer
date to/from the card.  I found that I had left out a check for timeout
in the inner loops of the the data xfer routines.  When the random parity
error or other glitch occured.  The driver would hang forever.  Not very
friendly...  The added code does not seem to slow the driver any, or at
least the disk thru-put tester I use shows no difference.

     As the driver seems to be stable now, and it does about everything
I started out to do.  I'm going to post this to comp.sources.misc instead
of alt.sources in the hopes that more people will see it.  Hopefully this
will be usefull to someone else (at least they might get a good chuckle).

Scsi Version 2.0

     This is release 2.0 of my SCSI driver for the Seagate ST-01 card.
It major feature is support for large drives under DOS 4.0 and higher.
It also refines the support for the tape driver and handles multiple
containers per tape now.  It also includes a simple remap utility for
mapping out bad sectors on hard disks.
