Mail Archives: djgpp/1996/08/16/22:46:45
Vince C. (cheong AT loop DOT com) wrote:
: John Luebs <jkluebs AT sprynet DOT com> 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
- Raw text -