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> dosmaprealseg()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosMapRealSeg()
------------------------------------------------------------------------------
 Purpose:
 Convert a real mode paragraph value into a protected mode selector.

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

 Parameters:
 paragraph  A real mode segment address, e.g. to map address B800:0000
            for the colour screen use 0xB800.
 size       The size of the memory region to be mapped in bytes, which
            may be larger than 64 Kb.
 selector   Pointer to an integer to receive the selector.

 Returns:
 A selector which has the same base address as the real mode segment.

 Description:
 DosMapRealSeg() is used to map real mode segments onto protected mode
 selectors in order to make real mode addresses accessible from protected
 mode. (For example the real mode video buffer at segment 0xB800).

 If you need to access the low-memory BIOS data area at real mode segment
 0x0040 in protected mode, use DosGetBIOSSeg() to obtain a selector in
 preference to this function.
 DosMapRealSeg() does NOT allocate memory, if you need to allocate real mode
 memory use DosAllocRealSeg().

 Example:
 #include <stdlib.h>                                                         
 #include <stdio.h>                                                          
 #include <string.h>                                                         
 #include <blx286.h>                                                         
                                                                             
 #define VID_BUF 0xB800                                                      
 #define VID_SIZE 0x8000l                                                    
                                                                             
 void main (void)                                                            
 {                                                                           
 SEL video_buffer;                                                           
                                                                             
 /* Get a selector that corresponds to the screen buffer */                  
 if (DosMapRealSeg(VID_BUF,VID_SIZE,&video_buffer) != 0)                     
    {                                                                        
    printf("Unable to map screen segment\n");                                
    exit(255);                                                               
    }                                                                        
 printf("Selector for video buffer %04X\n",video_buffer);                    
 }                                                                           

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