title: same x86 assembly instruction differs between NASM and GAS
body: <p>the assembly code is </p>
  
  <pre><code>mov eax, 0x3a14a5
  jmp eax
  </code></pre>
  
  <p>GAS produces an opcode of </p>
  
  <pre><code>0xB8, 0xA5, 0x14, 0x3A, 0x00 
  0xFF, 0xE0
  </code></pre>
  
  <p>while NASM produces and opcode of </p>
  
  <pre><code>0x66, 0xB8, 0xA5, 0x14, 0x3A, 0x00 
  0x66, 0xFF, 0xE0
  </code></pre>
  
  <p>So you see NASM preappends a 0x66 before the code.  Within my program (which I won't go into details about), the GAS opcode works correctly, and the NASM code causes a crash indicating that these two opcodes are not equal.  Why does NASM preappend the 0x66 and how can I get rid of it?</p>
  
  <p>update:  The <code>bits 32</code> directive worked.  Thanks for the quick reply, links, and explanations!</p>