Slide 5.13: Calculating data sizes and EQU directive
Slide 6.1: Data transfer instructions
Home

TEXTEQU Directive

The TEXTEQU directive is very similar to EQU. It creates a text macro.  

 name  TEXTEQU  <text>
 name  TEXTEQU  textmacro
 name  TEXTEQU  %constExpr
Unlike EQU directive, a symbol defined with TEXTEQU can be redefined later in the program.

 name = expression  name EQU expression  name TEXTEQU %constExpr
 Year  =  2002
 .data
 Year  =  2003
 .code
 Year  =  2004
 mov   eax, Year
 call  WriteInt
 Year  EQU  2002
 .data
 Year  EQU  2003
 .code
 Year  EQU  2004
 mov   eax, Year
 call  WriteInt
 Year  TEXTEQU  %2002
 .data
 Year  TEXTEQU  %2003
 .code
 Year  TEXTEQU  %2004
 mov   eax, Year
 call  WriteInt
 Output  Output  Output
   



   



   




 String Size by
name TEXTEQU <text> 
 Array Size by
name TEXTEQU textmacro 

 setEAX  TEXTEQU 
 .data
 string  BYTE  'A', 'B', 'C', 'D', 0
 len  EQU ($ - string)
 .code
 setEAX
 call  WriteInt
   


 .data
 array  WORD  10, 20, 30, 40, 50
 len = ($ - array) / 2
 .code
 setEAX  EQU 
 setupEAX  TEXTEQU  setEAX
 setupEAX
 call  WriteInt
   

 Output  Output
  5     5