The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ASMManiac on March 02, 2012, 08:16:12 PM

Title: Local variables on the stack
Post by: ASMManiac on March 02, 2012, 08:16:12 PM
Right now I am creating local variables and placing them on the stack manually, such as this:

mov rbp, rsp
....  code ...
push 0
push 100
i TEXTEQU <qword ptr [rbp - 8*1]>    ; i=0
j TEXTEQU <qword ptr [rbp - 8*2]>    ; j = 100
....  code ...
mov rdx, i
mov r8, j
....  code ...

Is there a way to make jwasm (or masm) do this automatically for me?
If I declare variables through the assembler and let it do this for me, do I need to keep rbp or other registers free?