Slide 5.11: Little endian order
Slide 5.13: Calculating data sizes and EQU directive
Home

Symbolic Constants


A symbolic constant is created by associating an identifier with either an integer expression or some text. Symbols are used only during the assembly. Code I is equal to Code II.

Code I
 .code
 TEMP = 100
 mov  eax, TEMP
  Symbol Variable
Uses storage? no yes
Value changes at run time? no yes
Code II
 .code
  mov  eax, 100

Equal-Sign Directive
The equal-sign directive associates a symbol name with an integer expression. The syntax is:
         name  =  expression
When a program is assembled, all occurrences of name are replaced by expression, a 32-bit integer value, during the assembler's preprocessor step.

Why use symbols?
Redefinitions
A symbol defined with ‘=’ can be redefined any number of times. The symbol changes value according to the sequential processing of your source code by the assembler.  

 TEMP = 10
 mov  eax, TEMP     ; EAX = 10
 TEMP = 20
 mov  eax, TEMP     ; EAX = 20
 TEMP = 30
 mov  eax, TEMP     ; EAX = 30