3.2 FASTCALL Register Calling Convention

Asmc Macro Assembler

3.2 FASTCALL Register Calling Convention

In 16- and 32-bit mode, one may use either the Microsoft or the Watcom register calling convention. It's selected by option -zf.

The Microsoft FASTCALL convention uses registers AX, DX and BX in 16-bit for the first 3 parameters, and registers ECX and EDX in 32-bit for the first 2 parameters which are small enough to fit into a register.

The Open Watcom fastcall convention uses up to four registers ( E/AX, E/DX, E/BX, E/CX ).

In 64-bit mode, FASTCALL means the standard Windows 64 ABI if output format is not ELF. For -elf64, there is no FASTCALL support implemented yet.

To make FASTCALL the default calling convention, there are 3 ways:

  • Commandline options -Gr ( or -win64 )
  • Second argument of the .MODEL directive: .MODEL FLAT, FASTCALL
  • Directive OPTION LANGUAGE: FASTCALL