The assembler can manipulate constants and relocatable values at assembly time. If the assembler cannot resolve these to a constant value (for example, an expression involving the value of an external symbol cannot be resolved at assembly time), the expression is passed to the linker to resolve.
Integer constants represent integer values and can be represented in binary, octal, decimal, or hexadecimal. You can specify the radix for the integer constant by adding a radix, specified as a suffix to the number. If no radix specifier is given, the constant is decimal.
decimal-digit digit… [B | O | Q | D | H]
The radix suffix B denotes binary, O and Q denote octal, D denotes decimal, and H denotes hexadecimal. Radix suffixes can be given either in lowercase or uppercase letters.
Hexadecimal constants must always start with a decimal digit (0 to 9), otherwise the assembler will mistake the constant for a symbol—for example, 0FCH is interpreted as a hexadecimal constant but FCH is interpreted as a symbol.
You can specify hexadecimal constants in two other formats common with many assemblers:
0x digit digit…
$ digit digit…
The 0x notation is exactly how hexadecimal constants are written in C, and the $ notation is common in many assemblers for Motorola parts.
A string constant consists of one or more ASCII characters enclosed in single or double quotation marks.
"character…"
You can specify non-printable characters in string constants using escape sequences. An escape sequence is introduced by the backslash character '\'.
The following escape sequences are supported:
Sequence | Description |
\" | Double quotation mark |
\' | Single quotation mark |
\\ | Backslash |
\b | Backspace, ASCII code 8 |
\f | Form feed, ASCII code 12 |
\n | New line, ASCII code 10 |
\r | Carriage return, ASCII code 13 |
\v | Vertical tab, ASCII code 11 |
\ooo | Octal code of character where o is an octal digit |
\xhh | Hexadecimal code of character where h is a hexadecimal digit |