
Mark,
Look in the "macros64" directory for the file "macros64.inc" and you will find the source of all the macros I wrote for 64 bit MASM. There you will find the macro "UseStackFrame" and its matching "EndStackFrame" and the two macros are designed to be called by a number of wrapper macros.
STACKFRAME = the default stackframe with a 16 byte alignment.
NOSTACKFRAME turns the stackframe off.
Then there a a number of alternative forms that only differ in their alignment.
YMMSTACK = 32 byte alignment for AVX instructions.
ZMMSTACK = 64 byte alignment for AVX2 instructions.
CUSTOMSTACK = roll your own.
They differ only in the equates passed to the "UseStackFrame" macro.
stackframe_default equ <dflt> ;; set default stack
stackframe_dynamic equ <dynm> ;; set byte count for ENTER mnemonic
stackframe_align equ <algn> ;; align the stack by an interval of 16
The documentation for the first 2 arguments (dflt and dynm) is available in the Intel manuals under the ENTER mnemonic, the third argument "algn" has to be a power of 2 byte alignment.
With the "masm64" help file which is incomplete on many of the library and macro code you need to read the data in these categories.
Simplified Introduction
A basic explanation of the stackframe and invoke notations.
Design Criteria
Calling Convention
How the Win 64 calling convention works.
Stack frame reference
How the MASM64 stackframe works.
In particular, you need to understand how the Win64 ABI works and why you must fully comply with it or your application will not start. Get it wrong and the app will just exit telling you nothing. Win64 FASTCALL calling convention is a lot more complex than how Win32 worked, rather than LIFO stack arguments, all arguments must be aligned according to the ABI with the first 4 arguments being in RCX, RDX, R8 and R9 and the stack has what is called "shadow space" that allows the register contents to be written to the stack for code design that required repeated access to the arguments (recursion being one example).
The system I have built is designed to look much like 32 bit code so you don't have to keep twiddling the stack to write reliable code, if you need to know how it works you need to read the documentation AND the main macro file. I warn anyone who want to write 64 bit MASM that it is an advanced topic with little useful data available, lousy and often inaccurate documentation and very few people who understand how it works.