home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / NFSRC305.ZIP / CPMI / FREEDOS.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-05-01  |  1.7 KB  |  68 lines

  1. ; File......: FREEDOS.ASM
  2. ; Author....: Ted Means
  3. ; CIS ID....: 73067,3332
  4. ;
  5. ; This is an original work by Ted Means and is placed in the
  6. ; public domain.
  7. ;
  8. ; Modification history:
  9. ; ---------------------
  10. ;     Rev 1.0   01 Jan 1995 03:01:00   TED
  11. ;  Initial release
  12. ;
  13.  
  14. ;  $DOC$
  15. ;  $FUNCNAME$
  16. ;     cpmiFreeDOSMem()
  17. ;  $CATEGORY$
  18. ;     CPMI
  19. ;  $ONELINER$
  20. ;     Free a DOS memory block
  21. ;  $SYNTAX$
  22. ;     void pascal cpmiFreeDOSMem( SELECTOR Selector )
  23. ;  $ARGUMENTS$
  24. ;     Selector is the previously allocated selector
  25. ;  $RETURNS$
  26. ;     SUCCEED if successful, FAIL otherwise
  27. ;  $DESCRIPTION$
  28. ;     This function is used to free memory blocks that were allocated
  29. ;     with the cpmiAllocDOSMem() function.
  30. ;  $EXAMPLES$
  31. ;     char far * buffer;
  32. ;
  33. ;     FP_SEG( buffer ) = cpmiAllocDOSMem( 48 );
  34. ;     FP_OFF( buffer ) = 0;
  35. ;
  36. ;     // Do whatever
  37. ;
  38. ;     cpmiFreeDOSMem( FP_SEG( buffer ) );
  39. ;  $INCLUDE$
  40. ;     CPMI.H
  41. ;  $SEEALSO$
  42. ;     cpmiAllocDOSMem(), cpmiResizeDOSMem()
  43. ;  $END$
  44. ;
  45.  
  46. IDEAL
  47. P286
  48.  
  49. Public    cpmiFreeDOSMem
  50.  
  51. Segment   _NanFor   Word      Public    "CODE"
  52.           Assume    CS:_NanFor
  53.  
  54. Proc      cpmiFreeDOSMem      Far
  55.  
  56.           Enter     0,0                           ; Create stack frame
  57.  
  58.           Mov       AX,101h                       ; DPMI -- free DOS memory
  59.           Mov       DX,[Word Ptr BP + 6]          ; Load selector
  60.           Int       31h                           ; Call DPMI
  61.           Mov       AX,1                          ; Default to SUCCEED
  62.           SBB       AX,0                          ; Set to FAIL on error
  63.  
  64.           Leave                                   ; Destroy stack frame
  65.           RetF      2
  66. Endp      cpmiFreeDOSMem
  67. Ends      _NanFor
  68. End