Xref: news2.mv.net comp.os.msdos.djgpp:7410 From: mud AT merlin DOT sedona DOT net (Justin Frankel) Newsgroups: comp.os.msdos.djgpp Subject: Re: Screen Fill routine, mode 13h Date: 17 Aug 1996 00:24:07 GMT Organization: Nullsoft Lines: 40 Distribution: inet Message-ID: <4v33f7$ohh@news2.texas.net> References: <32136FAB DOT 39 AT sprynet DOT com> <01bb8b25$ca747060$b3748ace AT 486dx266> NNTP-Posting-Host: merlin.sedona.net To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Vince C. (cheong AT loop DOT com) wrote: : John Luebs wrote in article : <32136FAB DOT 39 AT sprynet DOT com>... : > Here is a fast way to write a screen in mode 13h : > The amount of screen to fill can be adjusted by altering ECX : > long* data; : > : > data = (long*)image->buffer; : > __asm__ __volatile__ ("pushw %%es\n //save ES for proper restoring : > movl $0xa0000h, %%edi\n //set the dos protected : offset : > movw %0, %%es\n //move the selector : > movl %1, %%esi\n //set the source offset, DS is : already : > set : > movl $16000, %%ecx\n //loop 16000 times for 16000 : long : > transfers : > cld\n //set direction to forward : > rep\n //repeat : > movsl\n //transfers from DS:ESI to ES:EDI 16000 : times : > popw %%es\n" //restore ES : > : : > : "g" (_dos_ds), "g" (data) : > : "cx", "di", "si" //clobbered registers : > ); : > : uh... you sure ? seem to me the near pointer counterpart's faster; : far pointers/segment overrides are sloooooooooooow. Not quite. Notice that the movsl uses es anyways. So there are no segment overrides, and the only thing that is slower is setting es in the first place, which requires the processor to grab the selector out of the GDT or LDT or whichever. So a few cycles at the beginning and the end- big deal. Justin