www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/16/04:00:45

Xref: news2.mv.net comp.os.msdos.djgpp:7348
From: "Vince C." <cheong AT loop DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Screen Fill routine, mode 13h
Date: 16 Aug 1996 03:48:49 GMT
Organization: Morbid Reality
Lines: 43
Distribution: inet
Message-ID: <01bb8b25$ca747060$b3748ace@486dx266>
References: <32136FAB DOT 39 AT sprynet DOT com>
NNTP-Posting-Host: pma1_179.loop.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


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.
floating point opcode "fistp" would definitely help on a pentium.
i would also recommend splitting the "rep movsl" into smaller chunks.
doing so would minimize the missed interrupts during the operation.
i suggest you get some materials on optimization for 32-bit 80x86's
if you want to write faster code.

btw, the operation is call copy/bitblt not fill. filling would be
setting a memory block to a value or pattern.

-- 
  Vince C.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019