www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/23/14:56:01

From: silkwodj AT my-dejanews DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Protected Mode graphics is to hard
Date: Mon, 22 Mar 1999 16:13:38 GMT
Organization: Deja News - The Leader in Internet Discussion
Lines: 37
Message-ID: <7d5q78$p8u$1@nnrp1.dejanews.com>
References: <36f40071 DOT 0 AT news DOT ossinc DOT net>
NNTP-Posting-Host: 205.147.228.2
X-Article-Creation-Date: Mon Mar 22 16:13:38 1999 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)
X-Http-Proxy: 1.0 x10.dejanews.com:80 (Squid/1.1.22) for client 205.147.228.2
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In article <36f40071 DOT 0 AT news DOT ossinc DOT net>,
  "Mark_" <NOSPAM AT NET> wrote:
> Im trying to port an application that used real mode
> graphics to djgpp and it used a pointer to the address
> A000:0000 and it extensively uses dereferenced pointers
> to read and write to memory.
> Is there any way I can just change this pointer
> to some protected mode address so I don't have to
> peek and poke or use some other crazy method that
> is so abstract that it is useless.

Hang in there, Mark, it's still worth the effort.  Most of the time I allocate
a screen buffer with:
 char *screen_buffer = new char [64000]; // VGA mode 13h assumed here

 I usually place this just before Main().  Do all your graphics using this
pointer.

Now, also early in your code(where you get rid of all the far stuff and MK_FP
, etc.), get a selector descriptor (like a segment) for video RAM (only do
this once):

    short video = __dpmi_segment_to_descriptor(0xa000);

Then later in your code, any time after you write to the buffer, just blit the
whole thing:

_movedatal(_my_ds(), screen_buffer, video, 0, 320*200/4); //mode 13h specific

If you need to clear, before drawing, you only clear the buffer:

for (int j=0; j<64000; j++){buffer[j]=0;} //mode 13h specific

That's a quick double buffering tutorial in a nut-shell.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019