title: power of 2 in x86 assembly, calculate 2^x that doesn't fit in a 32-bit register
body: <p>As a starter in ASM programming i am need to get the result of 2 to the power of 38 in Assembly, and i need your help in understanding why is my program doesn't produce the result i am need (it prints 4 decimal):</p>
  <pre><code>.386
  .model flat, stdcall
  option casemap:none
  
  include \masm32\include\windows.inc
  include \masm32\include\msvcrt.inc
  includelib \masm32\lib\msvcrt.lib
  
  .data
  
  formatstr db &quot;%d&quot;,0
  
  .code 
  start:
  
  mov eax , 2
  mov ecx , 38
  mov esi , eax
  mov edx , 0
  
  .while TRUE
      mul esi
      mov esi, edx
      add esi, eax
      mov edx, 0
      mov eax, 2
      dec ecx
      .break .if (!ecx)
  .endw
      
  
  
  
  invoke crt__cprintf, addr formatstr, esi
  
  
  end start
  </code></pre>
  <p>as you can see i am writing it using masm32 (if that has any matter in that case).</p>