![]() |
![]() HP OpenVMS Systems Documentation |
![]() |
VAX MACRO and Instruction Set Reference ManualOrder Number: AA--PS6GD--TE
April 2001
This document describes the features of the VAX MACRO instruction set and assembler. It includes a detailed description of MACRO directives and instructions, as well as information about MACRO source program syntax. Revision/Update Information: This manual supersedes the VAX MACRO and Instruction Set Reference Manual, Version 7.1 Software Version: OpenVMS VAX Version 7.3
© 2001 Compaq Computer Corporation Compaq, VAX, VMS, and the Compaq logo Registered in U.S. Patent and Trademark Office. OpenVMS is a trademark of Compaq Information Technologies Group, L.P. in the United States and other countries. All other product names mentioned herein may be trademarks of their respective companies. Confidential computer software. Valid license from Compaq required for possession, use, or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license. Compaq shall not be liable for technical or editorial errors or omissions contained herein. The information in this document is provided "as is" without warranty of any kind and is subject to change without notice. The warranties for Compaq products are set forth in the express limited warranty statements accompanying such products. Nothing herein should be construed as constituting an additional warranty.
ZK4515 The Compaq OpenVMS documentation set is available on CD-ROM.
PrefaceIntended AudienceThis manual is intended for all programmers writing VAX MACRO programs. You should be familiar with assembly language programming, the VAX instruction set, and the OpenVMS operating system before reading this manual. Document StructureThis manual is divided into two parts, each of which is subdivided into several chapters. Part 1 describes the VAX MACRO language.
Part 2 describes the VAX data types, the instruction and addressing mode formats, and the instruction set.
This manual also contains the following five appendixes:
Related DocumentsThe following documents are relevant to VAX MACRO programming:
For additional information about OpenVMS products and services, access the following World Wide Web address:
Reader's CommentsCompaq welcomes your comments on this manual. Please send comments to either of the following addresses:
How to Order Additional DocumentationUse the following World Wide Web address to order additional documentation:
If you need help deciding which documentation best meets your needs, call 800-282-6672. ConventionsThe following conventions are used in this manual:
VAX MACRO LanguagePart I provides an overview of the features of the VAX MACRO language. It includes an introduction to the structure and components of VAX MACRO source statements. Part I also contains a detailed discussion of the VAX MACRO addressing modes, general assembler directives, and macro directives.
Chapter 1
|
Field | Begins in Column | Tab Characters to Reach Column |
---|---|---|
Label | 1 | 0 |
Operator | 9 | 1 |
Operand | 17 | 2 |
Comment | 41 | 5 |
For example:
.TITLE ROUT1 .ENTRY START,^M<> ; Beginning of routine CLRL R0 ; Clear register LABT: SUBL3 #10,4(AP),R2 ; Subtract 10 LAB2: BRB CONT ; Branch to another routine |
Continue a single statement on several lines by using a hyphen (-) as the last nonblank character before the comment field, or at the end of a line (when there is no comment). For example:
LAB1: MOVAL W^BOO$AL_VECTOR,- ; Save boot driver RPB$L_IOVEC(R7) |
VAX MACRO treats the preceding statement as equivalent to the following statement:
LAB1: MOVAL W^BOO$AL_VECTOR,RPB$L_IOVEC(R7) ; Save boot driver |
A statement can be continued at any point. Do not continue permanent and user-defined symbol names on two lines. If a symbol name is continued and the first character on the second line is a tab or a blank, the symbol name is terminated at that character. Section 3.3 describes symbols in detail.
Note that when a statement occurs in a macro definition (see Chapter 4 and Chapter 6), the statement cannot contain more than 1000 characters.
Blank lines are legal, but they have no significance in the source program except that they terminate a continued line.
The following sections describe each of the statement fields in detail.
2.1 Label Field
A label is a user-defined symbol that identifies a location in the program. The symbol is assigned a value equal to the location counter where the label occurs. The user-defined symbol name can be up to 31 characters long and can contain any alphanumeric character and the underscore (_), dollar sign ($), and period (.) characters. See Section 3.3.2 for a description of the rules for forming user-defined symbol names in more detail.
If a statement contains a label, the label must be in the first field on the line.
A label is terminated by a colon (:) or a double colon (::). A single colon indicates that the label is defined only for the current module (an internal symbol). A double colon indicates that the label is globally defined; that is, the label can be referenced by other object modules.
Once a label is defined, it cannot be redefined during the source program. If a label is defined more than once, VAX MACRO displays an error message when the label is defined and again when it is referenced.
If a label extends past column 7, place it on a line by itself so that the following operator field can start in column 9 of the next line.
The following example illustrates some of the ways you can define labels:
EXP: .BLKL 50 ; Table stores expected values DATA:: .BLKW 25 ; Data table accessed by store ; routine in another module EVAL: CLRL R0 ; Routine evaluates expressions ERROR_IN_ARG: ; The arg-list contains an error INCL R0 ; increment error count TEST:: MOVO EXP,R1 ; This tests routine ; referenced externally TEST1: BRW EXIT ; Go to exit routine |
The label field is also used for the symbol in a direct assignment
statement (see Section 3.8).
2.2 Operator Field
The operator field specifies the action to be performed by the statement. This field can contain an instruction, an assembler directive, or a macro call.
When the operator is an instruction, VAX MACRO generates the binary code for that instruction in the object module. The binary codes are listed in Appendix D; the instruction set is described in Chapter 9. When the operator is a directive, VAX MACRO performs certain control actions or processing operations during source program assembly. The assembler directives are described in Chapter 6. When the operator is a macro call, VAX MACRO expands the macro. Macro calls are described in Chapter 4 and in Chapter 6 (.MACRO directive).
Use either a space or a tab character to terminate the operator field;
however, the tab is the recommended termination character.
2.3 Operand Field
The operand field can contain operands for instructions or arguments for either assembler directives or macro calls.
Operands for instructions identify the memory locations or the registers that are used by the machine operation. These operands specify the addressing mode for the instruction, as described in Chapter 5. The operand field for a specific instruction must contain the number of operands required by that instruction. See Chapter 9 for descriptions of the instructions and their operands.
Arguments for a directive must meet the format requirements of that directive. Chapter 6 describes the directives and the format of their arguments.
Operands for a macro must meet the requirements specified in the macro definition. See the description of the .MACRO directive in Chapter 6.
If two or more operands are specified, they must be separated by commas (,). VAX MACRO also allows a space or tab to be used as a separator for arguments to any directive that does not accept expressions (see Section 3.5 for a discussion of expressions). However, a comma is required to separate operands for instructions and for directives that accept expressions as arguments.
The semicolon that starts the comment field terminates the operand
field. If a line does not have a comment field, the operand field is
terminated by the end of the line.
2.4 Comment Field
The comment field contains text that explains the function of the statement. Every line of code should have a comment. Comments do not affect assembly processing or program execution. You can cause user-written messages to be displayed during assembly by the .ERROR, .PRINT, and .WARN directives (see descriptions in Chapter 6).
The comment field must be preceded by a semicolon; it is terminated by the end of the line. The comment field can contain any printable ASCII character (see Appendix A).
To continue a lengthy comment to the next line, write the comment on the next line and precede it with another semicolon. If a comment does not fit on one line, it can be continued on the next, but the continuation must be preceded by another semicolon. A comment can appear on a line by itself.
Write the text of a comment to convey the meaning rather than the action of the statement. The instruction MOVAL BUF_PTR_1,R7, for example, should have a comment such as "Get pointer to first buffer," not "Move address of BUF_PTR_1 to R7."
For example:
MOVAL STRING_DES_1,R0 ; Get address of string ; descriptor MOVZWL (R0),R1 ; Get length of string MOVL 4(R0),R0 ; Get address of string |
Next | Contents | Index |