Hello people,
I have a question about naming initializing variables on the stack and naming it,first I know that I can create a variable on the stack using the LOCAL directive right after the procedure ,but for example what if I want to Create a variable on the stack manually and assign name for it,is that possible or every time I have to modify where it is in the stack and modify it ?I know that a name is just a label for the address,but I want to know if there is directive which could assign a name to a specific address.
i prefer to do it that way too :P
i use TEXTEQU
there are some examples in the LLKF9_1 download...
http://www.masm32.com/board/index.php?topic=12363.msg94779#msg94779
i also use TEXTEQU to rename the passed parameters
;#########################################################
;
; Stack Frame Equates
;
;#########################################################
_ModeControl TEXTEQU <[EBP+36]> ;signed/unsigned mode control
_OutBufSize TEXTEQU <[EBP+32]> ;output buffer size in bytes
_OutBufBase TEXTEQU <[EBP+28]> ;output buffer base address
_InpValSize TEXTEQU <[EBP+24]> ;input value size in bytes
_InpValBase TEXTEQU <[EBP+20]> ;input value base address
; [EBP+16] PROC return address
; [EBP+12] saved ESI contents
; [EBP+8] saved EDI contents
; [EBP+4] saved EBX contents
; [EBP] saved EBP contents
_SignXorMask TEXTEQU <[EBP-4]> ;sign XOR mask
_OutLastDword TEXTEQU <[EBP-8]> ;address of last dword in output buffer
thanks for your help I didn't about that directive.
One problem with using text equates to name locals is that the equate is not local.
thanks for pointing that out, Michael
that is why i use a leading underscore in the names - not that i "own" the underscore, either :P
Quote from: MichaelW on April 26, 2010, 05:27:57 AM
One problem with using text equates to name locals is that the equate is not local.
Maybe one could overcome this restriction by turning the equates into macros, and purging those macros inside the ret macro.
Unfortunately, there seems no easy way to "purge" equates...
Quote from: MichaelW on April 26, 2010, 05:27:57 AM
One problem with using text equates to name locals is that the equate is not local.
Does MASM have an equivalent to GoAsm's LOCALEQU or #localdef ?
an other method would be to create an local stack frame:
local_vars macro locals:VARARG
LOCAL dummyProc
lv_dummyproc TEXTEQU <dummyProc>
dummyProc proc
LOCAL &locals
endm
local_end macro
leave
% lv_dummyproc endp
endm
local_vars aa:DWORD,bb[128]:BYTE
mov aa,1
mov bb[0],1
local_end
for all that effort, i think i would just use [ebp-8] :bg
Quote from: jj2007 on April 26, 2010, 01:01:15 PM
Unfortunately, there seems no easy way to "purge" equates...
That was the first thing I tried. Changing the equate to <> did not work either, I suspect because equates are somehow involved in more than one pass.