← Learn

Introduction to Windows API

Author
Moise Medici
Updated
23 Jan 2026 · Completed

fastcall

In fastcall convention the first two arguments are stored in ECX and EDX while all the others, if needed, are pushed on the stack. In this specific function the ret call is used without any operand only due to the fact that no extra arguments were pushed onto the stack, so there is no need to clean it; in other functions it might be called like in the stdcall example.

FUN PROC
; a is already in ECX, b is already in EDX
mov eax, ecx ; eax = a
add eax, edx ; eax += b
ret ; no stack args here, so plain ret
FUN ENDP

The caller initializes the ECX and EDX registers to be used by the function.

mov ecx, a
mov edx, b
call FUN
; EAX = result