Date: Tue, 1 Aug 1995 08:35:32 +0300 (IDT) From: Eli Zaretskii To: Steve Havelka Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: Video question On Mon, 31 Jul 1995, Steve Havelka wrote: > Hi. I have written a few graphics programs (mode 13h) for DJGPP, > and they access video memory at 0xd0000000. If I try to run > them under a DPMI server, though, they GPF when they try to > access the video memory. Is there another way to access video > memory so the programs don't crap out under DPMI? Yes. It's all explained in the DJGPP FAQ list (available as faq102.zip from the same place you get DJGPP), section 10.6: 10.6 Q: I try to access the video memory at 0xa0000, but get Segmentation violation... A: 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 (see chapter 18 below for details).