Directives
This section covers the directives supported by the simulator. Specifically, the simulator supports the following directives:
DB: Define Byte
This directive allows you to reserve memory space for one byte (8 bits). The
receive directive receives two operands. Operand 1 sets the name or identifier
assigned to the space. Operand 2 sets the initialization value of the reserved
space. This operand can be a numeric value, a character or an array of
characters. In the case of a single character, the initial value stored will
correspond to the ASCII code of the character encoded in single quotes (''). In the
case of an array, the values corresponding to the ASCII codes of those encoded
between double quotes (""`) will be encoded. If you want to encode a numeric value
explicitly within the array, you must do it using the escape code \x.
Directive |
Result |
|---|---|
|
Reserves one byte with an initial value of 0x01 |
|
Reserves one byte with an initial value of 0x31 |
|
Reserves five bytes with values {0x48, 0x65, 0x6C, 0x6C, 0x6F} |
|
Reserves four bytes with values {0x01, 0x02, 0x03, 0x04} |
DW: Define Word
This directive allows you to reserve memory space for two bytes (16 bits). The receive directive receives two operands. Operand 1 sets the name or identifier assigned to the space. Operand 2 sets the initialization value of the reserved space. This operand can only be of numeric type.
Directive |
Result |
|---|---|
|
Reserves two bytes with values {0x80, 0x00} |
|
Reserves two bytes with values {0x1F, 0xFF} |
ORG: Advance Program Counter
This directive allows moving the program counter to a given address. The directive contains a single operand that sets the address from which subsequent instructions are to be encoded.
Directive |
Result |
|---|---|
|
The subsequent instructions will be encoded starting from address 0x100 |
EQU: Define symbolic name
The EQU directive gives a symbolic name or tag to an expression. This tag can be later used in subsequent lines of assembly code and will be substituted by the value given. The directive receives two operands. The first sets the label or symbolic name. The second defines the expression by which occurrences of the label will be replaced in the code. These occurrences will only be evaluated in lines of code following the definition of the label.
Directive |
Result |
|---|---|
|
Any occurrence of |
|
Any occurrence of |