Appendix E.     SCSI Programming - and where to find information

        Under DOS, there are basically two programming interfaces for
        SCSI: ASPI and CAM.

        Depending on the software interface, programming is different
        - the software interfaces are either very complex (CAM) or have
        only a few basic calls (ASPI). Every approach has its drawbacks
        and its virtues - ASPI is easy to implement in a library, but
        really using ASPI on its low level is a mess when it comes to
        programming real device operations.
        CAM on the other side is harder to learn, for it has much more
        calls and basic operations, but most of those calls are on a
        higher level - you don't need to fumble the complete CDB
        (Command Descriptor Block) together for every basic SCSI command
        - it might be more productive in a longer-time view. However,
        if you search for info about ASPI, it is easier to find, as ASPI
        is far more widespread - although this may change in the future.

        At the moment, i should concentrate on MS-DOS code for the SCSI
        software interfaces. Windows either bypasses standard ASPI and
        CAM calls as DOS interrupt calls or - with WinASPI - has a
        similar interface that is vendor-specific (at least WinASPI
        seems to be supported only by Adaptec at the moment).

        OS/2 has a defined SCSI programming model, but also offers an
        optional ASPI for OS/2 layer over its own SCSI device model.
        With OS/2 3.0, a "Virtual ASPI" layer for the included DOS and
        Windows environments was added that allows the usage of DOS and
        Windows 3.x applications for ASPI. Windows 95 uses the Miniport
        driver model derived from NT.

E.1.    ASPI programming

        ASPI for DOS is basically an INT 21h interface. The interrupt
        21h is DOS' multifunction interrupt, so it was the obvious
        choice for including the ASPI call interface here. ASPI is a
        rather simple interface - it has only seven basic commands,
        which can be used to send all SCSI commands to devices.

        ASPI information is available mostly from Adaptec. The text-
        only ASPI spec documents are available from Adaptec's CIS forum
        and from their servers ftp.adaptec.com or www.adaptec.com).
        Adaptec also has a developer program called ACAP. Information
        about ACAP is available via a Fax-poll at ++1 (408) 957-7150.
        Request documents nr. 12010, 12020, 12030 .... 12070

        The german c't magazine has a rather good DOS ASPI library
        for Assembler, C and Pascal. It is available from the GERNET
        forum on CIS or from the c't BBS (see App. B.)

        If you want to dig deeper into ASPI for Windows development,
        it seems to be a good idea to spend $150 for Adaptec's ASPI
        developer kit with various sources, tools, and lots of
        information. Actually, Adaptec has an ASPI toolkit for Win32
        in the works, that should give better performance than the
        actual 16-bit version. For some time, the beta release is
        available on Adaptec's BBS in a special beta section.

        There are some ASPI-based tools available as source code,
        namely ASBENCH by TsuruZoh Tachibanaya and SCSILOOK by Brian
        Sawert. They are available from Compuserve (i'll check it again
        and, if i don't find them, upload it to the PC Hardware forum)


E.2.    CAM programming

        CAM is much different from ASPI - not only is it far more
        complex than ASPI at first sight, it is also implemented in a
        different way - CAM isn't integrated in some other interrupt,
        but uses an own interrupt.
        Originally, CAM was implemented at INT 4B, but after release 1.9
        this was changed to INT 4F - mainly to avoid interference with
        IBM's own SCSI interface variant (also CAM/Future Domain - based)
        and the VDS (Virtual DMA Services) interface.

        The CAM programming interface is described, as you would expect,
        in the CAM specification - actually only a working draft. It is
        available from the SCSI BBS and the latest version i have seen
        is Release 6. It has a large part about programming at the end,
        but it is a bit hard to read....

E.3.    other DOS SCSI interfaces

        There are also some other software interfaces for accessing SCSI
        devices, but none of them has any market importance now - most
        are simply old interfaces that became obsolete by ASPI and CAM,
        or proprietary drivers for specific devices.
        This includes, for example, Columbia Data Products' Standard
        Device Level Protocol (SDLP) that was used with the WD7000 FASST
        host adapters, SCSI BIOS variants from several vendors like
        Future Domain and Seagate that allowed direct sending of SCSI
        commands, Syquest's and IOMega's removeable disk drivers and
        other similar interfaces. As the proprietary interfaces can
        change anytime, if you need one of those, your only choice is
        to get the vendor's programming information - if any is available.


        Another valuable source of information is Ralph Brown's interrupt
        list that is supplied by most BBSes and CompuServe.
        Also, the interrupt list is offered as bound book:

        PC Interrupts:
        A Programmer's Reference to BIOS, DOS,
          and Third-Party Calls (second edition)
        Ralf Brown and Jim Kyle
        1210 pages
        Addison-Wesley
        ISBN 0-201-62485-0
        $39.95

        I found it very convenient to have a book instead of 4 Megabytes
        of text files, but look for the version of the electronic list
        - the book naturally is based on a much older version, so keep
        both handy.


E.4.    Device information

        If you want information about devices and their SCSI command
        set, in most cases you have to buy the manufacturer's OEM
        manual for the device - usually for about $100+. One
        noticeable exception is Seagate - they maintain a PDF version
        about the SCSI interface definition of their actual drives in
        Seagate's CompuServe Forum.

        SCSI host adapter manufacturers of course do have lots of
        information about the manufacturer-specific command sets, but
        sadly these usually are under a non-disclosure agreement. So,
        it usually isn't possible to get such device-specific
        information from, for example, Adaptec or Future Domain.

        If you have any device command information in electronic form
        that you're allowed to give away, please post it somewhere -
        for me <g> preferrably on CompuServe.


