Mail Archives: djgpp/1996/06/07/12:50:17
Xref: | news2.mv.net comp.os.msdos.djgpp:4697
|
From: | Francisco Gochez <arcanix AT pop DOT erols DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Simplest way to access VGA memory
|
Date: | 6 Jun 1996 19:14:24 GMT
|
Organization: | None
|
Lines: | 22
|
Message-ID: | <4p7amg$pd0@news5.erols.com>
|
NNTP-Posting-Host: | as28s07.erols.com
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Here is the safest, easiest way that I have found to access the video
memory:
#include <dpmi.h>
#include <malloc.h>
unsigned char *screenptr;
int main(void)
{
screenptr = malloc(65536);
__djgpp_map_physical_memory(screenptr, 65536, 0xA0000);
.............
This sets up a pointer to the video memory area. (ex. screenptr[1] = 2 ;
)
Of course, this will only work under DPMI 1.0 ( or CWSDPMI ). I am using
it for a game I am working on, and it has always worked so far.
- Raw text -