News:

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

Main Menu

Minor change to the STACKFRAME macro.

Started by hutch--, September 30, 2016, 09:53:29 AM

Previous topic - Next topic

hutch--

I have done a minor change to the STACKFRAME macro to simplify its use and help keep down the level of clutter when coding an application.

    STACKFRAME MACRO dflt:=<96>,dynm:=<128>
      stackframe_default equ <dflt>     ;; set default stack
      stackframe_dynamic equ <dynm>     ;; set byte count for ENTER mnemonic
      OPTION PROLOGUE:UseStackFrame
      OPTION EPILOGUE:EndStackFrame
    ENDM

    NOSTACKFRAME MACRO
      OPTION PROLOGUE:NONE
      OPTION EPILOGUE:NONE
    ENDM

The two parameters have a default value so that a simple STACKFRAME call works as before but rather than have to find the equate definitions to alter either value, if you need to change them, you simply add the extra parameters. Importantly the parameters MUST be in intervals of 16 to maintain OS specified alignment.

The NOSTACKFRAME macro is unchanged so if you need to turn the stackframe off you simply place a NOSTACKFRAME macro call before the next code that requires the stack frame not to be used.

The purpose of clutter reduction is so that the style of code that was used in the 32 bit MASM32 SDK can be used with ML64 and remain familiar instead of having to figure out what the differences are.

DlgProc proc hWin:QWORD,uMsg:QWORD,wParam:QWORD,lParam:QWORD

    LOCAL buffer[260]:BYTE
    LOCAL fbuffr[260]:BYTE

  ; Your code

    xor rax, rax
    ret

DlgProc endp

Just keep in mind that ML64 does no syntax checking in argument count and data size so you will have to be both correct and accurate with both procedure definitions AND procedure calls.