Sender: fabrice AT asim DOT lip6 DOT fr Message-ID: <34795F4D.599A@trash.lip6.fr> Date: Mon, 24 Nov 1997 12:04:45 +0100 From: Fabrice ILPONSE MIME-Version: 1.0 To: djgpp users group Subject: Re: djgpp slow (source files) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Hi! Here are the code i've used. For gcc the command line : gcc -O2 -m486 -s prog.cpp -lv where libv.a is the librarie containing the function Xtest() void Xtest() { pushad; asm( "pushw %es\n" "movw ScreenSeg,%es\n" "xorl %edi,%edi\n" "movl $32000,%ecx\n" ".lp:\n" "movw %ss:(%edi),%ax\n" "movw %ax,%es:(%edi)\n" "addl $2,%edi\n" "decl %ecx\n" "jnz .lp\n" "popw %es\n" ); popad } ScreenSeg is a selector allocated to 0xa00000 and defined as: short ScreenSeg asm("ScreenSeg"); the gcc main prog: #include "xmode.h" #include extern void Xtest(); main() {Vmem *u; int a; XON(320,200); do { Color(0,0,30,0); Xtest(); Color(0,0,0,0); WaitVBL(); if (kbhit()) a=getch(); else a=0; } while (a!=27); return 0; } the borland c prog: #pragma inline #include #define M32 asm .386 void waitvbl(void) { asm { .lvbll000: mov dx,03dah in al,dx and al,8 jz .lvbll000 .lvbll001: mov dx,03dah in al,dx and al,8 jnz .lvbll001 } } void color(char O,char M,char N,char Q) { asm { mov al,O mov dx,03c8h out dx,al mov dx,03c9h mov al,M out dx,al mov al,N out dx,al mov al,Q out dx,al } } main() {int a; asm {mov ax,13h;int 10h} do { color(0,30,0,0); asm {mov ax,0a000h mov es,ax #ifdef M32 xor edi,edi mov ecx,32000 .iii: mov ax,ss:[edi] mov word ptr es:[edi],ax add edi,2 dec ecx jnz .iii #else xor di,di mov cx,32000 .iii: mov ax,ss:[di] mov word ptr es:[di],ax add di,2 dec cx jnz .iii #endif } color(0,0,0,0); waitvbl(); if (kbhit()) a=getch(); else a=0; } while (a!=27); asm {mov ax,3;int 10h} return 0; } -- ^ ^ ^ | | | +-+-+ Fabrice ILPONSE | | | -