Hello !
I have a question in my mind for a long time about MASM...
Is the asm "EQU" preprocessed (like a C #define) before assemblying or is it considered as a constant value in memory ?


Posted on 2001-09-27 04:52:53 by JCP
EQU is like #define in C - it is an assemble time constant that only exist within the assembler internal data structures unless used in your code. For example, if you use EQU's for conditional assembly, then no value is created within the program that represents the EQU.
Posted on 2001-09-27 07:58:54 by bitRAKE
Thanks for the answer... ;)

If i understand all you said, masm replace the equates name by the values (preprocessing) ?
Because if I compile the same code without the equates (i replace manually the equates by their corresponding value) the executable file isn't the same... ?_o

I will disassemble a code that use equate to know if it uses immediate values or memory tonight at home.


Posted on 2001-09-27 11:29:02 by JCP
If say

myvalue equ 10034h

and you say,

mov eax, myvalue
>mov eax, 10034h

or it can be a pointer to memory: (not a good idea though)

mov myvalue, eax
>mov [10034h], eax
Posted on 2001-09-27 12:21:28 by Kenny
No, EQU is preprocessed. MASM just replaces the strings so you don't have to worry about your program getting larger.


value EQU 5

mov eax,value

;Is assembled to

mov eax,5
Posted on 2001-09-28 01:43:36 by gliptic
Ok, thank you all ;).
I'm glad to know it's preprocessed.
It saves me time writing my own preprocessor. :alright:
Posted on 2001-10-02 01:06:37 by JCP