home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / mslang / vm / src / ems / ems.asm next >
Encoding:
Assembly Source File  |  1993-12-13  |  1.2 KB  |  69 lines

  1.     .model    large,pascal
  2.  
  3.     include ems.inc
  4.  
  5.     .code    EMS_TEXT
  6.  
  7.  
  8.  
  9.     ;WARNING:  This function will destroy AX and can not be used
  10.     ;WARNING:  for any EMM function that returns a value in AL.
  11.  
  12.     public    __ErrEmsCall
  13. __ErrEmsCall    proc    near
  14.  
  15.     assume    ds:nothing
  16.  
  17.     int    67h
  18.     xchg    al,ah            ;AL = Error code
  19.     cbw                ;AH = 00 or FF
  20.     or    ax,ax            ;Any error
  21.     jz    Exit            ;Brif not, return errNoError = 0
  22.     add    ax,errEmsBase-0FF80h    ;Map to ERR value
  23. Exit:
  24.     ret
  25.  
  26. __ErrEmsCall    endp
  27.  
  28.  
  29.  
  30.     ;BOOL PUBLIC __FEmsCheckInstalled(void);
  31.  
  32. EmsDeviceName    db    'EMMXXXX0'
  33.  
  34.     public    __FEmsCheckInstalled
  35. __FEmsCheckInstalled    proc    uses si di
  36.  
  37.     assume    ds:@data
  38.  
  39.     mov    ax,3567h        ;Get interrupt 67h
  40.     int    21h
  41.  
  42.     mov    di,000Ah        ;ES:DI -> Device name
  43.     mov    si,OFFSET cs:EmsDeviceName
  44.     push    cs
  45.     pop    ds            ;DS:SI -> Expected device name
  46.     mov    cx,4
  47.     repe    cmpsw            ;Compare the names
  48.     push    ss            ;Restore DS = DGROUP
  49.     pop    ds
  50.     jnz    NoEms            ;Brif device name mismatch, no ems
  51.  
  52.     mov    ah,46h            ;Get Version
  53.     int    67h
  54.     or    ah,ah            ;Any error
  55.     jnz    NoEms            ;Brif so. Pretend no EMS.
  56.  
  57.     cmp    al,40h            ;LIM 4.0 or better?
  58.     jae    Exit            ;Brif so, AX != 0. Returning TRUE
  59.  
  60. NoEms:
  61.     xor    ax,ax            ;Return FALSE
  62.  
  63. Exit:
  64.     ret
  65.  
  66. __FEmsCheckInstalled    endp
  67.  
  68.     end
  69.