SIZEOF Operator and LABEL Directive
SIZEOF Operator
SIZEOF operator returns a value that is equivalent to multiplying LENGTHOF by TYPE.
LABEL Directive
LABEL directive lets you insert a label and give it a size attribute without allocating any storage.
LABEL is to provide an alternative name and size attribute for the variable declared next in the data segment.LABEL directive allows you to construct a larger integer from two smaller integers. 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 |