home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l440 / 2.ddi / CHAP3 / DEV.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-09-25  |  2.0 KB  |  74 lines

  1. ; DEV.ASM
  2. .model small
  3. .stack
  4.  
  5. .data
  6. blkdev  db      'Block: '       ; block driver message
  7. blkcnt  db      '0 unit(s)$'
  8.  
  9. .code
  10. dev     proc
  11.  
  12.         mov     ah,52h          ; get List of Lists
  13.         int     21h
  14.         mov     ax,es           ; segment to AX
  15.         add     bx,22h          ; driver offset, 3.1 and up
  16.         mov     di,seg blkdev
  17.         mov     dx,offset blkdev
  18.  
  19. dev1:   mov     ds,ax
  20.         lea     si, [bx+10]     ; step to name/units field
  21.         test    byte ptr [bx+5], 80h    ; check driver type
  22.         jz      dev3            ; is BLOCK driver
  23.  
  24.         mov     cx,8            ; is CHAR driver
  25. dev2:   lodsb                   ; so output its name
  26. IFDEF INT29
  27.         int     29h             ; gratuitous use of undoc DOS
  28. ELSE
  29.         push    dx
  30.         mov     dl, al
  31.         mov     ah, 2           ; Character Output
  32.         int     21h
  33.         pop     dx
  34. ENDIF
  35.         loop    dev2
  36.         jmp     short   dev4    ; then go look for next one
  37.  
  38. dev3:   lodsb                   ; get number of units
  39.         add     al,'0'
  40.         push    ds
  41.         mov     ds,di
  42.         mov     blkcnt,al       ; set into message
  43.         mov     ah,9
  44.         int     21h
  45.         pop     ds
  46.  
  47. IFDEF INT29
  48. dev4:   mov     al,13           ; send CR and LF to CRT
  49.         int     29h             ; gratuitous use of undoc DOS
  50.         mov     al,10
  51.         int     29h
  52. ELSE
  53. dev4:   push    dx
  54.         mov     ah,2            ; Character Output
  55.         mov     dl,13           ; send CR and LF to CRT
  56.         int     21h
  57.         mov     dl,10
  58.         int     21h
  59.         pop     dx
  60. ENDIF
  61.         mov     si,bx           ; back up to front of driver
  62.         lodsw                   ; get offset of next one
  63.         xchg    ax,bx
  64.         lodsw                   ; and then its segment
  65.         cmp     bx,0FFFFh       ; was this end of chain?
  66.         jne     dev1            ; no, loop back
  67.  
  68.         mov     ax,4C00H        ; yes, return to DOS
  69.         int     21h
  70.  
  71. dev     endp
  72.  
  73.         end     dev
  74.