www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/28/06:55:35

From: deanh AT zip DOT com DOT au (Dean)
Newsgroups: comp.os.msdos.djgpp
Subject: asm opcode speeds
Date: 28 Oct 1996 10:59:15 GMT
Organization: The Zipsters
Lines: 37
Message-ID: <5523m3$ss5@the-fly.zip.com.au>
NNTP-Posting-Host: zap11.zip.com.au
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


Does anyone know where I can get the speeds of different opcodes for assembly.

In particular, I'm wonder how fast my plot_pixel routine is:

void plot_pixel( int x, int y, unsigned char colour, short where ) {
  __asm__ ("
    movw %3, %%es\n
    movl $0xA0000, %%edi\n
    movw %1, %%di\n
    movw %%di, %%ax\n
    shl $8, %%di\n
    shl $6, %%ax\n
    addw %%ax, %%di\n
    addw %0, %%di\n
    movb %2, %%al\n
    stosb"
    :
    : "g" (x), "g" (y), "g" (colour), "g" (where)
  );
}

P.S. Also, is it faster to put the "stosb" at the end, or replace it 
with:
movb %%al, %%es:(%%edi)

P.P.S. do you really need all those \n's at the end of each line.  I read 
somewhere that you don't.

Thanks in advance,

-----------------------------------------------------------------------------
                               Dean Harding
                             deanh AT zip DOT com DOT au
-----------------------------------------------------------------------------

- Raw text -


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