home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / asm / aspiprog / aspiprog.doc < prev    next >
Encoding:
Text File  |  1991-08-22  |  23.2 KB  |  667 lines

  1.  
  2. ;****************************************************************************
  3. ;*
  4. ;*  Welcome to ASPI.  The following code is provided to assist you with 
  5. ;*  writing code to the Advanced SCSI Programming Interface (ASPI).  Run the 
  6. ;*  program ASPIPROG.EXE to see what the following program does when compiled.
  7. ;*
  8. ;*  The only support provided for ASPI developers by Adaptec is through this 
  9. ;*  sample code and the ASPI specification, which can be ordered through 
  10. ;*  Literature at (408) 945-8600 x2579.  The ASPI specification is available
  11. ;*  for DOS, OS/2, and NetWare 386.  Please do not call the Adaptec technical
  12. ;*  support line with ASPI programming questions.
  13. ;*
  14. ;*  This sample code provides examples of how to use the ASPI    programming
  15. ;*  interface.  The main program obtains the ASPI entry point    and calls
  16. ;*  subroutines for the different ASPI functions.
  17. ;*
  18. ;*    1. Obtains ASPI Entry Point
  19. ;*    2. Executes ASPI Host Adapter Inquiry Command
  20. ;*    3. Executes ASPI Get Device Type Command
  21. ;*    4. Executes ASPI Execute SCSI I/O Command
  22. ;*    5. Executes ASPI Reset SCSI Device Command using Posting
  23. ;*    6. Executes (3) and then executes ASPI Abort SCSI I/O command
  24. ;*
  25. ;*
  26. ;****************************************************************************
  27.         .286
  28.         .xlist
  29.         include aspidefs.inc    ;include file for ASPI definitions
  30.         include scsidefs.inc    ;include file for SCSI definitions
  31.         .list
  32.  
  33.         .MODEL Small
  34.         .STACK 300h
  35.  
  36. ;****************************************************************************
  37. ;    DATA SEGMENT
  38. ;****************************************************************************
  39.         .DATA
  40. SCSIMgrString    db    "SCSIMGR$"      ;SCSI Mgr String (need to get entry)
  41.         dw    0        ;NULL-Terminate String
  42. ASPI_Entry    dd    0        ;Entry Address stored by GetASPIEntry
  43. SRB        db    64+10+14 dup (0) ;SCSI Request Block
  44. SRB2        db    64+10+14 dup (0) ;SCSI Request Block 2
  45. Data_Buffer    db    50 dup (?)    ;Data Buffer for Inquiry command
  46. Flag        db    0        ;flag used by post routine
  47.  
  48. ;****************************************************************************
  49. ;    DISPLAY STRINGS
  50. ;****************************************************************************
  51. Str_InquiryFail db  "Error issuing SCSI inquiry command",CR,LF,'$'
  52. Str_NoASPI    db  "Unable to open ASPI Manager!",CR,LF,'$'
  53.  
  54. Str_ASPI_Stat    db  "  ASPI Status (HEX)               : %",CR,LF,'$'
  55.  
  56. Str_HA_Inquiry    db  CR,LF,"ASPI HOST ADAPTER INQUIRY COMMAND",CR,LF,'$'
  57. Str_Num_HA    db  "  Number of Host Adapters         : %",CR,LF,'$'
  58. Str_TID_HA    db  "  SCSI ID of Host Adapter 0       : %",CR,LF,'$'
  59. Str_Mgr_ID    db  "  SCSI Manager ID                 : %%%%%%%%%%%%%%%%",CR,LF,'$'
  60. Str_HA_ID    db  "  Host Adapter ID                 : %%%%%%%%%%%%%%%%",CR,LF,'$'
  61.  
  62. Str_Get_DevTyp    db  CR,LF,"ASPI GET DEVICE TYPE COMMAND",CR,LF,'$'
  63. Str_Dev_Typ    db  "  SCSI Device Type                : %",CR,LF,'$'
  64.  
  65. Str_SCSI_IO    db  CR,LF,"ASPI SCSI I/O COMMAND (Inquiry Command)",CR,LF,'$'
  66. Str_PQualTyp    db  "  Qualifier / Device Type (HEX)   : %",CR,LF,'$'
  67. Str_Versions    db  "  ISO / ECMA / ANSI Version (HEX) : %",CR,LF,'$'
  68. Str_Inq_Dat    db  "  Inquiry Data                    : %%%%%%%%%%%%%%%%%%%%%%%%%%%%",CR,LF,'$'
  69.  
  70. Str_Dev_Rst1    db  CR,LF,"ASPI RESET DEVICE COMMAND (with Posting)",'$'
  71. Str_Wait4Post    db  ".",'$'
  72. Str_HA_Inq2    db  CR,LF,"ASPI HOST ADAPTER INQUIRY COMMAND (Aborted)",'$'
  73. Str_CRLF    db  CR,LF,'$'
  74. ;****************************************************************************
  75. ;    CODE SEGMENT
  76. ;****************************************************************************
  77.         .CODE
  78. start:        mov    ax,@DATA        ;initialize ds and es
  79.         mov    ds,ax
  80.         mov    es,ax
  81.  
  82. ;*    1. Obtains ASPI Entry Point
  83.         call    GetASPIEntry                                            ;Get ASPI entry point
  84.         jc    ASPI_Done                            ;Jump if no manager
  85.  
  86. ;*    2. Executes ASPI Host Adapter Inquiry Command
  87.         lea    si,SRB                                 ;point to SRB
  88.         call    HAInquiry                          ;Send ASPI HA Inquiry
  89.         call    Poll_Status                        ;wait for status
  90.         call    DispSRBInq                         ;Display Inquiry Info
  91.  
  92. ;*    3. Executes ASPI Get Device Type Command
  93.         lea    si,SRB                                 ;point to SRB
  94.         call    GetDevType                         ;Send ASPI Get Device Type
  95.         call    Poll_Status                        ;wait for status
  96.         call    DispDevTyp                         ;Display Device Type Info
  97.  
  98. ;*    4. Executes ASPI Execute SCSI I/O Command
  99.         lea    si,SRB                                 ;point to SRB
  100.         call    Load_Inquiry                       ;Load SCSI Inquiry into SRB
  101.         call    XSCSI_IO                           ;Execute SCSI I/O
  102.         call    Poll_Status                        ;wait for status
  103.         call    DispInquiry                        ;Display I/O results
  104.  
  105. ;*    5. Executes ASPI Reset SCSI Device Command using Posting
  106.         lea    dx,Str_Dev_Rst1                  ;load the string for outtext
  107.         call    outtext                            ;output the text
  108.         lea    si,SRB                                 ;point to SRB
  109.         mov    Flag,0                                    ;reset the post flag
  110.         call    RST_SDevice                           ;Resets SCSI ID = 2
  111.         lea    dx,Str_Wait4Post                       ;point to Wait for Post String
  112. PostLp1:
  113.         mov    al,Flag                             ;get the post flag
  114.         cmp    al,1
  115.         call    outtext                            ;output the text
  116.         jnz    PostLp1                             ;jump if not 1
  117.         call    DispStat                           ;Display status
  118.  
  119. ;*    6. Executes (3) and then executes ASPI Abort SCSI I/O command
  120.         lea    dx,Str_HA_Inq2                     ;load the string for outtext
  121.         call    outtext                           ;output the text
  122.         lea    si,SRB                                ;point to SRB
  123.         call    Load_Inquiry                      ;Load SCSI Inquiry into SRB
  124.         call    XSCSI_IO                          ;Execute SCSI I/O
  125.         call    Abort_SIO                         ;call abort SCSI IO
  126.         call    Poll_Status                       ;wait for status
  127.         call    DispStat                          ;Display status
  128.  
  129. ASPI_Done:    mov    ax,ASPI_DOSExit
  130.         int    21h
  131.         ret                                          ;Exit to DOS
  132.  
  133. ;****************************************************************************
  134. ;
  135. ;          %%% ASPIDISK SUPPORT ROUTINES %%%
  136. ;
  137. ;****************************************************************************
  138. ; Subroutine Name:  GetASPIEntry
  139. ;
  140. ; Description:    This gets the ASPI manager's entry point and stores it in
  141. ;        'ASPI_Entry.'
  142. ;        If no ASPI manager is found, an appropriate error message
  143. ;        is displayed.
  144. ;
  145. ; Entry:  Nothing
  146. ;
  147. ; Exit:   The memory location ASPI_Entry is loaded with entry point
  148. ;      CF set if no ASPI manager found, else reset
  149. ;****************************************************************************
  150. GetASPIEntry    proc    near
  151.         mov    ax,ASPI_Open
  152.         lea    dx,SCSIMgrString
  153.         int    21h                           ;Open ASPI Manager
  154.         jc    NoASPIManager               ;Branch if none found
  155.         push    ax                           ;Save ASPI File Handle
  156.  
  157.         mov    bx,ax                         ;BX = File Handle
  158.         mov    ax,ASPI_Get_Entry
  159.         lea    dx,ASPI_Entry              ;Store entry point here
  160.         mov    cx,4                          ;Four bytes to transfer
  161.         int    21h                           ;Get ASPI entry point
  162.  
  163.         mov    ax,ASPI_Close
  164.         pop    bx                                                                            ;BX = ASPI File Handle
  165.                                         ;BX = ASPI File Handle
  166.         int    21h            ;Close ASPI Manager
  167.         clc                ;Return with carry clear
  168.         ret
  169.  
  170. NoASPIManager:    lea    dx,Str_NoASPI        ;Display error message, no
  171.         call    outtext         ;  ASPI manager found
  172.         stc                ;Return with carry set
  173.         ret
  174. GetASPIEntry    endp
  175.  
  176. ;****************************************************************************
  177. ; Subroutine Name:  Poll_Status
  178. ;
  179. ; Description:    This subroutine polls the ASPI Status Byte and waits for
  180. ;        non-zero status.  When status goes non-zero we return.
  181. ;        Although this sample code will hange if status never goes
  182. ;        non-zero, an actual program should time out.
  183. ;
  184. ; Entry:  Assumes that si is pointing to an SRB that has just been issued
  185. ;
  186. ;****************************************************************************
  187. Poll_Status    proc    near
  188. poll_loop:    mov    al,[si]._SRStat ;get the status byte of SRB
  189.         cmp    al,0        ;compare to zero
  190.         jz    poll_loop    ;jump if still zero
  191.         ret
  192. Poll_Status    endp
  193.  
  194. ;****************************************************************************
  195. ; Subroutine Name:  HAInquiry
  196. ;
  197. ; Description:    This subroutine sends the Host Adapter Inquiry Command to the
  198. ;        ASPI Manager.  First the SRB is totally cleared.  Then the
  199. ;        opcode and other fields of the SRB are set for HOST ADAPTER
  200. ;        INQUIRY command.
  201. ;
  202. ; Entry:  si points to the SRB
  203. ;
  204. ; Exit:   SRB is full of returned data
  205. ;****************************************************************************
  206. HAInquiry    proc    near
  207.         call    ClearSRB        ;Zero out our SRB
  208.         mov    [si]._SRCmd,HA_INQ    ;ASPI opcode = HA inquiry
  209.         mov    [si]._SRHAid,0        ;Host Adapter 0
  210.         mov    [si]._SRFlags,0     ;0=no length checking
  211.         mov    [si]._SRTarget,0    ;Target 0
  212.         mov    [si]._SRLun,0        ;Lun 0
  213.  
  214.                         ;CALLING ASPI !!
  215.         push    ds            ;push segment of SRB
  216.         lea    bx,SRB
  217.         push    bx            ;push offset of SRB
  218.         call    [ASPI_Entry]        ;Call ASPI
  219.         add    sp,4            ;Restore stack
  220.         ret
  221. HAInquiry    endp
  222.  
  223. ;****************************************************************************
  224. ; Subroutine Name:  GetDevType
  225. ;
  226. ; Description:    This subroutine sends the Get Device Type Command to the
  227. ;        ASPI Manager.  First the SRB is totally cleared then the SRB
  228. ;        is loaded with opcode and other parameters for the GET DEVICE
  229. ;        TYPE command.
  230. ;
  231. ; Entry:  si points to the SRB
  232. ;
  233. ; Exit:   SRB is full of returned data
  234. ;****************************************************************************
  235. GetDevType    proc    near
  236.         call    ClearSRB        ;Zero out our SRB
  237.         mov    [si]._SRCmd,GET_TYPE    ;ASPI opcode = Get Device Type
  238.         mov    [si]._SRHAid,0        ;Host Adapter 0
  239.         mov    [si]._SRFlags,0     ;0=no length checking
  240.         mov    [si]._SRTarget,0    ;Target 0
  241.         mov    [si]._SRLun,0        ;Lun 0
  242.  
  243.                         ;CALLING ASPI !!
  244.         push    ds            ;push segment of SRB
  245.         lea    bx,SRB
  246.         push    bx            ;push offset of SRB
  247.         call    [ASPI_Entry]        ;Call ASPI
  248.         add    sp,4            ;Restore stack
  249.         ret
  250. GetDevType    endp
  251.  
  252. ;****************************************************************************
  253. ; Subroutine Name:  XSCSI_IO
  254. ;
  255. ; Description:    This subroutine sends the Execute SCSI I/O Command to the
  256. ;        ASPI Manager.  It is assumed that the SCSI command has already
  257. ;        been loaded into the SRB.  Here the EXEC_SIO is loaded into
  258. ;        opcode of the SRB along with setting the other fields for a
  259. ;        24 byte read of SCSI INQUIRY data.
  260. ;
  261. ; Entry:  The SCSI Command Block is setup upon entry, si points to SRB
  262. ;
  263. ; Exit:   SRB is full of returned data
  264. ;****************************************************************************
  265. XSCSI_IO    proc    near
  266.         mov    [si]._SRCmd,EXEC_SIO    ;ASPI opcode = execute SCSI IO
  267.         mov    [si]._SRHaId,0        ;Host Adapter 0
  268.         mov    [si]._SRFlags,SRB_DIR_IN ;Set flags to direction in
  269.         mov    [si]._SRTarget,0    ;Target 0
  270.         mov    [si]._SRLun,0        ;Lun 0
  271.         mov    [si]._SRBuflenLo,24    ;Buffer xfer length LSB
  272.         mov    [si]._SRBuflenHi,0    ;Buffer xfer length MSB
  273.         mov    [si]._SRSnsLen,20    ;Sense Buffer length 20
  274.         lea    ax,Data_Buffer
  275.         mov    [si]._SRBufPtrLo,ax    ;load Data buffer offset
  276.         mov    [si]._SRBufPtrHi,ds    ;load Data buffer segment
  277.         mov    [si]._SRCDBLen,6    ;SCSI CDB Length
  278.  
  279.                         ;CALLING ASPI !!
  280.         push    ds            ;push segment of SRB
  281.         lea    bx,SRB
  282.         push    bx            ;push offset of SRB
  283.         call    [ASPI_Entry]        ;Call ASPI
  284.         add    sp,4            ;Restore stack
  285.         ret
  286. XSCSI_IO    endp
  287.  
  288. ;****************************************************************************
  289. ; Subroutine Name:  RST_SDevice
  290. ;
  291. ; Description:    This subroutine sends the RESET SCSI DEVICE Command to the
  292. ;        ASPI Manager.  It attempts to reset SCSI ID 2 instead of
  293. ;        ID 0 in case ID 0 is the boot device of your computer.
  294. ;        Posting is used by this routine.
  295. ;
  296. ; Entry:  si points to the SRB
  297. ;
  298. ;****************************************************************************
  299. RST_SDevice    proc    near
  300.         call    ClearSRB        ;Zero out our SRB
  301.         mov    [si]._SRCmd,RESET_DEV    ;ASPI opcode = Reset Device
  302.         mov    [si]._SRHaId,0        ;Host Adapter 0
  303.         mov    [si]._SRFlags,SRB_POST    ;set post bit
  304.         mov    [si]._SRTarget,0    ;Target 0
  305.         mov    [si]._SRLun,2        ;Lun 0
  306.         mov    [si]._SRBuflenLo,0    ;Buffer xfer length LSB
  307.         mov    [si]._SRBuflenHi,0    ;Buffer xfer length MSB
  308.         mov    [si]._SRSnsLen,20    ;Sense Buffer length 20
  309.         mov    ax,OFFSET ASPI_Post
  310.         mov    [si]._SRPostOff,ax    ;load post routine offset
  311.         mov    [si]._SRPostCS,cs    ;load post routine segment
  312.  
  313.                         ;CALLING ASPI !!
  314.         push    ds            ;push segment of SRB
  315.         lea    bx,SRB
  316.         push    bx            ;push offset of SRB
  317.         call    [ASPI_Entry]        ;Call ASPI
  318.         add    sp,4            ;Restore stack
  319.         ret
  320. RST_SDevice    endp
  321.  
  322. ;****************************************************************************
  323. ; Subroutine Name:  Abort_SIO
  324. ;
  325. ; Description:    This subroutine sends the Abort SCSI I/O Request command to the
  326. ;        ASPI Manager.  First SRB2 is totally cleared then the SRB2
  327. ;        is loaded with opcode and other parameters for the ABORT SCSI
  328. ;        I/O COMMAND.
  329. ;
  330. ; Entry:  si points to the SRB to be annihilated
  331. ;
  332. ;****************************************************************************
  333. Abort_SIO    proc    near
  334.         push    si            ;save pointer to SRB 2b killed
  335.         lea    si,SRB2         ;point to another SRB
  336.         call    ClearSRB        ;Zero out SRB2
  337.         pop    si            ;restore pointer to SRB
  338.         mov    SRB2._SRCmd,ABORT_SRB    ;ASPI opcode = Abort SRB
  339.         mov    SRB2._SRHAid,0        ;Host Adapter 0
  340.         mov    SRB2._SRFlags,0     ;0=no length checking
  341.         mov    SRB2._AbortPtrLo,si    ;load offset of SRB 2b killed
  342.         mov    SRB2._AbortPtrHi,ds    ;load segment of SRB 2b killed
  343.  
  344.                         ;CALLING ASPI !!
  345.         push    ds            ;push segment of SRB2
  346.         lea    bx,SRB2
  347.         push    bx            ;push offset of SRB2
  348.         call    [ASPI_Entry]        ;Call ASPI
  349.         add    sp,4            ;Restore stack
  350.         ret
  351. Abort_SIO    endp
  352.  
  353. ;****************************************************************************
  354. ; Subroutine Name:  Load_Inquiry
  355. ;
  356. ; Description:    This routine loads the SCSI inquiry command into the
  357. ;        SRB.
  358. ;
  359. ; Entry:  si points to the SRB
  360. ;
  361. ; Exit:   All registers preserved
  362. ;****************************************************************************
  363. Load_Inquiry    proc    near
  364.         call    ClearSRB        ;Zero out our SRB
  365.         mov    [si]._OpCode,SCSI_Inquiry ;load opcode
  366.         mov    [si]._LUNumber,0    ;set LUN = 0
  367.         mov    [si]._LBAMiddl,0    ;set byte 2 = 0
  368.         mov    [si]._LBALeast,0    ;set byte 3 = 0
  369.         mov    [si]._Length,24     ;set length = 24
  370.         mov    [si]._Control,0     ;set control = 0
  371.         ret
  372. Load_Inquiry    endp
  373.  
  374. ;****************************************************************************
  375. ; Subroutine Name:  ClearSRB
  376. ;
  377. ; Description:    This routine zeros out the given ASPI SRB.
  378. ;
  379. ; Entry:  SI - ASPI SRB
  380. ;
  381. ; Exit:   All registers preserved
  382. ;****************************************************************************
  383. ClearSRB    proc    near
  384.         push    es            ;Save registers
  385.         push    ax
  386.         push    cx
  387.         push    di
  388.  
  389.         mov    cx,(64+10)/2        ;Zero out 74 bytes
  390.         mov    ax,ds
  391.         mov    es,ax            ;ES=DS
  392.         mov    di,si            ;ES:DI points to SRB
  393.         xor    ax,ax            ;Store zeros
  394.         cld
  395.         rep    stosw            ;Zero out the SRB
  396.  
  397.         pop    di
  398.         pop    cx
  399.         pop    ax
  400.         pop    es            ;Restore registers and
  401.         ret                ;return to caller
  402. ClearSRB    endp
  403.  
  404. ;****************************************************************************
  405. ; Subroutine Name:  ASPI_Post
  406. ;
  407. ; Description:    This routine is executed when the Reset Device command
  408. ;        completes.  It simply flips a flag so that execution in
  409. ;        the RST_SDEV routine can continue.  This flag method is
  410. ;        used strictly for example purposes.
  411. ;
  412. ;
  413. ; Exit:   All registers preserved
  414. ;****************************************************************************
  415. ASPI_Post    proc    far
  416.         push    bp
  417.         mov    bp,sp
  418.  
  419.         pusha
  420.         push    ds
  421.         push    es            ;Save registers
  422.         push    dx
  423.  
  424. ;        mov    bx,[bp+6]        ;BX = SRB's offset
  425. ;        mov    ds,[bp+8]        ;ES = SRB's segment
  426.  
  427. ; CODE TO DETERMINE WHICH SRB JUST COMPLETED
  428.  
  429.         mov    ds,[bp+8]        ;set ds to our data segment
  430.         mov    Flag,1            ;set the flag
  431.  
  432.         pop    dx
  433.         pop    es            ;Restore registers and
  434.         pop    ds
  435.         popa
  436.         pop    bp
  437.         retf                ;return to caller
  438. ASPI_Post    endp
  439. ;***************************************************************************
  440. ;
  441. ;             %%% DISPLAY ROUTINES %%%
  442. ;
  443. ;***************************************************************************
  444. ; Subroutine Name:  outtext
  445. ;
  446. ; Description:    Displays a message on the screen.
  447. ;
  448. ; Entry:  DS:DX - Pointer to '$' terminated character string
  449. ;
  450. ; Exit:   Nothing
  451. ;***************************************************************************
  452. outtext     proc    near
  453.         push    ax        ; save ax
  454.         mov    ah,09h        ; Do DOS Function Print String
  455.         int    21h        ; call interrupt routine
  456.         pop    ax        ; restore ax
  457.         ret
  458. outtext     endp
  459.  
  460. ;****************************************************************************
  461. ; Subroutine Name:  itoa
  462. ;
  463. ; Description:    Converts the digits of the given value to a '$'-terminated
  464. ;        character string.  Appends a carriage return and linefeed
  465. ;        to the end of the string as well if requested.
  466. ;
  467. ; Entry:  AX    - Number to be converted
  468. ;      DS:DX - Pointer to string result
  469. ;      CX    - Base of value (ie. 16 for hex, 10 for dec.)
  470. ;
  471. ; Exit:   All registers preserved
  472. ;****************************************************************************
  473. itoa        proc    near
  474.         pusha
  475.         mov    bx,dx
  476.         or    ax,ax            ;Is input value zero?
  477.         jne    NotZero         ;Branch if it's not
  478.         mov    BYTE PTR [bx],'0'       ;  else fill string with
  479.         inc    bx            ;  a single '0' and exit
  480.         jmp    SHORT itoa_exit
  481.  
  482. NotZero:    xor    di,di
  483. NextDigit:    or    ax,ax            ;Finished pushing remainders
  484.         je    itoa_pop        ;  onto the stack?
  485.         xor    dx,dx
  486.         div    cx            ;Let's get the remainder
  487.         push    dx            ;Push the remainder
  488.         inc    di            ;Increment digit count
  489.         jmp    NextDigit
  490.  
  491. itoa_pop:    or    di,di            ;Finished popping digits?
  492.         je    itoa_exit        ;Branch and exit if we are
  493.         pop    dx            ;Pop a digit
  494.         cmp    dl,10            ;Is it a 0-9 digit?
  495.         jb    DecDigit        ;If it is convert to ASCII
  496.         add    dl,'A'-10               ;  else convert to HEX
  497.         jmp    SHORT PlaceChar     ;  alphabet
  498. DecDigit:    add    dl,'0'
  499. PlaceChar:    mov    [bx],dl         ;Store character in string
  500.         inc    bx            ;Move to next place in string
  501.         dec    di            ;Decrement pop count
  502.         jmp    itoa_pop        ;Pop next value
  503.  
  504. itoa_exit:
  505.         mov    BYTE PTR [bx],CR    ;Place Carriage Return &
  506.         mov    BYTE PTR [bx+1],LF    ;  and Line Feed and '$'
  507.         mov    BYTE PTR [bx+2],'$'     ;  char at end of string
  508.         jmp    SHORT itoa_exit1
  509.  
  510.         mov    BYTE PTR [bx],'$'
  511. itoa_exit1:    popa                ;Restore all registers
  512.         ret
  513. itoa        endp
  514.  
  515. ;****************************************************************************
  516. ; Subroutine Name:  DispSRBInq
  517. ;
  518. ; Description:    This subroutine displays the information returned in the SRB
  519. ;        for the Host Adapter Inquiry Command.
  520. ;
  521. ; Entry:  Expects The SRB to be full of Host Adapter Inquiry Data
  522. ;
  523. ; Exit:
  524. ;****************************************************************************
  525. DispSRBInq    proc    near
  526.         lea    dx,Str_HA_Inquiry    ;load the string for outtext
  527.         call    outtext         ;output the text
  528.  
  529.         mov    cx,16            ;set base= hex for iota
  530.         lea    dx,Str_ASPI_STAT+36    ;point to loc in string
  531.         mov    al,SRB._SRStat        ;load value to convert
  532.         mov    ah,0            ;zero out ah
  533.         call    itoa            ;convert to ASCII in string loc
  534.         lea    dx,Str_ASPI_STAT    ;load the string for outtext
  535.         call    outtext         ;output the text
  536.  
  537.         lea    bx,Str_Num_HA        ;Get Number of HA string loc
  538.         mov    al,SRB._HACount     ;Get # of ASPI host adapters
  539.         add    al,'0'                  ;AL = ASCII Host Adapter #
  540.         mov    BYTE PTR [bx+36],al    ;Place HA # in string
  541.         mov    dx,bx            ;load the string for outtext
  542.         call    outtext         ;output the text
  543.  
  544.         lea    bx,Str_TID_HA        ;Get Target ID of HA string loc
  545.         mov    al,SRB._HAIdNum     ;Get ID
  546.         add    al,'0'                  ;AL = ASCII ID
  547.         mov    BYTE PTR [bx+36],al    ;Place HA # in string
  548.         mov    dx,bx            ;load the string for outtext
  549.         call    outtext         ;output the text
  550.  
  551.         mov    cx,16            ;ID has 16 bytes (for movsb)
  552.         lea    si,SRB._SCSIMgrId    ;load source of string mov
  553.         lea    di,Str_Mgr_ID+36    ;load destination of string mov
  554.         rep    movsb            ;move string
  555.         lea    dx,Str_Mgr_ID        ;Get Manager ID string loc
  556.         call    outtext         ;output the text
  557.  
  558.         mov    cx,16            ;ID has 16 bytes (for movsb)
  559.         lea    si,OFFSET SRB._HAIdString ;load source of string mov
  560.         lea    di,Str_HA_ID+36     ;load destination of string mov
  561.         rep    movsb            ;move string
  562.         lea    dx,Str_HA_ID        ;Get Manager ID string loc
  563.         call    outtext         ;output the text
  564.         ret
  565. DispSRBInq    endp
  566.  
  567. ;****************************************************************************
  568. ; Subroutine Name:  DispDevType
  569. ;
  570. ; Description:    This subroutine displays the information returned in the SRB
  571. ;        for the Get Device Type Command.
  572. ;
  573. ; Entry:  Expects The SRB to be full of Host Adapter Inquiry Data
  574. ;
  575. ; Exit:
  576. ;****************************************************************************
  577. DispDevTyp    proc    near
  578.         lea    dx,Str_Get_DevTyp    ;point to Get Dev Type string
  579.         call    outtext         ;output the text
  580.  
  581.         lea    bx,Str_ASPI_STAT    ;point to ASPI Status string
  582.         mov    al,SRB._SRStat        ;Get ASPI status
  583.         add    al,'0'                  ;convert to ASCII
  584.         mov    BYTE PTR [bx+36],al    ;place Status in string
  585.         mov    dx,bx            ;load the string for outtext
  586.         call    outtext         ;output the text
  587.  
  588.         lea    bx,Str_Dev_Typ        ;Get SCSI Dev Type string loc
  589.         mov    al,SRB._ScsiDevType    ;Get # of ASPI host adapters
  590.         add    al,'0'                  ;AL = ASCII Host Adapter #
  591.         mov    BYTE PTR [bx+36],al    ;Place HA # in string
  592.         mov    dx,bx            ;load the string for outtext
  593.         call    outtext         ;output the text
  594.  
  595.         ret
  596. DispDevTyp    endp
  597.  
  598. ;****************************************************************************
  599. ; Subroutine Name:  DispInquiry
  600. ;
  601. ; Description:    This subroutine displays the information returned in the SRB
  602. ;        for the Get Device Type Command.
  603. ;
  604. ; Entry:  Expects The SRB to be full of Host Adapter Inquiry Data
  605. ;
  606. ; Exit:
  607. ;****************************************************************************
  608. DispInquiry    proc    near
  609.         lea    dx,Str_SCSI_IO        ;load the string for outtext
  610.         call    outtext         ;output the text
  611.  
  612.         mov    cx,16            ;set for HEX base (iota call)
  613.         lea    dx,Str_ASPI_STAT+36    ;point to string location
  614.         mov    al,SRB._SRStat        ;load value to convert
  615.         mov    ah,0            ;zero out ah
  616.         call    itoa            ;convert to ASCII in string
  617.         lea    dx,Str_ASPI_STAT    ;load the string for outtext
  618.         call    outtext         ;output the text
  619.  
  620.         lea    dx,Str_PQualTyp+36    ;point to string location
  621.         mov    al,Data_Buffer.PerQualTyp ;load value to convert
  622.         mov    ah,0            ;zero out ah
  623.         call    itoa            ;convert to ASCII in string
  624.         lea    dx,Str_PQualTyp     ;Get Peripheral Qual Dev string
  625.         call    outtext         ;output the text
  626.  
  627.         lea    dx,Str_Versions+36    ;Get Peripheral Qual Dev string
  628.         mov    al,Data_Buffer.Versions ;Get Byte from Data Buffer
  629.         mov    ah,0            ;zero out ah
  630.         call    itoa            ;convert to ASCII in string
  631.         lea    dx,Str_Versions     ;load the string for outtext
  632.         call    outtext         ;output the text
  633.  
  634.         push    si            ;save pointer to SRB
  635.         mov    cx,28            ;load number of bytes to mov
  636.         lea    si,OFFSET Data_Buffer.VendorID ;load source address
  637.         lea    di,Str_Inq_Dat+36    ;load destination address
  638.         rep    movsb            ;move the string
  639.         lea    dx,Str_Inq_Dat        ;load the string for outtext
  640.         call    outtext         ;output the text
  641.         pop    si            ;restore pointer to SRB
  642.         ret
  643. DispInquiry    endp
  644.  
  645. ;****************************************************************************
  646. ; Subroutine Name:  DispStat
  647. ;
  648. ; Description:    This subroutine displays the ASPI status byte
  649. ;
  650. ;
  651. ;****************************************************************************
  652. DispStat    proc    near
  653.         lea    dx,Str_CRLF
  654.         call    outtext         ;output the text
  655.  
  656.         lea    bx,Str_ASPI_STAT    ;point to ASPI Status string
  657.         mov    al,SRB._SRStat        ;Get ASPI status
  658.         add    al,'0'                  ;convert to ASCII
  659.         mov    BYTE PTR [bx+36],al    ;place Status in string
  660.         mov    dx,bx            ;load the string for outtext
  661.         call    outtext         ;output the text
  662.  
  663.         ret
  664. DispStat    endp
  665. ;****************************************************************************
  666.         END    START
  667.