home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / memory / emslib / emsopena.asm < prev    next >
Encoding:
Assembly Source File  |  1988-04-25  |  1.0 KB  |  39 lines

  1.  
  2. emm_int   equ      67h
  3.  
  4.           if1
  5.           INCLUDE  model.mac
  6.           endif
  7.  
  8. header
  9.  
  10. begdataseg
  11.           EXTRN    _EMSAvPgs   :word
  12.           EXTRN    _emserr     :byte
  13. enddataseg
  14.  
  15. begcodeseg
  16. procstart __emsopen
  17.           push     bp
  18.           mov      bp,sp
  19.           mov      bx,WORD PTR [bp+4]  ; get number of pages to allocate
  20.           mov      ah,43h              ; Get handle and allocate memory function
  21.           int      emm_int             ; Call EMM
  22.           cmp      ah,0                ; check for error
  23.           jnz      error
  24.           mov      _emserr,0           ; update emserr
  25.           mov      ax,_EMSAvPgs        ; update EMSAvail
  26.           sub      ax,bx
  27.           mov      _EMSAvPgs,ax
  28.           mov      ax,dx
  29.           jmp      fini
  30. error:    mov      _emserr,ah          ; update emserr
  31.           mov      al,ah               ; return error code
  32.           xor      ah,ah
  33. fini:     pop      bp
  34.           ret
  35. procend   __emsopen 
  36. endcodeseg
  37.           END
  38.  
  39.