delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/17/23:49:00

Message-Id: <3.0.1.32.19990718114743.0069e438@apiitkl.edu.my>
X-Sender: df990244 AT apiitkl DOT edu DOT my
X-Mailer: Windows Eudora Light Version 3.0.1 (32)
Date: Sun, 18 Jul 1999 11:47:43 +0800
To: djgpp AT delorie DOT com
From: Mark <rhosts AT bigfoot DOT com>
Subject: still got double buffering prob. in 13h mode.
Cc: nate AT cartsys DOT com
In-Reply-To: <3790E05D.2F0F6F98@cartsys.com>
References: <3 DOT 0 DOT 1 DOT 32 DOT 19990717221624 DOT 0069d798 AT apiitkl DOT edu DOT my>
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Hi,

I added the memset(double_buffer,0,320*200) before I draw to my buffer but
still gives me garbage instead of a single red dot at position (10,10).

Any idee what goes wrong ?
(source below)

Thanks;
Mark.




#include <stdlib.h>
#include <dos.h>
#include <sys/movedata.h>
#include <dpmi.h>

typedef unsigned char byte;

short screen;
byte *double_buffer;

void mode(byte mode){
   union REGS regs;
   regs.h.ah=0x00;
   regs.h.al=mode;
   int86(0x10, &regs, &regs);
}
  
main(){
   mode(0x13);

   screen = __dpmi_segment_to_descriptor(0xa000);
   if (screen == -1){
      printf("error getting a selector.\n");
      exit(1);
   }

   double_buffer = (byte *)malloc(320*200);
   if (double_buffer==NULL){
      printf("Not enough memory for double buffer.\n");
      exit(1);
   }

   memset(double_buffer,0,320*200);

   double_buffer[10*320+10] = 4;

   while (inportb(0x3da) & 8);
   while (!(inportb(0x3da) & 8));
   movedata(_my_ds(),*double_buffer,screen,0,320*200);

   getch();
   mode(0x03);
}
   


- Raw text -


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