%include "rw32-2018.inc"
 
section .data
 
section .text
 
Soucet:
  push ebp          ; stack-frame enter (ulozeni EBP)
  mov  ebp,esp      ; stack-frame enter (EBP ukazuje na vrchol zasobniku)
  sub  esp,4        ; stack-frame enter (ESP preskoci az za lokalni promenne)
 
  mov  edx,[ebp+8]  ; EDX = a = 128 -- prvni argument
  mov  ecx,[ebp+12] ; ECX = b = 2   -- druhy argument
  add  edx,ecx      ; EDX = a + b
  mov  [ebp-4],edx  ; c = EDX
  mov  eax,[ebp-4]  ; return c
 
  mov  esp,ebp     ; stack-frame leave (obnoveni ESP)
  pop  ebp         ; stack-frame leave (obnoveni EBP)
  ret  8           ; stdcall odstraneni parametru ze zasobniku (2 x 32-bitu == 8 byte)
 
_main:
 
  push dword 2      ; b = 2
  push dword 128    ; a = 128
  call Soucet       ; Soucet(128,2)
  call WriteInt32
  call WriteNewLine
ret 