The Macro Assembler recognizes the standard ASCII character set, consisting of upper and lowercase letters (A-Z, a-z), digits (0-9), and a group of special characters listed in the table below. The Macro Assembler also recognizes the ASCII control characters signifying carriage return, new line, form feed, vertical tab, and horizontal tab.
Identifiers, or symbols, are composed of letters, digits, and the special characters: decimal point or underscore.The first character of an identifier must be alphabetic or one of these two special characters. Upper and lowercase letters are distinct; the identifier abc is not the same as the identifier ABC. Characters in reserved symbols, such as directives, machine instructions, and registers, are also case sensitive.
The following table shows some valid and invalid identifiers:
Identifier | Validity |
---|---|
*star |
Invalid (may not start with *) |
123test |
Invalid (may not start with digit) |
f-ptr |
Invalid (hyphen not allowed) |
_hello |
Valid |
LABEL |
Valid |
test4 |
Valid |
The following identifiers are part of the fundamental assembly language. These symbols and their meanings are shown in the table below. Identifiers in both upper and lower cases are reserved.
Macro Assembler constants may be numeric, character, or string constants.
A sequence of digits defines a numeric constant. By default, constants are in decimal or floating point format, although this can be changed by a directive in a source file. However, constants can be specified in hexadecimal, octal, binary by preceding the number with one of the special prefixes on the following page:
Type | Prefix | Example |
---|---|---|
hexadecimal |
0x |
0xb0b |
octal |
0 |
0747 |
binary |
0b |
0b110011 |
All integer constants are assigned 32-bit two's complement values.
Some directives take a string constant as one or more of their arguments. A string constant consists of a sequence of characters enclosed in double quotes ("). A string constant can contain any ASCII character including ASCII null, except newline. The null character is not appended to strings by the Macro Assembler, as it is in C or C++.
A character constant can be used in any location where an integer constant is needed. A character constant consists of the following items in this order: either a single ASCII character or a single quote character (`), a backslash character (\), one of the value escape characters, and a single quote character (`). A character constant is considered equivalent to the ASCII value of the character or escape sequence. For example, the character constant a is equivalent to the decimal integer 97, and the character constant \r is equivalent to the decimal integer 13 (see table on the following page).
Character and string constants consists of ASCII characters. The ASCII backslash (\) is used within character and string constants to escape the quotation marks and to specify certain control characters symbolically. A backslash followed by any non-escape character is equivalent to that character (e.g. \a is equivalent to a since \a is not an escape sequence).
A Macro Assembler source statement consists of a series of fields, delimited by spaces and/or horizontal tab. The general format of a statement is:
[label:] operator arguments[comments]
The label field is optional. When specified, it starts in column one and is terminated by the first white space character or line terminator detected. The last character of the label field must be a colon. More than one label may be associated with a given statement line, but a line may consist of no more than one label field.
The label is used to associate a memory location or constant value with the symbolic label name. Labels may have the same names as instructions and directives.
The operator field starts with the first non-white space character after the optional label field and is terminated by the first white space character or line terminator encountered after the operator. An operator is any symbolic opcode, directive, or macro call.
The argument field starts with the first non-white space character following the operator field, and ends with a line terminator or the beginning of a comment field. Arguments are entered to the opcode or directive or are macro call specified.
The comment field is optional and begins with a double slash (//) or a pound sign (#). Ignore all characters to the right of the comment character until the end of the line.
The Macro Assembler does not support continuation lines.
White space consists of spaces, form feeds, and horizontal tabs.
Assembly input lines are terminated by a semicolon, line feed, form feed, or a carriage return.