home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / dos_ency / 9 / fig9_6.asm < prev    next >
Encoding:
Assembly Source File  |  1988-08-11  |  1.8 KB  |  43 lines

  1.         .
  2.         .
  3.         .
  4.                                 ; attempt to "open" EMM...
  5.         mov     dx,seg emm_name ; DS:DX = address of name
  6.         mov     ds,dx           ; of EMM
  7.         mov     dx,offset emm_name
  8.         mov     ax,3d00h        ; Fxn 3DH, Mode = 00H
  9.                                 ; = open, read-only
  10.         int     21h             ; transfer to MS-DOS
  11.         jc      error           ; jump if open failed
  12.  
  13.                                 ; open succeeded, make sure
  14.                                 ; it was not a file...
  15.         mov     bx,ax           ; BX = handle from open
  16.         mov     ax,4400h        ; Fxn 44H Subfxn 00H
  17.                                 ; = IOCTL Get Device Information
  18.         int     21h             ; transfer to MS-DOS
  19.         jc      error           ; jump if IOCTL call failed
  20.         and     dx,80h          ; Bit 7 = 1 if character device
  21.         jz      error           ; jump if it was a file
  22.  
  23.                                 ; EMM is present, make sure
  24.                                 ; it is available...
  25.                                 ; (BX still contains handle)
  26.         mov     ax,4407h        ; Fxn 44H Subfxn 07H
  27.                                 ; = IOCTL Get Output Status
  28.         int     21h             ; transfer to MS-DOS
  29.         jc      error           ; jump if IOCTL call failed
  30.         or      al,al           ; test device status
  31.         jz      error           ; if AL = 0 EMM is not available
  32.  
  33.                                 ; now close handle ...
  34.                                 ; (BX still contains handle)
  35.         mov     ah,3eh          ; Fxn 3EH = Close
  36.         int     21h             ; transfer to MS-DOS
  37.         jc      error           ; jump if close failed
  38.         .
  39.         .
  40.         .
  41.  
  42. emm_name db     'EMMXXXX0',0    ; guaranteed device name for EMM
  43.