From: brennan AT news DOT rt66 DOT com (Brennan "The Rev. Bas" Underwood) Newsgroups: comp.os.msdos.djgpp Subject: Re: fast vbe graphics Date: 7 Apr 1997 16:54:53 -0600 Organization: Acid Brain Lines: 48 Distribution: world Message-ID: <5ibtvt$3f4$1@mack.rt66.com> References: <01IHEKLS7NOI92SA7U AT NICKEL DOT LAURENTIAN DOT CA> NNTP-Posting-Host: mack.rt66.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <01IHEKLS7NOI92SA7U AT NICKEL DOT LAURENTIAN DOT CA>, wrote: >I'm trying to get fast vbe 2.0 (with linear frame buffer) graphics >at 640x480x256 yet am having some difficulties. > >I'm drawing the images to a video buffer (video[640*480]) and then >try to display with > >for(int i=0; i < 307200; i+=4) >{ > temp = ((unsigned long)(video[i])) << 24\ > + ((unsigned long) (video[i+1])) << 16\ > + ((unsigned long) (video[i+2])) << 8\ > + ((unsigned long) (video[i+3])); > > _farnspokel(i, temp); > >} You're going to a lot of trouble to build a dword from chars. You could rewrite the loop, casting video to be an int *, or you could drop to assembler like so: /* displays 307200 bytes from video into the memory pointed at by selector, starting at byte 0 of the segment */ void display_it(int selector, void *video) { asm ( "pushw %%es\n\t" /* save es from @destruction */ "movw %0, %%es\n\t" /* load user selector into %es */ "cld\n\t" /* want to copy forwards */ "rep\n\t" "movsl\n\t" /* copy from ds:esi to es:edi ecx times */ "popw %%es" /* restore es */ : /* no output */ : "g" (selector) "c" (307200/4), "S" (video), "D" (0) : "%ecx", "%esi", "%edi" ); } Unfortunately, I'm not in a situation where I can test this, as NT keeps aborting gcc for some reason. I've used code like this before, though, and I'm sure I'll find out very quickly if that's broken. Brennan -- brennan AT rt66 DOT com | Ding-a-ding-dang my dang-a-long-ling-long. Riomhchlaraitheoir| Rasterfarian | -O