gas vs. nasm syntax

Peter Johnson peter at tortall.net
Fri Jun 8 16:00:47 PDT 2007


On Fri, 8 Jun 2007, Charles Bailey wrote:
> This could prove to be a really dumb question but are the following two
> versions of assembler the same?

No they are not.

> If so what makes yasm choose the B8+ opcode vs. the 8B opcode for the
> MOV r32, imm32 instruction?  (arr is an external identifier.)

The gas version you gave is not doing MOV r32, imm32.

>      7 00000001 8B15[00000000]          movl    arr, %edx

in GAS syntax means "mov edx, [arr]" in NASM syntax, NOT "mov edx, arr".

>      9 00000001 BA[00000000]            mov edx, arr

If this is what you want to say in GAS syntax, you want "movl $arr, %edx". 
The $ is required in GAS syntax to treat the operand as an immediate 
rather than an address.

-- 
Peter


More information about the yasm-devel mailing list