title: Assembly ADC (add with carry)
body: <pre><code>mov eax, ptr_to_num1 ; little endian
  mov ebx, ptr_to_num2 ; little endian
  xor ecx, ecx
  xor edx, edx
  clc
  bytes_addition:
      mov dl, byte [eax+ecx] ; byte from shortest
      adc dl, byte [ebx+ecx]
      mov byte [eax+ecx], dl
      inc ecx
      cmp ecx, 4 ; counter, 
      jl bytes_addition
  </code></pre>
  
  <p>Consider at</p>
  
  <p>EAX: 4F2252FF (big endian)</p>
  
  <p>EBX: 00DFFC00 (big endian)</p>
  
  <p>The result of this addition is wrong: 50024fff (big endian). It should be 50024eff. It looks like the carry flag is affected, but why?</p>