home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / microcrn / issue_37.arc / MEMORY37.FIG < prev    next >
Text File  |  1987-08-05  |  1KB  |  47 lines

  1. /*   Figure 1    */
  2.  
  3.   EM_NAME        DB 'EMMXXXX0', 0
  4.  
  5. FIND_EM:
  6. ;Out:    NC indicates expanded memory driver installed and functioning.
  7. ;    BX = EM base segment if EMM installed
  8. ;    C set if expanded memory can not be used.
  9.   PUSH    DS
  10.   PUSH    DX
  11.   PUSH    AX
  12.   MOV    AX, CS
  13.   MOV    DS, AX        ;Use DOS open handle call to determine whether
  14.   MOV    DX, OFFSET EM_NAME ;EM driver is installed.
  15.   MOV    AH, 3DH        ;Open handle function code.
  16.   MOV    AL, 0
  17.   INT    21H        ;Dos function.
  18.   JC    FE_00        ;C set if open fails.
  19.   MOV    BX, AX        ;Device handle
  20.   MOV    AH, 44H        ;IOCTL call
  21.   MOV    AL, 0        ;Device info subfunction
  22.   MOV    DX, 0
  23.   INT    21H        ;Call DOS
  24.   JC    FE_00        ;Exit, C set if error
  25.   TEST    DL, 80H        ;Is it a device?
  26.   STC
  27.   JZ    FE_00        ;Exit with C set if not device.
  28.   MOV    AH, 44H        ;DOS IOCTL call
  29.   MOV    AL, 7        ;Output status
  30.   INT    21H
  31.   JC    FE_00        ;Exit, C set if error.
  32.   OR    AL, AL        ;Is it ready?
  33.   STC
  34.   JZ    FE_00        ;Error exit if not.
  35.   MOV    AH, 3EH        ;Close handle
  36.   INT    21H
  37.   JC    FE_00
  38.   MOV    AH, 41H        ;Get EM base address.
  39.   INT    EM_INT
  40.   MOV    EM_BASE, BX
  41. FE_00:
  42.   POP    AX
  43.   POP    DX
  44.   POP    DS
  45.   RET
  46.  
  47.