www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/16/12:01:22

From: Larry Swanson <laswanson AT mwci DOT net>
Newsgroups: comp.graphics.algorithms,comp.os.msdos.djgpp
Subject: Double Buffer not working in modes larger than 400x300x16(VESA 2.0)
Date: Sun, 12 Oct 1997 20:38:26 -0500
Organization: MidWest Communications, Inc.
Lines: 66
Message-ID: <34417B92.7B82F875@mwci.net>
NNTP-Posting-Host: dial-54.man.mwci.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hello

I'm having some problems getting my double buffer working properly.  The
following code will work fine in 320x240x16 mode and in 400x300x16 mode
but in any larger modes it doesn't work properly.  It will flash the
Double Buffer on the screen for a moment but then it goes to black.

In my code screen_width and screen_height are global variables. 
Set_VESA_Mode works fine and my Double buffer clearing, making, and
freeing functions are solid too.  I'm using DJGPP.(if that makes a
difference).

Video is a pointer made by mapping the physical address of the L.F.B and
adding djgpp conventional base.(I don't suppose this is the problem
because my regular "straight to the screen" putpixels work fine". 

Thank you

Jordan Swanson
jordanswanson AT hotmail DOT com

PS.  Does anyone know how to access malloced memory in assembler?  Where
would I get the right selector to do so?  Thanks again.

Here's my code

void ShowDoubleBuffer(){
     __djgpp_nearptr_enable();
     memcpy(video,DoubleBuffer, screen_width * screen_height *
per_pixel);
     __djgpp_nearptr_disable();
}//------------------------------------------------------------

void Buffer_Pixel(int x, int y, int color){
     DoubleBuffer[ y*screen_width + x ] = color;
}

int main(){
     unsigned x,y;

     Set_VESA_Mode(800,600,16);

     MakeDoubleBuffer();
     Build_Look_Up_Tables();

     ClearDoubleBuffer(0);

     for(y=0; y < 48; y++){

         for( x=0 ;x < 0xff ; x++){
              Buffer_Pixel(x,y, x);
         }
         getch();
         ShowDoubleBuffer();
     }



     getch();

     SetVGAMode(0x03);

     DestroyDoubleBuffer();

     return 0;
}

- Raw text -


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