News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

64-bit Variadic functions

Started by Vortex, August 02, 2023, 05:19:52 AM

Previous topic - Next topic

Vortex

Here is a classical sample specifying the number of arguments :

OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE

CalcSum PROC counter:QWORD,args:VARARG

;  mov    QWORD PTR [rsp+8],rcx
    mov    QWORD PTR [rsp+16],rdx
    mov    QWORD PTR [rsp+24],r8
    mov    QWORD PTR [rsp+32],r9

    xor    rax,rax
    lea    r10,[rsp+16]
@@: 
    add    rax,QWORD PTR [r10]
    add    r10,8
    dec    rcx
    jnz    @b

    retn

CalcSum ENDP


OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef