delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/06/06:03:00

From: tome AT theden DOT com
Message-Id: <199607060956.FAA06971@portal.dx.net>
To: djgpp AT delorie DOT com
Date: 6 Jul 1996 05:01:52 EDT
Subject: Setpixel in AT&T inline asm....

VE>      "movzx $_y, %eax \n\t"
VE>      "imul $320, %eax \n\t"
VE>      "movzx $_x, %ebx \n\t"
VE>      "add %ebx, %eax \n\t"

VE>The immediate problem being, it can't recognize movzx. I can't think of any
VE>other alias this was be listed as... not to mention I'm really guessing here
VE>There's probably tons of other flaws in this routine. (I really don't want t
VE>get into extended ASM just yet). Also, could someone confirm or correct me
VE>that a char is a byte, an int is 16 bits? (or is it 32?) geez, what I wouldn
VE>give for db, dw, and dd right now.... oh well, thanks in advance.. :)

       The AT&T syntax equivalent to movzx is movz, so in the above
cases you would use movzl(The l is not actually needed but it is best to
use suffixes on all of your assembly commands, this way you know exactly
what you are doing).  The suffixes are b, w, and l depending on if you
are working with a byte, a 2 byte word, or a 4 byte long.
       The AT&T equivalents to db, dw, and dd are .byte, .word, .long
respectively.  Some other useful data storage commands are .fill,
.ascii, and .asciz.  They are used like this:

some_numbers:       <- label to access these numbers
.byte 23,67,0,319
.word 65535, 0, 32767
.long 0x0ffffffff,0x0fefefefe,0x0aaaaaaaa

.fill 65536, 4, 0    <- stores 65536 4 byte longs of 0 here(clears
                       262144 bytes)
some_strings:
.ascii "AT&T assembly is cool"    <- this is equivalent
.byte 0
                                      to
.asciz "AT&T assembly is cool"    <- this

The more I use AT&T assembly, the more I like it.  The suffixes are a
good thing, and it makes more sense to have the destination operand on
the right.  Also, being in 32 bits there is no longer any need for all
those silly assembler directives that are needed by Tasm and Masm.


            

- Raw text -


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