Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Blinker 5.10 Online Reference - <b> dosallocseg()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosAllocSeg()
------------------------------------------------------------------------------
 Purpose:
 Allocate an extended memory block of up to 64 Kb.

 Syntax:
 USHORT BLXAPI DosAllocSeg (USHORT size, PSEL selector, USHORT flags);

 Parameters:
 size      Size of block in bytes (maximum 64 Kb).
 selector  Pointer to an integer to receive the selector.
 flags     Reserved (must be 0).

 Returns:
 Selector for the extended memory block.

 Description:
 DosAllocSeg() allocates a memory block up to 64 Kb in size.

 Most high level languages provide a memory allocation function equivalent
 to this function, such as malloc() in C. These functions can be used
 instead of DosAllocSeg() to manage blocks of memory less than 64 Kb in
 size, particularly when minimum source code differences between real and
 protected mode are required.

 Use DosMemAvail() to find the amount of available memory that can be
 allocated using DosAllocSeg().

 Example:
 #include <stdlib.h>                                                         
 #include <stdio.h>                                                          
 #include <string.h>                                                         
 #include <blx286.h>                                                         
                                                                             
 void main(void)                                                             
 {                                                                           
 SEL   selector;                                                             
                                                                             
 /* Allocate a 4Kb block */                                                  
 if (DosAllocSeg(4096, &selector, 0) != 0)                                   
    {                                                                        
    printf("DosAllocSeg() failed\n");                                        
    exit(255);                                                               
    }                                                                        
 printf("4Kb block allocated at : %04X\n",selector);                         
 /* Free the block */                                                        
 DosFreeSeg(selector);                                                       
 }                                                                           

See Also: DosFreeSeg()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson