Xref: news2.mv.net comp.os.msdos.djgpp:4408 From: brennan AT mack DOT rt66 DOT com (Brennan "Mr. Wacko" Underwood) Newsgroups: comp.os.msdos.djgpp Subject: Re: Making the nearptr hacks use longs. Date: 30 May 1996 13:36:56 -0600 Organization: None, eh? Lines: 27 Message-ID: <4oktco$9u1@mack.rt66.com> References: <4nqe0f$som AT geraldo DOT cc DOT utexas DOT edu> <4nqp27$8uu AT waldorf DOT csc DOT calpoly DOT edu> NNTP-Posting-Host: mack.rt66.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <4nqp27$8uu AT waldorf DOT csc DOT calpoly DOT edu>, Jan Louwerens wrote: >of the loop, as well as the (4*i) and the add. Why not just make an inline >assembler function to do it. That seems fastest to me. Something like: > > mov esi, (pointer to Virtual Screen) > mov edi, (pointer ~csc/sample/ada/to VGA Memory) > mov ecx, 16000 (320*200 / 4 (for ~csc/sample/ada/dwords)) > rep > movsl > >(This code may not be exactly correct, but it gets the idea across) You'll get pretty much exactly this if you do: memcpy((pointer to Virtual Screen), (pointer to VGA memory), 64000); with optimization turned on. Trust me. As for speed, you can sometimes beat a rep;movsl on P5 and up, but only on some memory subsystems (Overlapping pushes/pops, check comp.lang.asm.x86). For general purpose code, this is the fastest you're likely to get. --Brennan -- brennan AT rt66 DOT com | "Barney vs. Mentos II: Unholy Alliance." Coming Soon.