title: My first exercise in assembly
body: <p>I'm working under visual studio 2005 with assembly (I'm a newbie) and I want to create a program that calculate arithmetic progression with that rule: A<sub>n</sub> = 2*A<sub>n-1</sub> + A<sub>n-2</sub>
  but. I really don't know how to work with registers and I need just one example from you to continue with my exercises.</p>
  
  <p>This is my code:</p>
  
  <pre><code>.386
  .MODEL flat,stdcall
  
  .STACK 4096
  
  extern ExitProcess@4:Near
  
  .data                               
  arraysize DWORD 10
  
  setarray  DWORD 0 DUP(arraysize)
  firstvar  DWORD 1
  secondvar DWORD 2
  
  .code                               
  _main:                              
  mov eax,[firstvar]
  mov [setarray+0],eax        
  mov eax,[secondvar]
  mov [setarray+4],eax
  
  mov ecx, arraysize              ;loop definition
  mov ax, 8
  
  Lp:
  mov eax,[setarray+ax-4]
  add eax,[setarray+ax-4]
  add eax,[setarray+ax-8]
  mov [setarray+ax],eax
  
  add ax,4;
  loop Lp
  
  add ax,4;
  
      push    0                   ;Black box. Always terminate
      call    ExitProcess@4       ;program with this sequence
  
      end   _main              ;End of program. Label is the entry point.
  </code></pre>