memfree.asm
上传用户:xiaoan1112
上传日期:2013-04-11
资源大小:19621k
文件大小:1k
源码类别:

操作系统开发

开发平台:

Visual C++

  1. ; ========================================================
  2. COMMENT #
  3. MEMFREE.ASM
  4. Copyright (c) 1991 - Microsoft Corp.
  5. All rights reserved.
  6. Microsoft Confidential
  7. johnhe - 07/01/89
  8. END COMMENT #
  9. ;========================================================
  10. DOSSEG
  11. include MODEL.INC
  12. .CODE
  13. ; ========================================================
  14. ; Returns number of free memory paragraphs available
  15. ; as a contigous block from DOS.
  16. ;
  17. ; unsigned GetMemoryFree( void )
  18. ;
  19. ; ========================================================
  20. GetMemoryFree PROC
  21. mov BX,0ffffh ; Set for max 1 meg memory
  22. mov AH,48h ; Dos allocate memory function
  23. int 21h
  24. push BX ; Put free para count on the stack
  25. jc GetMemoryFreeRet ; If no carry need to free memory
  26. push ES ; Save ES
  27. mov ES,AX ; Put segment address in ES
  28. mov AH,49h ; Dos free memory function
  29. int 21h
  30. pop ES ; Restore ES
  31. GetMemoryFreeRet:
  32. pop AX ; Put max memory paragraphs in AX
  33. ret
  34. GetMemoryFree ENDP
  35. ; ========================================================
  36. END
  37. ; ========================================================