SIZEOF Operator and LABEL Directive


SIZEOF Operator
The SIZEOF operator returns a value that is equivalent to multiplying LENGTHOF by TYPE.

LABEL Directive
The LABEL directive lets you insert a label and give it a size attribute without allocating any storage.
 SIZEOF Array  SIZEOF Table  LABEL WORD
 
 
 .data
 
 
 arr  DWORD  12 DUP(?)
 
 
 .code
 
 
 mov   eax, SIZEOF arr
 
 
 call  WriteInt
 
 
 .data
 
 
 tbl  WORD \
 
 
     10 DUP(5 DUP(?))
 
 
 .code
 
 
 mov   eax, SIZEOF tbl
 
 
 call  WriteInt
 
 
 .data
 
 
 X  LABEL  WORD
 
 
 Y  DWORD  12345678h
 
 
 .code
 
 
 mov   eax, 0
 
 
 mov   ax, X+2
 
 
 call  WriteHex
 Output  Output  Output
   



   



   



 LABEL BYTE  LABEL DWORD  LABEL DWORD
 
 
 .data
 
 
 S   LABEL  BYTE
 
 
 C1  BYTE   'a'
 
 
 C2  BYTE   'b'
 
 
 C3  BYTE   0
 
 
 .code
 
 
 mov   edx, OFFSET S
 
 
 call  WriteString
 
 
 .data
 
 
 X  LABEL  DWORD
 
 
 Y  WORD   1234h
 
 
 Z  WORD   5678h
 
 
 .code
 
 
 mov   eax, X
 
 
 call  WriteHex
 
 
 .data
 
 
 X  LABEL  DWORD
 
 
 Y  WORD   1234h
 
 
 Z  DWORD  5678h
 
 
 .code
 
 
 mov  eax, X
 
 
 call WriteHex
 Output  Output  Output
   



   



   





      “I’m not arguing, I’m just explaining why I’m right.”    
      ― Unknown