Mail Archives: djgpp/1997/07/10/19:35:54
Carl B wrote:
>
> Hi,
> I can't figure out how to enable Linear Addressing for the Trident 9440
> chip. Apparently "port : 0x3D4, index 0x21, bit 5" has to be set to
> enable Linear Addressing and I can't get it to set. I have a Pentium
> 75Mhz w/24Mb of EDO memory and 1Mb of video memory, I'm compiling in DOS
> with DJGPP's 32-bit Protected Mode C++ compiler. Any help would be
> greatly appreciated!
>
> Thanks,
> Carl B. (mailto:carlb AT frugal DOT com)
Hi,
It's me again. I finally figured out how to use Trident's Linear
Address. Thanks to everyone for their input. I'm including the code I
came up with to implement the buffer access in the hopes that other
people can use it.
------------------------------------------------------------------------
#include <sys/farptr.h>
#include <dpmi.h>
TrLinearInfo.size=(ulong)TrCfgRec.VideoMemory; // Total Video Memory
(1Mb)
TrLinearInfo.address=0xF0000000; // MemBase (from setpci.exe, in
archive -> ua64-dos.exe)
unsigned char* ScrPtr = (unsigned char*)
malloc((long)TrLinearInfo.size); // Allocate Linear Buffer
__djgpp_map_physical_memory(ScrPtr, TrLinearInfo.size,
TrLinearInfo.address); // Map Linear Address To Buffer
unsigned short width=640, height=480;
unsigned char* Buf = (unsigned char*) malloc((long)width*height);
for(counter=0; counter < (long)(width*height); counter++)
Buf[counter] = 2; // Paint Source Buffer Green
_farsetsel(_my_ds()); // Set Selector
SetVidMode(0x5D); // Initiate Graphics Mode (640x480 256 Colors)
for(counter=0; counter < (long)(width*height); counter++)
_farnspokeb(ScrPtr+counter, Buf[counter]); // Put Source
Buffer into Linear Buffer
getkey(); // Wait For KeyPress
SetVidMode(0x03); // Restore Text Mode
free(ScrPtr); // Free Up Linear Buffer
free(Buf); // Free Up Source Buffer
- Raw text -