X SWORD -20h
Y BYTE 10101010b, 'A', 10
SBYTE ?
A data definition statement sets aside storage in memory for a variable and may assign a name to the variable. Each data definition has the syntax:
[ name ] directive initializer [, initializer ] ...
Name
A variable name is a label that marks the offset of a variable from the beginning of its enclosing segment. For example, suppose that X
was located at offset 0 in the data segment and consumed 2 bytes of storage. Then Y
would be located at offset 2.
- Labels are identifiers that act as a place marker for data/instructions.
- Identifiers are programmer-chosen names.
Some examples are:
temp
, COUNTER
, _expr
, $store
, or A123
.
Rules for creating them are
- They may contain between 1 and 247 characters.
- They are NOT case-sensitive.
- The first character must be either a letter (A..Z, a..z), _, @, ?, or $. Subsequent characters may also be digits.
- An identifier can not be the same as a reserved word.
- Reserved words have special meaning and can only be used in their correct context. They can be any of the following:
- Instruction mnemonics, such as
ADD
, MOV
, or SUB
- Directives, such as
TITLE
or INCLUDE
- Attributes, such as
BYTE
or WORD
- Operators, such as +, or –
- Predefined symbols, such as
@data
A list of the MASM reserved words can be found from here.