title: Move multiple registers into a single variable
body: <p>I have a 32-bit number stored in eax and a 32-bit number stored in ebx. I want to combine them into a single 64 bit number defined in section .bss as finalNum, but I'm not sure how. I have tried </p>
  
  <pre><code>mov esi, finalNum
  mov [esi], eax
  add esi, 32
  mov [esi], ebx
  </code></pre>
  
  <p>but for some reason when I try to print out the finalNum it's not printing out correctly so I assume there's a problem in these 4 lines. Also this is in 32-bit nasm.</p>
  
  <p>edit:</p>
  
  <p>So I tried</p>
  
  <pre><code>    mov esi, finalNum
      mov [esi+0], eax
      mov [esi+4], ebx
  </code></pre>
  
  <p>But, still coming up with some weird print, I declared finalNum as</p>
  
  <pre><code>    finalNum:   resb 8
  </code></pre>
  
  <p>do you think this could be an issue?</p>
  
  <p>Edit:</p>
  
  <pre><code>    Enter first number to multiply:
      34567
      Enter second number to multiply:
      76543
      First Num: 34567
      Second Num: 76543
      Addition: 111110
      Multiply:
      ▒EAX : 0
      EBX : -1649105415
  </code></pre>
  
  <p>as you see when I multiply and print out I get a weird character.</p>
  
  <p>Edit:
  Code to print the result</p>
  
  <pre><code>    mov     eax, SYSCALL_WRITE ; write message
      mov     ebx, STDOUT
      mov     ecx, msg7
      mov     edx, len7
      int     080h
  
      mov     eax, SYSCALL_WRITE ; write user input
      mov     ebx, STDOUT
      mov     ecx, finalNum
      mov     edx, BUFLENFINAL
      int     080h
  </code></pre>
  
  <p>BUFLENFINAL = 8 by the way</p>