www.delorie.com/djgpp/faq/graphics/a0000.html   search  
I try to access the video memory at 0xa0000, but get Segmentation violation...

Absolute addresses of certain memory-mapped devices are mapped differently under djgpp, which is protected-mode environment. You can't just poke any address, that's what protected mode is all about. In non-DPMI mode, the entire graphics video memory is mapped 1:1 starting at 0xD0000000 in the program's address space; the djgpp paging mechanism understands how SuperVGA's map their memory onto the AT bus and automatically swaps pages as the program tries to access them. The program sees a linear range from 0xd0000000 to 0xd0100000 that corresponds to each pixel in the 256-color modes of SuperVGAs. For this to work correctly, you will have to set the GO32 environment variable to the graphics driver suitable for your SuperVGA card, like this:

  SET GO32=driver c:\djgpp\drivers\ati.grd gw 640 gh 480 tw 132 th 43
In DPMI mode this won't work. As djgpp v2.0 will be DPMI-only environment, this means that, after GRX 2.0 arrives, the above method should be used only as last resort. If you want to write a program which will compile and run unchanged in v2.0, use functions described in <sys/farptr.h>.


  webmaster     delorie software   privacy  
  Copyright © 1995     Updated Feb 1995