www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/18/21:08:56

From: bmiller <bmiller AT infi DOT net>
Subject: Fast Blitting to Screen w/libgr
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Tue, 18 Apr 1995 19:42:31 -0400 (EDT)

DjgpperS:

  I've acquired the djgpp package, and love it!  I'm hoping to start writing
some games with it, but am having some trouble with getting clean blits to
the screen.

  I like the GrRegion class and intend to write my game in c++, so I'd
rather not 'resort' to the grx lib (assuming it has a workaround).  Upon
examining the source code, I thought the problem was the general Blit 
routines for the GrRegion class; however, after creating a ScreenBlast
function w/minimal error checking with a straight bcopy/memcpy to show the
screen, I still had retrace lines appear on the screen.

  My second bright idea was to code it in assembly in hopes that would solve
the problem.  (I'll attach the code momentarily.)  Now I'm getting some sort
of segmentation faults when I run my program.  (Btw, my program just blits a
square down the screen.)  The code:

void ScreenBlast(GrRegion *buffer, GrRegion *screen) {

  if ((buffer->SizeX() != screen->SizeX()) &&
	(buffer->SizeY() != screen->SizeY()) 
    return;
  WaitForVsync		//This is a little macro I wrote to wait for the 
			// video retrace to begin; it worked before my
			// attempt at assembl-izing my routine.
  bufread = buffer->rdata;	// bufread is a global char *
  scrwrite = screen->wdata;	// scrsrite is a global char *
				// another global is scrsize, a long, and
				// set to SizeX() * SizeY() earlier
  asm("
	pushl %ecx
	pushl %esi
	pushl %edi

	movl _scrsize, %ecx
	movl _bufread, %esi
	movl _scrwrite, %edi

	rep ; movsl

	popl %edi
	popl %esi
	popl %ecx
  ");
}

  I get the impression, from reading the as info files, that somehow my
section is wrong; however, I have no clue as to how to ensure that it is
right.

  I am mostly concerned with getting rid of the darn retrace problem;
however, I am also most interested in knowing what's wrong with my asm code,
too, for kicks & giggles.

  In advance, thanks for the help, and even more thanks for DJGPP!!

Bob
bmiller AT infi DOT net

  P.S.  Are there any guides (preferably on the 'net) for i386 'as'?
	Thanks again.

- Raw text -


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