delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/17/01:50:56

From: Philip G Hall <ssu96pgh AT reading DOT ac DOT uk>
Newsgroups: comp.graphics.algorithms,comp.os.msdos.djgpp
Subject: Re: Double Buffer not working in modes larger than 400x300x16(VESA 2.0)
Date: Wed, 15 Oct 1997 11:41:37 +0100
Organization: University of Reading
Message-ID: <Pine.SOL.3.96.971015113323.5682L-100000@sutf19.reading.ac.uk>
References: <34417B92 DOT 7B82F875 AT mwci DOT net>
NNTP-Posting-Host: sutf19.reading.ac.uk
Mime-Version: 1.0
In-Reply-To: <34417B92.7B82F875@mwci.net>
Lines: 50
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> 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.

> 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;
> }                               ^^^
                                  ^^^
                 Aren't you missing a '*2' for 2 bytes per pixel, if not
then your screen_width is in bytes already and the '* per_pixel' in the
copy routine is irrelevant. 

Also, are you sure that the LFB enabled properly, if not, you'll get a 64K
bank at 0A0000h linear which may cause some problems...

As regards to the assembler thing, you sould not need to create or reload
any selectors. Since the contents of memory SHOULD be mapped to one 
selector with a big limit, ds,es,fs,gs should be the same... Simply write
to the (linear offset of buffer)+compiler base address to get your pixels
there. 

Jansic Harc

     _----_     _----_
    /      `---'      \
   |    ___      ___   |
   |   /   \    /   \  |
    \  \   /    \   /  /
     `--' /      \ `--'
          \      /
           \    /  
            \/\/
mail:   
     - ssu96pgh AT rdg DOT ac DOT uk
     - jansic AT hotmail DOT com
telnet:
     - jansic on elephant.org 4444

                     

- Raw text -


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