Document revision date: 19 July 1999 | |
Previous | Contents | Index |
The stack commands place bytes, words, and longwords on the stack. Byte and word stack commands (except those that stack the values of global symbols or addresses) have signed-extension-to-longword format and zero-extension-to-longword format.
The data placed on the stack is taken from one of the following sources:
Table A-3 lists the stack commands and related codes, together with a brief description of each command.
Code | Command | Description |
---|---|---|
0 | TIR$C_STA_GBL (Stack Global) | Data is the name of the global symbol in standard name format. The command stacks the 32-bit binary value of the stacks symbol. |
1 | TIR$C_STA_SB (Stack Signed Byte) | Data is a 1-byte constant, which is sign-extended to 32 bits. |
2 | TIR$C_STA_SW (Stack Signed Word) | Data is a 2-byte constant, which is sign-extended to 32 bits. |
3 | TIR$C_STA_LW (Stack Longword) | Data is a 4-byte constant. |
4 | TIR$C_STA_PB (Stack Psect Base Plus Byte Offset) | Data is a 1-byte program section index followed by a single signed byte offset 1. The psect base and byte offset are added and stacked. |
5 | TIR$C_STA_PW (Stack Psect Base Plus Word Offset) | Data is a 1-byte program section index followed by a single signed word offset 1. The psect base and word offset are added and stacked. |
6 | TIR$C_STA_PL (Stack Psect Base Plus Longword Offset) | Data is a 1-byte program section index followed by a single signed longword offset 1. The psect base and longword offset are added and stacked. |
7 | TIR$C_STA_UB (Stack Unsigned Byte) | Same as Stack Signed Byte except that the value is zero-extended to 32 bits. |
8 | TIR$C_STA_UW (Stack Unsigned Word) | Same as Stack Signed Word except that the value is zero-extended to 32 bits. |
9 | TIR$C_STA_BFI (Stack Byte From Image) | This command is reserved for use by Digital. The top longword on the stack is used as an address, in the image, from which to retrieve a byte. The byte is zero-extended and replaces the top longword on the stack. |
10 | TIR$C_STA_WFI (Stack Word From Image) | This command is reserved for use by Digital. It is the word equivalent of the previous command. |
11 | TIR$C_STA_LFI (Stack Longword From Image) | This command is reserved for use by Digital. It is the longword equivalent of the previous two commands. |
12 | TIR$C_STA_EPM (Stack Entry Point Mask) | This command has the same format as the Stack Global command. However, it stacks the entry point mask (unsigned stack's word) that accompanies the symbol definition, rather than the symbol value. An error results if the symbol is not an entry point. |
13 | TIR$C_STA_CKARG (Compare Procedure Argument and Stack for TRUE or FALSE) | This command checks to see whether the argument passing mechanism (ARG$V_PASSMECH) in the formal argument descriptor matches the argument passing mechanism in the actual argument descriptor. The DATA field for this command consists of the ASCIC symbol name in standard name format (1 count byte followed by the symbol name (1 to 31 bytes)). This is followed by the 1-byte argument index and the actual argument descriptor. The format of the actual argument descriptor is the same as the format of the formal argument descriptor described in Section A.3.4. The linker compares the values of ARG$V_PASSMECH for the formal and actual argument descriptors. If these values agree or if there is no formal argument descriptor, the linker places the TRUE value on top of the stack; otherwise, it stacks the FALSE value. |
14 | TIR$C_STA_WPB (Stack Psect Base Plus Byte Offset with Word Psect) | Same as TIR$C_STA_PB except the program section index is a word rather than a byte. |
15 | TIR$C_STA_WPW (Stack Psect Base Plus Word Offset with Word Psect) | Same as TIR$C_STA_PW except the program section index is a word rather than a byte. |
16 | TIR$C_STA_WPL (Stack Psect Base Plus Longword Offset with Word Psect) | Same as TIR$C_STA_PL except the program section index is a word rather than a byte. |
17 | TIR$C_STA_LSY (Stack Local Symbol Value) | Data is a 2-byte environment index followed by the ASCIC symbol name in standard name format. |
18 | TIR$C_STA_LIT (Stack Literal) | Data is a 1-byte index of the literal to be stacked. If the literal has not been defined, the linker stacks zero and issues an error message. |
19 | TIR$C_STA_LEPM (Stack Local Symbol Entry Point Mask) | This command has the same format as the Stack Local Symbol Value command and the same action as the Stack Entry Point Mask command. |
The store commands pop the top longword from the stack and write it to the output image file. Several store commands provide validation of the quantity being stored, with the possibility of issuing truncation errors during the operation. After a store command is executed, the location counter is pointing to the next byte in the output image.
Table A-4 lists the store commands and related codes, together with a brief description of each command.
Code | Command | Description |
---|---|---|
20 | TIR$C_STO_SB (Store Signed Byte) | Low byte is written to image. Bits 31:7 must be identical. |
21 | TIR$C_STO_SW (Store Signed Word) | Low word is written to image. Bits 31:15 must be identical. |
22 | TIR$C_STO_LW (Store Longword) | One longword is written to image. |
23 | TIR$C_STO_BD (Store Byte Displaced) | Current location counter plus 1 is subtracted from the top longword on the stack. Low byte of resulting value is written to image. Bits 31:7 must be identical. |
24 | TIR$C_STO_WD (Store Word Displaced) | Current location counter plus 2 is subtracted from the top longword on the stack. Low word of resulting value is written to image. Bits 31:15 must be identical. |
25 | TIR$C_STO_LD (Store Longword Displaced) | Current location counter plus 4 is subtracted from the top longword on the stack. Resulting value is written to image. |
26 | TIR$C_STO_LI (Store Short Literal) | Low byte of top longword on the stack is written to image. Bits 31:6 must be zero. |
27 | TIR$C_STO_PIDR (Store Position-Independent Data Reference) | The longword on top of the stack is the address of a data item. If the address is absolute, the longword is written to the image. If the address is relocatable, the linker stores information in the image file to allow the image activator to initialize the location when the image is run. |
28 | TIR$C_STO_PICR (Store Position-Independent Code Reference) | The purpose of this command is to generate a position-independent code reference. The top longword on stack is the address of an item to which a position-independent instruction makes reference. If the item is absolute, the byte 9F hexadecimal (the operand specifier for absolute addressing mode) followed by the top longword on the stack are written to the image, and the location counter is incremented. If the item is relocatable, the byte EF hexadecimal (the operand specifier for longword relative addressing mode) is written to the image; the top longword on the stack is Store Longword Displaced (see TIR$C_STO_LD); and the location counter is incremented. If the item is relocatable and contained in a shareable image, the byte FF (the operand specifier for longword relative deferred addressing mode) is written to the image; the top longword on the stack is Store Longword Displaced (target is in the EXIT vector); and the location counter is incremented. |
29 | TIR$C_STO_RSB (Store Repeated Signed Byte) | The longword on top of the stack is used as a repeat count. The low byte of the next longword on the stack is then written to the image the indicated number of times. Both longwords are removed from the stack upon completion. See note in Section A.4 regarding the use of this command with zeros. |
30 | TIR$C_STO_RSW (Store Repeated Signed Word) | Same as above command except that a word rather than a byte is written. |
31 | TIR$C_STO_RL (Store Repeated Longword) | Same as previous two commands except that a longword is written. |
32 | TIR$C_STO_VPS (Store Arbitrary Field) | This command writes a bit field to the image. The data field consists of an unsigned byte containing the value p, followed by another unsigned byte containing the value s. Bits 0 to s--1 of the top longword on the stack are written to the image starting at bit p of the current location. Only the specified bits of the image are altered. After the operation, the location counter is the address of the byte containing bit (p+s) of the location modified. Note that the value of p+s must be greater than zero and less than or equal to either 32 or ((P+8)/8)8--1, whichever is less. In other words, the bit field must be contained within a single byte. |
33 | TIR$C_STO_USB (Store Unsigned Byte) | Same as TIR$C_STO_SB except that bits 31:8 must be zero. |
34 | TIR$C_STO_USW (Store Unsigned Word) | Same as TIR$C_STO_SW except that bits 31:16 must be zero. |
35 | TIR$C_STO_RUB (Store Repeated Unsigned Byte) | Same as TIR$C_STO_RSB except that bits 31:8 of the stored byte must be zero. |
36 | TIR$C_STO_RUW (Store Repeated Unsigned Word) | Same as TIR$C_STO_RSW except that bits 31:16 of the stored word must be zero. |
37 | TIR$C_STO_B (Store Byte) | This command writes the low byte of the top longword on the stack to the image file. It thus permits any 8-bit value (the top longword must contain a value from --128 to 255) to be written to the image. If the top longword on the stack is negative, then bits 31:7 must be 1; if positive, then bits 31:8 must be zero. |
38 | TIR$C_STO_W (Store Word) | This command writes the low word of the top longword on the stack to the image file. It thus permits any 16-bit value (the top longword must contain a value from --32768 to 65535) to be written to the image. If the top longword on the stack is negative, bits 31:15 must be 1; if positive, the bits 31:16 must be zero. |
39 | TIR$C_STO_RB (Store Repeated Byte) | The top longword on the stack is used as a repeat count. The low byte of the next longword on the stack is then written to the image the indicated number of times. This is the repeated version of Store Byte (see TIR$C_STO_B). |
40 | TIR$C_STO_RW (Store Repeated Word) | This is the word version of the Store Repeated Byte command. |
41 | TIR$C_STO_RIVB (Store Repeated Immediate Variable Bytes) | Data is a 1-byte count n field followed by n bytes of data. These n bytes of data are written to the image the number of times specified by the top longword on the stack (which is removed from the stack upon completion of the command). If the top longword on the stack is zero, nothing is stored. |
42 | TIR$C_STO_PIRR (Store Position-Independent Reference Relative) | The longword (longword 1) on the top of the stack is the address of a data item. If the data item is absolute, the command is the same as the Store Longword command except that the next longword on the stack (following the top one) is also removed from the stack upon completion of the command. If the data item is relocatable, the value of the second longword (longword 2) on the stack is checked. If its value is --1, the current value of the location counter is substituted for longword 2, and the value stored is longword 1 minus longword 2. Both longwords are removed from the stack upon completion of the command. |
43--49 | Reserved. |
Operator commands perform arithmetic operations on the top one or two longwords on the stack. Upon completion of the operation, the result is the top longword on the stack.
The linker evaluates expressions in Post Fix Polish form. All arithmetic operations are performed in signed 32-bit two's complement integers. There is no provision for floating-point, string, or quadword computation. Attempts to divide by zero produce a zero result and a nonfatal warning message.
Table A-5 lists the operator commands and related codes, together with a brief description of each command.
Code | Command | Description |
---|---|---|
50 | TIR$C_OPR_NOP (No-Operation) | No operation results. |
51 | TIR$C_OPR_ADD (Add) | Top two longwords on the stack are added. |
52 | TIR$C_OPR_SUB (Subtract) | Top longword on the stack is subtracted from the next longword on the stack. |
53 | TIR$C_OPR_MUL (Multiply) | Top two longwords on the stack are multiplied. |
54 | TIR$C_OPR_DIV (Divide) | Top longword on the stack is divided into the next longword on the stack. |
55 | TIR$C_OPR_AND (Logical AND) | Logical AND of top two longwords. |
56 | TIR$C_OPR_IOR (Logical Inclusive OR) | Inclusive OR of top two longwords. |
57 | TIR$C_OPR_EOR (Logical Exclusive OR) | Exclusive OR of top two longwords. |
58 | TIR$C_OPR_NEG (Negate) | Top longword is negated. |
59 | TIR$C_OPR_COM (Complement) | Top longword is complemented. |
60 | TIR$C_OPR_INSV (Insert Field) | This command is reserved. It is similar to TIR$C_STO_VPS except that the bit field is written to the next longword on the stack instead of to the image file. The location counter is therefore unaffected. After completion of the command, only the top longword on the stack is removed. |
61 | TIR$C_OPR_ASH (Arithmetic Shift) | The top longword on the stack specifies the shift count and direction to be applied to the next longword on the stack. When the top longword is negative, bits in the next longword are shifted right with replication of the sign bit. When the top longword is positive, bits in the next longword are shifted left with zeros moved into low-order bits. |
62 | TIR$C_OPR_USH (Unsigned Shift) | Same as previous command except that, for a shift right, zeros are always moved into the high bits. |
63 | TIR$C_OPR_ROT (Rotate) | The top longword on the stack specifies the rotate count and direction to be applied to the next longword on the stack. When the top longword is positive, the next longword is rotated left; when negative, right. The top longword must have an absolute value of 0 to 32. |
64 | TIR$C_OPR_SEL (Select) | This command manipulates the top three longwords on the stack. If the top longword has the value TRUE (low bit set), it and the next (second) longword on the stack are removed, leaving the third longword (unchanged) on top of the stack. If the top longword has the value FALSE (low bit clear), the value of the next (second) longword is copied to the following (third) longword, and the top and second longwords are removed, leaving the third (now having the value of the second) on top of the stack. Thus, the command collapses three longwords on the stack to a single longword that has the value of the second or third based on the value of the first. |
65 | TIR$C_OPR_REDEF (Redefine Symbol to Current Location) | This command is used only in the creation of shareable images. Data for the command consists of a symbol name in standard name format, that is, 1 count byte followed by a variable-length (1 to 31 bytes) ASCII string. The value of the symbol, as listed in the shareable image's symbol table, is made equal to the value of the current location counter (at the time the command is processed). Values of the symbol within the image itself are not affected by the command. The value is not assigned until after all image binary has been written to the image output file. If no binary is generated (or is aborted), the value is not assigned. The symbol is also made universal. |
66 | TIR$C_OPR_DFLIT (Define a Literal) | Data is a 1-byte field that indicates the literal (0 to 255) to be defined. The literal is assigned the value of the top longword on the stack, which is removed upon completion of the command. Note that this command does not stack a result. |
67--79 | Reserved. |
Control commands manipulate the linker's location counter. Table A-6 lists the control commands and related codes, together with a brief description of each command.
Code | Command | Description |
---|---|---|
80 | TIR$C_CTL_SETRB (Set Relocation Base) | The top longword on the stack is placed into the location counter and then removed from the stack. |
81 | TIR$C_CTL_AUGRB (Augment Relocation Base) | Data consists of a signed longword. The value of this longword is added to the current location counter. |
82 1 | TIR$C_CTL_DFLOC (Define Location) | The value of the top longword on the stack is used as an index. The value of the current location counter is then saved under this index. Upon completion of the command, the top longword is removed from the stack. |
83 1 | TIR$C_CTL_STLOC (Set Location) | The value of the top longword on the stack is an index (from a previous Define Location command) that is used to locate a previously saved location counter. The value of the previously saved location counter is then set as the value of the current location counter. Upon completion of the command, the top longword is removed from the stack. |
84 1 | TIR$C_CTL_STKDL (Stack Debug) | The value of the top longword on the stack is an index (from a previous Define Location command). The top longword is removed from the stack, and the saved location counter, located by means of the index, is placed on top of the stack. |
85--127 | Reserved. |
Previous | Next | Contents | Index |
privacy and legal statement | ||
4548PRO_019.HTML |