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> dosallocrealseg()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosAllocRealSeg()
------------------------------------------------------------------------------
 Purpose:
 Allocate a conventional memory block.

 Syntax:
 USHORT BLXAPI DosAllocRealSeg(ULONG size,
                               PUSHORT paragraph,
                               PSEL selector);

 Parameters:
 size       Size of the block to allocate in bytes (Cannot be greater
            than 64 Kb).
 paragraph  Pointer to an integer to receive the real mode segment of
            the memory block.
 selector   Pointer to an integer to receive the protected mode selector
            of the memory block.

 Returns:
 The real mode paragraph address and the protected mode
 selector of the conventional memory block.

 Description:
 As this function returns both a real mode paragraph address and a
 protected mode pointer the allocated block can be addressed in either mode,
 and can therefore be useful in mixed-mode programming.

 Note that the memory freed by DosFreeRealSeg() will only be returned to the
 DOS extender, not all the way to DOS, until the program exits. As a result,
 DosRealAvail() may not reflect the increase in memory, although
 DosAllocRealSeg() will still be able to allocate the memory again.

 Example:
 #include <stdlib.h>                                                         
 #include <stdio.h>                                                          
 #include <string.h>                                                         
 #include <blx286.h>                                                         
                                                                             
 void main(void)                                                             
 {                                                                           
 SEL         selector;                                                       
 USHORT      paragraph;                                                      
                                                                             
 /* Allocate a 16Kb block */                                                 
 if (DosAllocRealSeg((16L << 10), &paragraph, &selector) != 0)               
    {                                                                        
    printf("DosAllocRealSeg() failed\n");                                    
    exit(255);                                                               
    }                                                                        
 printf("Real segment: %04X prot selector: %04X\n",                          
    paragraph,selector);                                                     
 /* Free the block */                                                        
 DosFreeRealSeg(selector);                                                   
 }                                                                           

See Also: DosFreeRealSeg() DosRealAvail()

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