News:

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

Main Menu

PROLOGUE/EPILOGUE

Started by habran, February 13, 2013, 01:21:49 PM

Previous topic - Next topic

habran

Hello, It's me again :biggrin:
I wanted to build quick short functions when we not use a stack so we don't need the frame in JWASM 64
after consulting maestro Japheth and little bit of struggle I found the way to use it
here is an example:

;//--------------------------------------------------
option win64:0
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE

xmemcpy PROC dest:QWORD,src :QWORD, count:UINT_PTR
        mov     rax, rcx
        cmp     rcx, rdx
        jz      aexit
        test    r8, r8
        jz      aexit
@@:     mov     r9b, [rdx]
        mov     [rcx], r9b
        add     rcx, 1
        add     rdx, 1
        sub     r8, 1
        jnz     @b
aexit:  ret
xmemcpy ENDP
OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef
;//--------------------------------------------------

option win64:3
option frame:auto
   

and this is what I get commpiled:

xmemcpy:
000000014004DA78  mov         rax,rcx
000000014004DA7B  cmp         rcx,rdx
000000014004DA7E  je          xmemcpy+21h (14004DA99h)
000000014004DA80  test        r8,r8
000000014004DA83  je          xmemcpy+21h (14004DA99h)
000000014004DA85  mov         r9b,byte ptr [rdx]
000000014004DA88  mov         byte ptr [rcx],r9b
000000014004DA8B  add         rcx,1
000000014004DA8F  add         rdx,1
000000014004DA93  sub         r8,1
000000014004DA97  jne         xmemcpy+0Dh (14004DA85h)
000000014004DA99  ret             
Cod-Father