From: varobert AT colba DOT net Message-Id: <3.0.32.19990718003516.007a55e0@mail.colba.net> X-Sender: varobert AT mail DOT colba DOT net X-Mailer: Windows Eudora Pro Version 3.0 (32) Date: Sun, 18 Jul 1999 00:35:27 -0400 To: djgpp AT delorie DOT com Subject: Re: still got double buffering prob. in 13h mode. Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Reply-To: djgpp AT delorie DOT com At 11:47 AM 7/18/99 +0800, you wrote: >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 >#include >#include >#include > >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, ®s, ®s); >} > >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); Try: movedata(_my_ds(),double_buffer,screen,0,320*200); The problem is that *double_buffer is the value of the first pixel in your dbl buffer, which is 0, so in essence, you're dumping your program code on your screen ! -GodOfWar > > getch(); > mode(0x03); >} > > > >