home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------------------
- * filename - freemem.cas
- *
- * function(s)
- * freemem - frees a previously allocated DOS memory block
- *--------------------------------------------------------------------------*/
-
- /*[]------------------------------------------------------------[]*/
- /*| |*/
- /*| Turbo C Run Time Library - Version 3.0 |*/
- /*| |*/
- /*| |*/
- /*| Copyright (c) 1987,1988,1990 by Borland International |*/
- /*| All Rights Reserved. |*/
- /*| |*/
- /*[]------------------------------------------------------------[]*/
-
-
- #pragma inline
- #include <asmrules.h>
- #include <dos.h>
- #include <_io.h>
-
- /*--------------------------------------------------------------------------*
-
- Name freemem - frees a previously allocated DOS memory block
-
- Usage int freemem(unsigned seg);
-
- Prototype in dos.h
-
- Description frees a memory block allocated by a previous call to
- allocmem. seg is the segment address of that block.
-
- Return value success : 0
- else : -1 and errno is set to
-
- ENOMEM Insufficient memory
-
- *---------------------------------------------------------------------------*/
-
-
- int freemem(unsigned segx)
- {
- asm mov ah, 49h
- asm mov es, segx
- asm int 21h
- asm jc freememFailed
-
- return(0);
-
- freememFailed:
- return __IOerror(_AX);
- }
-