Instrukcje ENTER i LEAVE tworzą i usuwają ramkę stosu.
Instrukcja
enter rozmiar, 0
push ebp mov ebp, esp sub esp, rozmiar
Instrukcja
leave
mov esp, ebp pop ebp
Przy ich użyciu funkcja f ma postać
; zwraca sumę a+b f: enter 4,0 ; utworzenie ramki stosu mov eax, [ebp+8] ; mov eax, [a] add eax, [ebp+12] ; add eax, [b] mov [ebp-4], eax ; mov [c], eax ; wynik jest juz w eax leave ; usunięcie ramki stosu ret ; powrót