From: "Ron Grunwald" Organization: Edith Cowan University To: djgpp AT sun DOT soe DOT clarkson DOT edu, Marc Coupar Date: Tue, 12 Dec 1995 11:17:56 GMT+800 Subject: Re: blitting to vga problem Reply-To: r DOT grunwald AT cowan DOT edu DOT au > Hi, > I've been having a little trouble with the following routine which should > blitcopy a 64k buffer to vga mem (used in mode 13h). I have set it to > copy dwords, but this indiscriminately crashes my machine. The confusing > thing is that when I change it to copy the buffer with just word writes, > it works fine, although obviously a bit slower. > > The only thing I can think of is it might be my video card - a poor 16 bit > ISA Trident TVGA. I believe there can be problems with 32 bit writes to > a 16 bit card. Can anybody shed some light on this ? This is true but only applies if you're writing to the VGA processor's registers directly with an outportl() call for instance. However, in your case a memory block is effectively copied from one mem. location to another with no direct interaction with the VGA chip. > > note: I'm using gcc v1 with the latest maintenance release. > 0xd0000000 is where gcc maps the screen segment to. > > void BlitBufferToVga (int * buffer) { > asm(".align 4 "); > asm("movl %0,%%esi ":: "g" (buffer) : "%esi"); ^^^^^ That's an interesting syntax you're using. Can you enlighten me on how it works? > asm("movl $0xd0000000,%%edi ":: : "%edi"); > asm("movl $16000,%%ecx ":: : "%ecx"); > asm("cld "); > asm("rep "); > asm("movsl (%%esi),(%%edi) ":: : "%esi","%edi"); > } > > PS: I know that an unrolled loop version will be faster, and I will do that > as soon as I understand what the problem with this version is. > > I would be grateful if any help was emailed rather than posted. > > Thanks > > Marc > mc AT dstn24 DOT dct DOT ac DOT uk > > > ******************************************************************** | Author.............. Ron Grunwald | | Internet............ r DOT grunwald AT cowan DOT edu DOT au | | Phone............... (09)273 8027 or (09)273 8468 | |------------------------------------------------------------------| | Department.......... Computer Operations and Systems Management | | Division/Faculty.... Information Technology | | Institute........... Edith Cowan University, Churchlands | | Location............ Perth, Western Australia | ******************************************************************** "I don't have any solution but I certainly admire the problem!"