The names of p-code instructions have the following general form:
operation[[mode]][[qualifier]] data type [[operand data type]]
The operation portion of the instruction name indicates the operation performed by the instruction; for example, all instructions that begin with Cmp perform a comparison.
The optional mode specifies the addressing mode used by the instruction and can have one of the following values:
Mode | Meaning |
n | Near |
f | Far |
no | Near + offset |
fo | Far + offset |
For example, the LdifBb instruction performs an indirect load of a byte using a far pointer. The “f” in the instruction specifies that the pointer is far.
The optional qualifier specifies the conventions used by the instruction and can have one of the following values:
Qualifier | Meaning |
p | Preserve data on stack after instruction |
t | Use temporary register |
s | Signed or scaled |
u | Unsigned |
fc | Far C calling convention |
nc | Near C calling convention |
fp | Far Pascal calling convention |
np | Near Pascal calling convention |
For example, the CmpsL instruction compares two signed long integers. The “s” in the instruction specifies that the operands are signed.
The data type specifies the data type on which the operation is performed. It can have one of the following values:
Type | Meaning |
V | Void |
B | Byte |
Q | Bit field |
W | Word |
S | Short (word—reserved for 386) |
L | Long (double word) |
N | Near pointer |
A | Near address |
F | Far pointer |
H | Huge pointer |
R | Float |
D | Double |
T | Long double |
For example, the CmpuW instruction compares unsigned words, and the CmpuL instruction compares unsigned longs. An instruction can specify more than one data type, if it produces a result whose data type is different from its operand(s). For example, CvtBW converts a signed byte to a signed word, and MulWWL multiplies two words to form a long word.
The optional operand data type appears in instructions that require an additional operand be specified, rather than taking it from the stack. This field can indicate the size of the operand that follows the instruction, or it may specify the value itself so that no separate operand is needed.
Operand Data Type | Meaning |
0–9, m1 | operand encoded in instruction, where m1 = –1 |
b | byte |
w | word |
l | long |
For example, consider a statement using the Jump-on-Not-Equal instruction:
JneWb 05
This statement pops two words off the stack and compares them. If they are not equal, it performs a jump of length 5. The “b” in the instruction indicates that it requires an explicit one-byte operand.
To save space, many p-code instructions have alternate forms that assume a particular value for an operand. For example,
JneW5
is a single-byte instruction that conditionally performs a jump of length 5. There can be a number of JneWn instructions, each with a different jump length encoded. This saves the space required by a separate operand.
Not all instructions have encoded operands, and not all possible values are encoded into the instructions that do have them. Only the most common values are encoded; other values must appear as a separate operand with the version of the instruction ending in “b,” “w,” or “l.” Each p-code instruction is described fully in Help.
Note:
The p-code instruction set may change in future releases of the compiler.