title: Endianness inside CPU registers
body: <p>I need help understanding endianness inside CPU registers of x86 processors. I wrote this small assembly program:</p>
  
  <pre><code>section .data
  section .bss
  
  section .text
      global _start
  _start:
      nop
      mov eax, 0x78FF5ABC
      mov ebx,'WXYZ'
      nop  ; GDB breakpoint here.
      mov eax, 1
      mov ebx, 0
      int 0x80
  </code></pre>
  
  <p>I ran this program in GDB with a breakpoint on line number 10 (commented in the source above). At this breakpoint, <code>info registers</code> shows the value of <code>eax=0x78ff5abc</code> and <code>ebx=0x5a595857</code>. </p>
  
  <p>Since the ASCII codes for W, X, Y, Z are 57, 58, 59, 5A respectively; and intel is little endian, 0x5a595857 seems like the correct byte order (least significant byte first). Why isn't then the output for eax register <code>0xbc5aff78</code> (least significant byte of the number 0x78ff5abc first) instead of <code>0x78ff5abc</code>? </p>