Date: Tue, 29 Aug 1995 06:35:36 +0200 (IST) From: Eli Zaretskii To: tony AT osho DOT mcs DOT csuhayward DOT edu Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: Graphics in v2.0 On Mon, 28 Aug 1995 tony AT osho DOT mcs DOT csuhayward DOT edu wrote: > I apologize if this has been asked before, but I haven't been able to > read the newsgroup lately. I couldn't find much documentation with > the DJGPP V2 beta. Is there a specific FAQ for it yet? As v2.0 is in beta, there isn't much docs except regarding things which has changed *a lot*, like the C library. There is no FAQ yet, as a beta release typically has most its woes corrected before the final release, so it doesn't make sense to have a FAQ about such problems. > My trouble is > with graphics. In V1.x I was assuming the video memory was at 0xD0000000. > Now I am getting general protection faults when I try to plot pixels. Could > someone explain what I am doing wrong or point me to any V2 docs that I > may have missed? V2 is a DPMI environment, so you should generally follow all the recommendations which were valid in v1.x when running under DPMI. This particular point about graphics is explained in the v1.x FAQ, 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). The farptr functions are explained in section 18.4, and also in the v2.0 libc Info file.