gas vs. nasm syntax

Charles Bailey yasm at hashpling.org
Fri Jun 8 10:50:14 PDT 2007


This could prove to be a really dumb question but are the following two 
versions of assembler the same?

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

(For reference gcc/gas assembles to the 8B version too.)


      5                                 f:
      6 00000000 55                      pushl   %ebp
      7 00000001 8B15[00000000]          movl    arr, %edx
      8 00000007 89E5                    movl    %esp, %ebp
      9 00000009 8B4508                  movl    8(%ebp), %eax
     10 0000000C 5D                      popl    %ebp
     11 0000000D 8B0482                  movl    (%edx,%eax,4), %eax
     12 00000010 C3                      ret
     13                                  .size   f, .-f



      7                                 f:
      8 00000000 55                      push ebp
      9 00000001 BA[00000000]            mov edx, arr
     10 00000006 89E5                    mov ebp, esp
     11 00000008 8B4508                  mov eax, [ebp + 8]
     12 0000000B 5D                      pop ebp
     13 0000000C 8B0482                  mov eax, [edx + 4*eax]
     14 0000000F C3                      ret



Thanks,

Charles.


More information about the yasm-devel mailing list