Digital PDFs
Documents
Guest
Register
Log In
AA-D0O32B-TE
February 1979
186 pages
Original
7.2MB
view
download
OCR Version
6.7MB
view
download
Document:
VAX-11 MACRO
Language Reference Manual
Order Number:
AA-D0O32B-TE
Revision:
0
Pages:
186
Original Filename:
OCR Text
February 1979 This document describes the assembly language supported by VAX/VMS. All symbols, expressions, addressing modes, and directives are detailed. No prior knowledge of the VAX-11 MACRO asst mbler is assumed. VAX-11 MACRO Language Reference Manual Order No. AA-D032B-TE SUPERSESSION/UPDATE INFORMATION: This revised document supersedes OPERATING SYSTEM AND VERSION: VAX/VMS V1.5 SOFTWARE VERSION: VAX-11 MACRO V2.0 the VAX-11 MACRO Language Reference Manual (Order No. AA-DO32A-TE) To order additional copies of this document, contact the Software Distribution Center, Digital Equipment Corporation, Maynard, Massachusetts 01754 digital equipment corporation - maynard, massachusetts First Printing, August Revised, February 1979 The and information in this document is should not be Corporation. for any errors construed as 1978 subject to change without notice a commitment by Digital Equipment Digital Equipment Corporation assumes no responsibility that may appear in this document. The software described in this document is furnished under a license and may only be used or copied in accordance with the terms of such license. No responéibility is assumed for the use or reliability of software on equipment that is not supplied by DIGITAL or its affiliated companies. Copyright C) 1978, 1979 by Digital Equipment Corporation The postage~prepaid READER'S document requests the user's paring future documentation. COMMENTS critical The of following are trademarks DIGITAL . form on the last page of this evaluation to assist us in pre- Digital Equipment Corporation: DECsystem-10 MASSBUS DEC DECtape PDP OMNIBUS DIBOL DECUS 0S/8 EDUSYSTEM UNIBUS PHA FLIP RSTS CHIP COMPUTER LABS FOCAL COMTEX RSX INDAC DDT TYPESET~-8 LAB-8 DECCOMM DECSYSTEM-~20 TMS-11 ITPS-10 TYPESET-11 ASSIST-11 RTS-8 VAX VMS DECnet SBI IAS PDT DATATRIEVE TRAX CONTENTS Page vii PREFACE SUMMARY OF TECHNICAL CHANGES 1 INTRODUCTION CHAPTER 2 MACRO SOURCE STATEMENT FORMAT 2.1 LABEL FIELD OPERAND 2.4 COMMENT FIELD THE COMPONENTS OF MACRO SOURCE STATEMENTS Packed Decimal Strings SYMBOLS = Permanent Symbols wN User-defined Symbols and Macro Names Determining Symbol Values N ¢ e L] TERMS AND EXPRESSIONS UNARY OPERATORS Radix Control Operators Textual Operators L] L] = [) * N L] WWwwhhNNBE LOCAL LABELS Operator Register Mask Operator Numeric Control Operators Floating Point Operator Complement Operator BINARY OPERATORS = Logical AND Operator Logical Inclusive OR Operator Logical Exclusive OR Operator DIRECT ASSIGNMENT STATEMENTS CURRENT LOCATION COUNTER * [] * * . [] * GENERAL REGISTER MODES Register Mode Register Deferred Mode Autoincrement Mode Autoincrement Deferred Mode Autodecrement Mode Displacement Mode Displacement Deferred Mode Literal Mode iii ON NV WN [ O O [] * [] G N G NS L] * . LJ * N el el o ADDRESSING MODES =0 0000~y .3 .4 Arithmetic Shift Operator A G S | | L] ASCII RER Y wh = Integers Floating-Point Numbers WWWWwWwwwwwwwwwwww | (I I N I ! i - HFHRONOOAUTUBEWWWHE CHARACTER SET .2 . FIELD NUMBERS .1 F L] CHAPTER WOSNNNNNOAONON AT WWWWININNNE OPERATOR FIELD 2.3 WWWWWWWwWwWwWwWwwwwWwwwwwwuwwuwwwww CHAPTER 2.2 (%) CHAPTER Relative Mode Relative Deferred Mode Absolute Mode Immediate Mode General Mode INDEX MODE BRANCH MODE GENERAL ASSEMBLER O ECEGNCG RN RT NS N NT N RE NE) 1 | PFRPRPOYOOINO W .ADDRESS DIRECTIVES .ALIGN .ASCIx .ASCII .ASCIC .ASCID .ASCIZ . BLKx .BYTE .CROSS .DEBUG .DISABLE = I .DEFAULT oo un w o s VW N 0 9 o e s ¢ e DD B e e B PROGRAM COUNTER MODES 19)] CHAPTER WO CONTENTS .DOUBLE .ENABLE .END .ENDC .ENTRY .ERROR .EVEN .EXTERNAL .FLOAT .GLOBAL . IDENT IF LIF x LIIF .LIST .LONG .MASK .NLIST 5-38 .NOCROSS 5-39 .NOSHOW .ODD .OPDEF .PACKED 5-42 5-42 5-43 5-44 5-49 5-50 5-51 .PAGE .PRINT .PSECT .QUAD . REFn -RESTORE PSECT .SAVE PSECT 5-52 5-54 5-56 .SHOW .SIGNED_ BYTE . SIGNED_WORD 5-57 iv CONTENTS Page 5-59 .SUBTITLE .TITLE . TRANSFER . WARN . WEAK 6 MACROS o 6.1 6.1.1 6.1.2 6.1.3 ARGUMENTS IN MACROS Default Values Keyword Arguments String Arguments AN | I | =Moo WWH CHAPTER | [ .WORD 6.1.4 6.1.5 6.1.6 6.1.7 Argument Concatenation Passing Numeric Values of Symbols Created Local Labels Macro String Operators $LENGTH Operator 6.1.7.1 $LOCATE Operator 6.1.7.2 $EXTRACT Operator 6.1.7.3 MACRO DIRECTIVES 6.2 . ENDM -12 6-13 . ENDR .IRP . IRPC .LIBRARY .MACRO .MCALL .MDELETE MEXIT .NARG .NCHR .NTYPE .REPEAT APPENDIX A ASCII CHARACTER SET APPENDIX B VAX~-11] MACRO ASSEMBLER DIRECTIVES AND APPENDIX D D.1 D.2 D.3 PERMANENT SYMBOL TABLE OPCODES OPCODES (ALPHABETIC ORDER) (NUMERIC ORDER) o Na] HHRWOVONH PPYTYRY [ ~ = c.1 C.2 Macro String Operators ADDRESSING MODES HEXADECIMAL/DECIMAL CONVERSION HEXADECIMAL TO DECIMAL DECIMAL TO HEXADECIMAL POWERS OF 2 AND 16 N APPENDIX C Unary Operators Binary Operators 0O- B.3.3 B.4 OPERATORS a0| B.3.1 B.3.2 ? B.3 ASSEMBLER DIRECTIVES SPECIAL CHARACTERS ?tj? B.1 B.2 LANGUAGE SUMMARY CONTENTS Page INDEX Index-1 FIGURES FIGURE 5-1 Using Transfer Vectors 5-61 TABLES TABLE 3-1 Special Characters Used Statements 3-2 Separating Characters 3-3 Unary Operators 4-1 4-2 4-3 5-1 5-2 5-3 5-5 5-6 5-7 6-1 3-11 Addressing Modes Floating Point Short Literals Index Mode Addressing Summary of General Assembler Directives -ENABLE and Condition .DISABLE Tests for Symbolic Arguments Conditional Default Program Section Attributes .SHOW and .NOSHOW Symbolic Arguments Summary of Macro Directives B-1 B-2 Assembler Directives Special Characters Used B-3 Unary Operators Binary Operators Conversion Statements 3-15 4-2 4-11 4-17 5-1 5-18 Assembly Operand Descriptors Program Section Attributes Hexadecimal/ASCII B-5 3-1 3-3 A-1 B-4 MACRO Binary Operators Directives 5-4 VAX-11 in VAX-11 MACRO Statements 3-4 in in VAX-11 MACRO 5-30 5-40 5-45 5-47 5-55 6-2 A-1 B-1 B-7 B-8 Macro B-6 String Operators Addressing Modes D-1 Hexadecimal/Decimal Conversion B-9 B-10 B-11 D-3 PREFACE MANUAL OBJECTIVES the features that This manual describes the VAX-11 MACRO language: The are in the language and the format and function of each feature. VAX-11 MACRO User's Guide describes how to use VAX-11l MACRO. INTENDED AUDIENCE This manual is intended for all programmers writing VAX-11] MACRO Programmers should be familiar with assembly language programs. programming, the VAX-11l instruction set, and the VAX/VMS operating system before reading this manual. The VAX-11 MACRO User's Guide provides a brief introduction to the assembler and describes the commands necessary to use VAX-11 MACRO. VAX-11/780 the describes The VAX-11/780 Architecture Handbook All programmers should read these manuals before instruction set. using this language reference manual. STRUCTURE OF THIS DOCUMENT This manual is organized into six chapters and appendixes, five as follows: e Chapter 1 introduces the features of the VAX-11 MACRO language ® Chapter 2 describes the format used in VAX-11 MACRO source statements e Chapter 3 describes the components of VAX-11 MACRO source 1local symbols; numbers; set; the character statements: unary and binary operators; terms and expressions; labels; and the current Chapter 4 summarizes and gives examples of the direct statements; assignment location counter e e VAX-11 MACRO addressing modes 5 Chapter MACRO describes the VAX-11] describes the directives use general of the assembler directives used in defining and used in e Chapter 6 e Appendix A lists the ASCII character set that can be expanding macros VAX~-11 - MACRO programs vii Appendix B summarizes directives operators, the general (in alphabetical binary order), operators, and Appendix C lists alphabetically for use with VAX-11] MACRO Appendix D gives rules for assembler special addressing the and macro characters, unary modes permanent symbols hexadecimal/decimal defined conversion ASSOCIATED DOCUMENTS The following documents VAX-11 MACRO VAX/VMS For a VAX-11l Linker VAX-11l Symbolic complete of USED following all the IN THIS conventions ([]) Uppercase the word Lowercase word or and words Ellipses (...) repeated one or Manual documents, Information observed that the including a brief other Directory. used be typed used user's choice that times viii this manual, enclosed etters, indicate more in the letters, s .ould and of Guide Reference VAX-11 are letter value MACRO programming: Manual VAX-11l indicate words or VAX-11 DOCUMENT documents: Brackets User's Debugger see to Guide Reference 1list CONVENTIONS relevant Language each, of The User's Command description VAX-11 are the in as in the argument is optional formats, exactly in is as formats, to be preceding indicate shown indicate that a can be substituted item(s) that SUMMARY OF TECHNICAL CHANGES This section summarizes This manual documents VAX-11 MACRO V2.0. technical 1. changes from Version the The following new directives have been added: @ .ASCID - stores an ASCII string with a string descriptor e .CROSS and .NOCROSS - control the cross reference listing e .DEFAULT - controls the default displacement e .OPDEF - defines an opcode e .SIGNED BYTE and .SIGNED_WORD - specify signed data storage The following directives have had new arguments added: e e in the suppresses -~ .ENABLE=SUPPRESSION symbols symbol listing of unreferenced table .SAVE PSECT LOCAL_BLOCK - preserves the local label block when the program section is saved In addition, new forms of directives and directive arguments have been These new forms added to make VAX-11 MACRO programs easier to read. The old forms are have the same effect as their equivalent old form. still accepted the by directives have been added: 014 New Form : .DISABLE .ENABLE .EXTERNAL .GLOBAL .IF FALSE .IF TRUE .IF TRUE FALSE .NOSHOW ~ .REPEAT .RESTORE PSECT .SAVE PSECT .SHOW .SUBTITLE assembler. Form .DSABL .ENABL .EXTRN .GLOBL .IFF JIFT .IFTF .NLIST .REPT .RESTORE .SAVE LLIST .SBTTL ix The following new forms of New forms have -DISABLE, used All in been .SHOW, the .IF and for Three new macro added to been operators are following symbolic which is are described described in described in Section miscellaneous changes have ® The register expression. the mask storage in ® Chapter the .ENABLE, condition 5 except tests the 6. also correct been made: number .ENTRY directive directives repetition expression of in Chapter the 6.1.7. that the call. data for string operators, ¥LENGTH, 3%LOCATE, and $EXTRACT, have allow string manipulation in macros. These string The assembler checks specified in a macro In for and .IIF directives. ® ® arguments .NOSHOW directives the preceding directives -REPEAT directive The added and with a must repetition factor must be an absolute specifying the value to be stored expression (documentation change). The general change). addressing mode is of indexable arguments be an factor, are absolute only expression. can be any the The kind (documentation CHAPTER 1 INTRODUCTION (or The VAX-11 MACRO assembler translates source programs into object binary) code and produces a listing file and an object module file. The VAX-11 Linker executable image. information on using then combines object modules See the VAX-11 MACRO User's the assembler. features of the VAX-11 MACRO language. This chapter an to produce Guide for more introduces the VAX-11 MACRO source programs consist of a series of source statements. Each statement can contain an instruction, an assembler directive, or a direct assignment statement. The instructions, which can be any of the VAX-11/780 native mode instructions, can perform many types of data manipulation such as multiplication, transfer of control, and The instructions are described in the VAX-11/780 data conversion. Architecture Handbook. The assembler directives and direct assignment Statements create and initialize data areas and provide tools for using the instructions. label, operator, operand, and Source statements have four fields: comment. The label field identifies the location in the program. The The operator field contains the instruction opcode or directive. operand field contains the instruction operands or the directive arguments. accessed of the by the instruction. that locations The instruction operands specify the are The comment field explains the meaning statement. assembler the general There are two classes of assembler directives: directives and the macro directives. The general assembler directives can be used to perform the following: @ Store data or reserve memory for data storage ® Control the alignment in memory of parts of the program e e Specify the methods of accessing the which the program will be stored. Specify the entry point of the sections of or program memory in of the assembled only of part program e Specify the way in which symbols will be referenced e Specify that a part of the program is e Control the format and content of the listing file e Display informational messages under certain conditions 1-1 to be INTRODUCTION ® ® The Control the assembler source program Define new opcodes macro directives which allow source statements a are used programmer statements each programmer errors. throughout time. options Macros to to a that define repeat program and are to macros and identical or without repeat used blocks repeat similar having can interpret to thus blocks, series reenter help the of the minimize CHAPTER 2 MACRO SOURCE STATEMENT FORMAT A source program consists of a sequence of source statements, which the assembler interprets and processes, one by one, generating object code or performing a specific assembly-time process. A source statement can be on one source line or can extend onto several source lines. Each source line can be up to 132 characters 1long; however, no fits line should exceed 80 characters to ensure that the source line (with the binary expansion) on one line in the listing file. MACRO statements can consist of up to four e Label field -- allows the program location ® e to symbolically define a in a program the Operator field -- specifies the action to be performed by statement; this field can be an instruction, an assembler directive, ® fields: or a macro call Operand field -- contains the instruction operand(s) or assembler directive argument (s) or the macro argument (s) Comment field -- contains a comment that explains the of the execution statement; this field does not affect the meaning program The label field and the comment field are optional. The 1label field ends with a colon (:) and the comment field starts with a semicolon (:). The operand field must conform to the format of the instruction, directive, or macro specified in the operator field. (see Although the statement fields can be separated by a space or tab Table 3-2), formatting statements with the tab character is recommended for consistency and clarity. By DIGITAL convention, tab characters are used to separate the statement fields as follows: Field Begins in Column Tab Characters to Reach Column Label 1 0 Operator 9 1 Operand 17 2 Comment 41 5 MACRO SOURCE For example: .TITLE ROUTI1 .ENTRY START,O0 CLRL LABT: SUBL3 LAB2: (=) as of LABl: CONT statement can be continued on the last nonblank line (when there MACRO character is no ; ; above SUBTRACT : BRANCH several comment). RPBSL IOVEC (R7) the ; before W“BOO$AL_VECTOR,— treats OF the For 10 TO ANOTHER ROUTINE lines by using comment A MOVAL statement permanent symbol can name is a tab or character. Note 6), that the Blank continued names continued statement at any should not and the as equivalent when a statement lines, cannot although except The following detail. that occurs to 1legal, sections in have terminate describe the the SAVE BOOT DRIVER But continued character a macro than no a at following wuser-defined on on two the second definition 500 each of (see If line at a is that Chapter characters. significance continued and lines. name will be terminated symbols in detail.) contain more they ; point. be first a blank, the symbol (Section 3.3 describes statement program 2.1 be a hyphen or SAVE ADDRESS OF BOOT DEVICE DRIVER. W*BOO$AL_VECTOR,RPB$L_IOVEC(R7) symbol field example: statement: LABl: ROUTINE : CLEAR REGISTER $10,4 (AP)R2 MOVAL VAX-11 BEGINNING RO BRB A single end STATEMENT FORMAT in the source line. the statement fields in LABEL FIELD A label is program. a user-defined The symbol is symbol assigned that a identifies value equal a to 1location the location in the counter at the location in the program section in which the label occurs (see the VAX-11 MACRO User's Guide for information on program sections). The user-defined symbol name can be up to 15 characters long and can contain any alphanumeric character and the underline( ), dollar sign ($), and period (.) characters. Section 3.3 describes The forming user-defined symbol names in more detail. If a statement on the line. A label is contains terminated single colon module (an by indicates internal a label, a colon that symbol). the the label (:) or label A double is globally defined; that is, the object modules (see Section 3.3.2). Once a label program. an error If is a message referenced. defined, label is when the it must a be double in the rules first field (z2). The colon is defined only for colon that label indicates can be for the current the 1label referenced by other cannot be redefined during the source more than once, VAX-11 MACRO displays defined label is defined and again when it is MACRO SOURCE STATEMENT FORMAT If a label extends past column 7, it should be placed a on itself so that the operator field can start in column 9. ERROR_IN ARG: N RO MOVL EXP,R1 BRW « BLKL . BLKW EXIT_ROU 50 25 NE INCL WO MO WO TEST1: EXP: DATA:: WE WO TEST:: RO WO CLRL EVAL: 2.2 by example: W For line ROUTINE EVALUATES EXPRESSIONS THE ARG-LIST CONTAINS AN ERRO! INCREMENT ERROR COUNT THIS TESTS ROUTINE REFERENCED EXTERNALLY GO TO EXIT ROUTINE TABLES STORES EXPECTED VALUES DATA TABLE ACCESSED BY STORE ROUTINE IN ALGO MODULE OPERATOR FIELD The operator field specifies This field can statement. the action to contain either assembler directive, or a macro call. performed by the instruction, or an be an When the operator is an instruction, VAX-11 MACRO generates the binary code for that instruction in the object module; the instruction set When the is described in the VAX-11/780 Architecture Handbook. actions control certain performs MACRO operator is a directive, VAX-11] the assembly; or processing operations during source program assembler directives are described in Chapters 5 and 6 of this manual. When the operator is a macro call, VAX-11 macro calls are described in Chapter 6. Either a space or a tab character MACRO terminates the macro; operator field; expands the however, the tab is the recommended terminating character. 2.3 OPERAND FIELD The operand field can contain operands for instructions for assembler directives or macro calls. or arguments Operands for instructions specify the locations in memory or the registers that are used by the machine operation. Operands for instructions specify the addressing mode for the instruction. Chapter 4 describes the VAX-11 addressing modes. The operand field for a specific instruction must contain the number of operands required by See the VAX-11/780 Architecture Handbook for a that instruction. description of the instructions and their operands. Arguments for a directive must meet the format requirements of the directive. Chapters 5 and 6 describe 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 should be separated by VAX-11 MACRO also allows a space or tab to be used as a commas. separator for arguments to directives that do not accept expressions (see Section 3.5). However, a comma is required to separate operands for instructions and for directives that accept expressions as arguments. MACRO SOURCE The semicolon field. If a terminated by 2.4 STATEMENT FORMAT that starts the comment field terminates the line does not have a comment field, the operand the end of the 1line. operand field is COMMENT FIELD The comment statement. field contains Every line of text code that should explains have a the meaning comment. Comments of do the not affect assembly processing or program execution except for messages displayed during assembly by the .ERROR, +«PRINT, and .WARN directiv es (see descriptions in Chapter 5). The comment field must be preceded by a semicolon and is the end of the 1line. The comment field can contain ASCII If a character (see comment does next, comment but the can not Appendix fit on one continuation appear on a A). line line, must by be it can preceded be by terminated by any printable continued another itself, on semicolon. the A The comment's text normally conveys the meaning rather than the action of the statement. The instruction MOVAL BUF PTR 1,R7, for instance, should have a comment such as "GET POINTER TO FIRST BUFFER" not "MOVE ADDRESS For OF BUF_PTR 1 TO R7." example: MOVAL STRING_DES 1,R0 MOVZIWL (RO),R1 MOVL 4(RO),RO 2-4 ; GET ADDRESS ;+ DESCRIPTOR H GET LENGTH GET ADDRESS OF OF OF STRING STRING STRING CHAPTER 3 THE COMPONENTS OF MACRO SOURCE STATEMENTS source MACRO VAX-11 of components the describes chapter This statements. These components consist of the character set; numbers; unary and binary and expressions; terms 1local labels; symbols; and the current location statements; assignment direct operators; counter. 3.1 CHARACTER SET The following characters can be used in VAX-11 MACRO source statements: e through a Both uppercase and lowercase letters (A through %2, However, the assembler considers lowercase accepted. are z) in letters equivalent to uppercase except when they appear ASCII strings. e The digits e The 0 special through 9. characters listed Table Special Character Characters Used in Table 3-1. 3-1 in VAX-11 MACRO Statements Character Name Function == F _ Underline Character in symbol names $ Dollar sign Character in symbol names . Period Colon = ' Equal sign Character in symbol names, current location counter, decimal point Label and terminator Direct assignment operator and macro keyword argument terminator Tab Field terminator Space Field terminator (continued on next page) 3-1 THE COMPONENTS OF MACRO SOURCE Table Special Character Characters Character # Number @ At sign 3-1 Used STATEMENTS (Cont.) in VAX-11 MACRO Statements Name sign Function Immediate indicator addressing mode Deferred addressing mode indicator and arithmetic shift operator ' Comma Field, operand, and item separator ; Semicolon Comment + Plus Autoincrement sign field indicator addressing mode indicator, unary plus operator, and arithmetic addition operator - Minus sign or hyphen Autodecrement addressing mode indicator, unary minus operator, arithmetic subtraction operator, and line continuation indicator * Asterisk Arithmetic multiplication operator / Slash Arithmetic division operator & Ampersand Logical AND operator ! Exclamation point Logical inclusive \ Backslash Logical exclusive OR and numeric conversion indicator in macro OR operator arguments - Circumflex Unary operators and macro argument [] Square brackets () Parentheses delimiter Index addressing mode and count indicators Register deferred repeat addressing mode indicators <> Angle brackets Argument or expression grouping delimiters ? Question mark Created label indicator in macro arguments ' Apostrophe Macro argument concatenation indicator $ Table Percent 3-2 defines the sign separating Macro string characters used operators in VAX-11l MACRO. THE COMPONENTS OF MACRO SOURCE STATEMENTS 3-2 Table Separating Characters in VAX-11] MACRO Statements Character Character Usage Name Separator between statement Spaces within fields. expressions (see Section 3.5) Space or tab are ignored. Separator between symbolic Comma ’ arguments within the operand field. Multiple expressions in the operand field must be separated by commas. NUMBERS 3.2 Numbers can be integers, floating-point numbers, or packed decimal strings. 1Integers 3.2.1 Integers can be used in any expression including expressions in operands and in direct assignment statements (Section 3.5 describes expressions). Format snn An optional sign: default) nn plus or minus sign (-) sign (+) for positive for negative numbers. A string of numeric characters that are 1legal for numbers the (the current radix. VAX-11 MACRO interprets all integers in the source program as decimal unless the number is preceded by a radix control operator (see Section 3.6.1). Integers must be in the range of -2147483648 through 2147483647 for signed data or in the range of 0 through 4294967295 for unsigned data. Negative numbers must be preceded by a minus sign; translates such numbers into 2's complement form. numbers, 3.2.2 VAX-11 MACRO In positive the plus sign is optional. Floating-Point Numbers A floating-point number can with a be used in the .FLOAT and .DOUBLE Chapter 5) or as an operand in a in (described directives floating-point instruction. A floating-point number cannot be used in an expression or wunary or binary operator except the unary THE COMPONENTS OF MACRO SOURCE STATEMENTS plus, unary minus, and unary floating-point operator 3.6 and 3.7 describe unary and binary operators. A floating-point number can be specified with or (°F). without an through 9. Sections exponent. Formats Floating-point number without number with exponent: snn snn.nn snn. Floating-point exponent: snnEsnn snn.nnEsnn snn.Esnn s An optional sign. nn A string The decimal However, of decimal point note can that a digits appear Floating-point numbers can double-precision (64-bit) digits for the anywhere floating-point point because VAX-1ll MACRO will symbol (see Section 3.3.2). numbers. in range to the number treat the be either quantities. single-precision numbers and of 0 right of the cannot start number as first with a truncated. 5) or control The .ENABLE whether truncated. The VAX-11/780 floating-point Packed and numbers .DISABLE single-precision Double-precision rounded. 3.2.3 floating-point Architecture single-precision (32-bit) or The degree of precision is 7 16 digits Decimal can be for rounded directives double-precision Handbook be smaller 1.7E38. (by default) or (described in Chapter numbers are rounded floating-point floating numbers. digit. decimal user-defined The magnitude of a nonzero floating-point number cannot than approximately 0.29E-38 or greater than approximately Single-precision a point numbers are always describes the internal only the .PACKED directive range 0 format of Strings A packed decimal string can (described in Chapter 5). be used in Format snn An optional sign. nn A string of from 1 to 31 decimal 3-4 digits in the of through THE COMPONENTS OF MACRO SOURCE STATEMENTS A packed decimal string cannot have a decimal point or an exponent. The VAX-11/780 Architecture Handbook describes the internal format packed decimal of strings. SYMBOLS 3.3 source MACRO Three types of symbols can be used in VAX-11] permanent symbols, user-defined symbols, and macro names. 3.3.1 programs: Permanent Symbols (see Appendix Permanent symbols consist of the instruction mnemonics 5 and 6), and the Chapters (see the VAX-11 MACRO directives C), The instruction mnemonics and directives need not be register names. in the operator field of a VAX-11 MACRO defined before being used source statement. The register names need not be defined before being The register names (see Chapter 4). in the addressing modes used cannot be redefined; that is, no user-defined symbol can have one of the register names listed below. The 16 general registers of the VAX-11/780 processor can be expressed in a source program only as follows: Register Processor Register Name RO General register 0 R1 General register 1 R2 General register 2 R11 General register 11 R12 or AP RI12 is If 12 or argument pointer. General register is AP the name used as an argument pointer, R12 is used as a general register, if recommended ; the name R1l2 is recommended. FP Frame pointer SP Stack pointer PC Program counter THE 3.3.2 User-defined User~defined specific symbols ® ® can symbols following ® Symbols also used the User-defined symbols characters, underlines labels used in creation can ( The first character of The symbol be no by The be (see expression signs must 15 not be a characters Section alphanumeric and symbol. a symbols: of ($), to 3.8). (see user-defined the than equated Section composed symbol more can periods (.). number. long and must be DIGITAL convention: dollar This of dollar terminates a or any be ), character must STATEMENTS statement Any other In addition, sign ($) convention is reserved ensures not have a dollar DIGITAL-defined name @ as can be rules govern SOURCE Macro Names assignment unique. ® OF MACRO and be value by a direct User-defined 3.5). The COMPONENTS that sign) (which for a names defined user-defined name by DIGITAL. (which will not conflict does have a dollar sign). does with a The period (.) should not be used in any global symbol name (see Section 3.3.3) because other languages, such as FORTRAN, do not allow periods in symbol names. Macro names follow the same rules and conventions as user-defined symbols (see the description of the .MACRO directive in Chapter 6 for more information on macro names). User-defined symbols and macro names do not user-defined user-defined 3.3.3 conflict; symbol symbols Determining The value uses a of a that 1is, the and a macro. and macros should Symbol symbol depends on its use method operator to field it operand to determine field. A symbol macro in following This uses operator VAX-11 field MACRO Previously ® User-defined ® Permanent ® Macro search If permanent A symbol a register in can be used for a to avoid confusion, different names. can be opcode symbols (see the for program. values values either searches macro the the a a of of symbols permanent symbol VAX-11 symbols symbol definition MACRO in in the the or in a the names the .OPDEF (instructions description and in Chapter 5) directives) libraries order a defined in determine order: ® names. a the name. name Values different than same However, be given allows permanent symbol in symbol, the the name. operand the symbols operator assembler field field displays must ‘ be to is be not redefined defined an error either a as as a macro macro or message. user-defined symbol or THE COMPONENTS OF MACRO SOURCE STATEMENTS User-defined symbols can be either local (internal) symbols or global Whether symbols are local or global depends on symbols. (external) their use in the source program. A local symbol can be referenced only in the module in which it is If local symbols with the same names are defined in defined. A global different modules, the symbols are completely independent. in the module any from referenced be can however, symbol's definition, program. Normally, VAX-11 MACRO treats all user-defined symbols as local when However, a symbol definition can be explicitly they are defined. declared to be global by any one of the following three methods: Section e Use of the double colon (::) in defining a label (see e Use of the double equal e Use of the .GLOBAL, .ENTRY, or .WEAK directive (see Chapter 5) 2.1) statement in (==) sign (see Section 3.8) a direct assignment When a symbol is referenced within the module in which it is defined, VAX-11 MACRO considers the reference an internal reference. When a symbol is referenced within a module in which it is not defined, VAX~11 MACRO considers the reference an external reference (that is, The .DISABLE directive can the symbol is defined in another module). not defined in the current symbols to references make be used to 1In this case, the .EXTERNAL directive must be used to module illegal. See Chapter 5 specify that the reference is an external reference. for descriptions of the .DISABLE and .EXTERNAL directives. 3.4 LOCAL LABELS of source user-defined symbol Local labels cannot be referenced outside the block of source Local labels are used to identify addresses within a block code. Format nn$ nn A decimal integer in the range of 1 through 65535. Local labels can be used labels, e e e e in the same way but with the following differences: code as in which they appear. Local labels can be reused in another block of source code. Local labels do not appear in the cannot be accessed by the debugger. symbol and, tables thus, Local labels cannot be used in .END (see Chapter 5) By convention, local labels are positioned the same they are 1left-justified in the that is, labels; Although local labels can appear in convention, the program in statement as source text. any order, by the local labels in any block of source code should be in numeric order. THE Local labels only within are used are useful the only COMPONENTS as branch block. in a OF MACRO Local SOURCE STATEMENTS addresses when the address 1is distinguish between labels labels small used that block of code and labels that are referenced elsewhere in the module. A disadvantage of local labels is that their numeric names cannot provide any indication of their purpose. Consequently, local labels should not be used to label logically unrelated sequences of statements; user-defined symbols should be used instead. DIGITAL 1$ to recommends 29999$ in the range 6.1.6). A local that because of label users assembler to 655358 30000$ block is delimited ® A user-defined ® A .PSECT directive ® The .ENABLE extend a label block create the 1 ocal labels only in the range of au tomatically creates local labels for use in macros (see Section by the following statements: label and (see Chapter 5) .DISABLE directives (see Chapter 5) label block beyond user-defined local .PSECT directives local However, is the usually delimited LOCAL BLOCK terminated only by one of the ® A second ®¢ A .DISABLE label Although another, not be should An is -ENABLE .ENABLE or local LOCAL a label referenced used example blocks from another instead. showing the use RPSUB: MOVL 10S: AMOUNT, RO SUBL2 DELTA,RO BGTR 108 ADDL2 DELTA,RO MOVL MAX,R1 CLRL R2 COMP: 10S$: 208: ENTR1: ENTR2: CMPL RO,R1 BGTR 208 SUBL INCR,RO INCL R2 BRB 108 MOVL R2,COUNT BRW TEST of . ENABLE LOCAL POPR # "M<RO,R1,R2> BLOCK ADDL3 RO,R1,R3 BRB 108 SUBL2 directive can recommends R2,R3 two extend that and user-defined starts followed from local program local can labels a local one labels that user-defined a program in section. labels by one section program LOCAL LABEL BLOCK LOCAL LABEL 10$ CONDITIONAL ENDS BRANCH TO WHEN PREVIOUS BLOCK AND RO NOT LOCAL STARTS LOCAL > EXECUTED WHEN LABEL NEW ONE RO UNCONDITIONAL LOCAL BRANCH UNCONDITIONAL START LOCAL BY A NOT TO LABEL R1 TO LOCAL LABEL BRANCH TO LABEL LABEL NOT BE LOCAL USER-DEFINED BLOCK TERMINATED USER-DEFINED BRANCH > LABEL USER-DEFINED THAT WILL LABEL 0 DEFINE NEW LOCAL LABEL 10$ CONDITIONAL BRANCH TO LOCAL DEFINE symbols follows. STARTS EXECUTED to section User-defined DEFINE A 1labels. block directive .PSECT directive DIGITAL be LOCAL_BLOCK BLOCK by directive following: WO NE NG MO N WE N W NG WO N WO WO W we WO TMS WO “e we w2 A which LABEL LABEL LABEL DOES NOT START A NEW LOCAL LABEL BLOCK THAT IS AFTER THE COMPONENTS OF MACRO SOURCE STATEMENTS w2 R2,R3 208 NP SUBL2 BGTR INCL BRB NI "I RO NEXT NG 10s: 3.5 WNE USER-DEFINED LABEL DEFINE LOCAL LABEL DIRECTIVE FOLLOWED WO NEXT: WP DECL RO .DISABLE LOCAL_BLOCK CLRL R4 BY USER-DEFINED LABEL TERMINATES Ne 208: DEFINE LOCAL LABEL CONDITIONAL BRANCH TO LOCAL LABEL EXECUTED WHEN R2 NOT > R3 UNCONDITIONAL BRANCH TO LOCAL LABEL BLOCK TERMS AND EXPRESSIONS A term can be any one of the following: e A number e A @ The current location counter e A textual operator followed by text e Any of the above preceded by a symbol (see Section 3.9) (see Section 3.6.2) unary operator (see Section 3.6) VAX-11 MACRO evaluates terms as longword (4-byte) values. If an undefined symbol 1is used as a term, the linker determines the term's value. The current location counter (.) has the value of the location counter at the start of the current operand. Expressions are combinations of terms joined by binary operators (see Section 3.7) and evaluated as longword (4-byte) values. VAX-11l MACRO evaluates expressions from left to right with no operator precedence rules. However, angle brackets (<>) can be used to change the order of evaluation. Any part of an expression that is enclosed in angle brackets is first evaluated to a single value, which is then used in evaluating the complete expression. For example, the expressions A*B+C and A*<B+C> are different. Angle brackets can also be used to apply a unary operator to an entire expression, such as -<A+B>. Note that unary operators are considered part of a term; thus, VAX-1ll MACRO performs the action indicated by a unary operator before it performs the action indicated by any binary operator. All expressions are one of three external e types: relocatable, absolute, or (global). An expression is relocatable if its value is fixed relative to the start of the program section in which it appears. The current location counter 1is relocatable in a relocatable program section. ® An expression is absolute if its wvalue is an assembly-time constant. An expression whose terms are all numbers is absolute. An expression that consists of a relocatable term minus another relocatable term from the same program section is absolute, because assembly-time constant. ® such an expression reduces An expression is external if it contains one or that are not defined in the current module. 3-9 more to an symbols THE COMPONENTS OF MACRO SOURCE STATEMENTS Any type of expression restrictions ® .ALIGN ® .BLKx e .IF ® .REPEAT repeat ® .OPDEF opcode ® .ENTRY entry .BYTE, .LONG, e alignment storage and .IIF repetition ® can be used 1in are placed on expressions Direct most used in: macro statements, but directive allocation conditional block directives assembly block directives directive definition directive point directive .WORD, .SIGNED_BYTE, and .SIGNED WORD directive factors assignment statements (see Section 3.8) See Chapter 5 for descriptions of the directives listed above, except .REPEAT which 1is described in Chapter 6. Expressions used in these directives and symbols that cannot contain current In external addition, Expressions showing the in use of statements can defined in the current symbols the or direct defined these assignment expressions later in directives statements the must can be follows. = LAB+<A/2> +.BLKB LAB2-LAB wO "o “NF CONTAINS WE A LAB TST+LAB+2 UNDEFINED LAB+<A/2> UNDEFINED SYMBOLS IS A RELOCATABLE CONTAINS NO SYMBOLS LAB2-LAB IS AN ABSOLUYUTE EXPRESSI CONTAINS NO UNDEFINED SYMBOL M LAB3-LAB2 NP AND BUT IS AN ABSOLUTE CONTAINS NS «.WORD NO EXPRESSION EXPRESSION A RELOCATABLE THAT WO LAB3: LAB3-LAB2 IS AN ABSOLUTE AN ABSOLUTE TST+LAB+2 WE «.WORD IS IS EXPRESSION AND WO LAB2: BLKW 2*100 A+50 NG HALF « A+50 WE LAB: A in only contain module. They 2*%100 .BLKB 3.6 symbols expressions NG = either assignment previously NS A example direct been module. be absolute. relocatable. An 1in have IS BECAUSE THE DEFINED IS TST AN IS SYMBOL LATER IN EXTERNAL AN EXPRESS LAB3 THIS EXTERNAL SYMBO UNARY OPERATORS unary action operator to be modifies performed a on term or that an expression, term or expression. and indicates Expressions an must be enclosed in angle brackets. Unary operators can be wused to indicate whether a term or expression is positive or negative (if unary plus or minus is not specified, the value is assumed to be plus, by default). In addition, unary operators perform radix conversion, textual conversion (including ASCII conversion), and numeric control operations, as described in Sections 3.6.1 through 3.6.3. Table 3-3 summarizes the unary operations. 3-10 MO EXPRESS THE COMPONENTS OF MACRO SOURCE STATEMENTS Table 3-3 Unary Operators Unary Operator Operator Name F Example —— + Plus - Operation e i — —— +A Results in the value of A Minus sign -A Results in the negative B Binary “B11000111 D Decimal “Dl127 oOctal “034 X Hexadecimal “XFCF9 A ASCII “A/ABC/ M Register mask # "M<R3,R4,R5> | Specifies the registers "0 | sign — positive (2's complement) of A Specifies that 11000111 is a binary number Specifies that 127 is a decimal number Specifies that 34 is an octal number Specifies that FCF9 is a hexadecimal string; the characters between the matching delimiters are converted to ASCII representation R3, F Floating point “F3.0 °C Complement ~Cc24 More than one unary operator can be applied expression enclosed in angle brackets. For number Produces an ASCII R4, and R5 register mask . value Specifies that floating-point in the 3.0 is a number Produces the 1's complement value of (decimal) 24 to a single term or to example: an -+-A This construct is equivalent to: =<+<=A>> 3.6.1 Radix Control Operators VAX-11 MACRO accepts terms or expressions in four different radixes: binary, decimal, octal, and hexadecimal. The default radix is decimal. Expressions must be enclosed in angle brackets. 3-11 THE COMPONENTS OF MACRO SOURCE STATEMENTS Formats “Bnn “Dnn “Onn “Xnn nn A string of characters that are legal in the specified The legal characters for each radix are listed below. Format Radix “Bnn Name Legal Characters Binary 0 and 1 “Dnn Decimal 0 through 9 “Onn Octal 0 through 7 “Xnn Hexadecimal 0 through 9 and A through F radix. Radix control operators can a numeric value is legal. be included in the source program anywhere A radix control operator affects only the term or expression immediately following it, causing that term or expression to be evaluated in the specified radix. example: The circumflex it, but and tabs radix. cannot be separated the entire radix control from the term or BINARY 13 ALL NUMBERS ARE from the operator expression RADIX DECIMAL RADIX OCTAL RADIX W N WO wO "B00001101 D123 "047 <A+7013> "X<F1C3+FFFFF-20> W «WORD .WORD .WORD .WORD . LONG NE For that is IS IN OCTAL RADIX IN B, (DEFAULT) IN EXPRESSION HEXADECIMAL D, 0, or RADIX X that follows can be separated by spaces to be evaluated in that The decimal operator, the default, is needed only within an expression that has another radix control operator. 1In the following example, the 16 would be interpreted as an octal number if the "D operator did not precede it: . LONG 3.6.2 Textual “0<10000 + 100 + "D16> Operators The textual operators are mask operator ("M). the ASCII operator ("A) and the register 3.6.2.1 ASCII Operator - The /ASCII -operator -<converts a string of Printable characters to their ‘8-bit ASCII values and stores them one character to a byte. The string of characters must be enclosed in a pair of matching delimiters. The delimiters can be any printable character except the space, tab, semicolon (;). Although alphanumeric characters can be used as delimiters, nonalphanumeric -characters -should be used to avoid confusion. or THE COMPONENTS OF MACRO SOURCE STATEMENTS Format “Astring string A delimited The delimited the operand. ASCII ASCII string from string must For example, 1 not through be larger than the long. data type if the "A operator occurs in an operand a MOVW instruction (the data type is cannot be more than two characters. a word), the delimited of in string example: #$"A/ABCD/,R0O #"A/XY/,RO NG . QUAD MOVL "A%1234/678% #$"A/AB/,RO MOVES CHARACTERS A,B,C,D, INTO RO RIGHT JUSTIFIED WITH "A" IN LOW-ORDER BYTE AND "D" RO; "A" IN LOW-ORDER BYTE; "B" IN NEXT; AND ZERO THE 2 HIGHORDER WE MO IN HIGH-ORDER BYTE COMPARES X AND Y AS ASCII CHARACTERS WITH CONTENTS OF LOW ORDER 2 BYTES OF RO GENERATES 8 BYTES OF ASCII DATA MOVE ASCII CHARACTERS AB INTO WO WO WS WE CMPW MO WO Ne N MOVL "G For 8 characters BYTES 3.6.2.2 Register Mask Operator - The register mask operator converts a register name or a list of register names enclosed in angle brackets into a 1- or 2-byte register mask. The register mask is used by the PUSHR and POPR instructions and the .ENTRY and .MASK directives (see Chapter 5). Formats "Mreg-name "M<reg-name-list> reg-name One of the specifiers. register names or the DV or IV arithmetic trap enable reg-name-list A list of register names and/or the DV enable specifiers, separated by commas. The and IV arithmetic trap register mask operator sets a bit in the register mask for every register name or arithmetic trap enable specified in the list. The bits corresponding to each register name and arithmetic trap enable specifier are listed below. 3-13 THE Register Name RO through R12 or COMPONENTS OF MACRO SOURCE Arithmetic Enable STATEMENTS Trap Bits R11l 0 AP through 11 (respectively) 12 FP 13 Sp When the register mask IV 14 DV 15 operator is wused instruction, RO through R11l, R12 or AP, The PC register name and the IV and specifiers cannot be specified. FP, DV in a POPR or PUSHR and SP can be specified. arithmetic trap enable When the register mask operator 1is wused in the .ENTRY or .MASK directives, R2 through Rll and the IV and DV arithmetic trap enable specifiers can be specified. However, RO, R1l, FP, SP, and PC cannot be specified. IV sets the integer overflow trap, and DV sets the decimal string overflow trap. See the VAX-11/780 Architecture Handbook for more register masks and arithmetic trap enable specifiers. on example: RT1l, "M<R3,R4,R5,R6,IV> # "M<RO,R1,R2,R3> WNE POPR # "M<RO,R1,R2,R3> MO PUSHR We NS WNe .ENTRY O For information 3.6.3 Numeric Control SAVE REGISTERS R3,R4 R5, AND R6 AND SET THE INTEGER OVERFLOW TRAP SAVE REGISTERS RO,R1, R2, AND R3 RESTORE RO,R1,R2, AND R3 Operators The numeric control operators are the floating-point operator the complement operator (°C). (°"F) and 3.6.3.1 Floating Point Operator - The floating-point operator accepts a floating-point number and converts it to its internal representation (a 4-byte value). This value can be used in any expression. VAX-11 MACRO does not perform floating-point expression evaluation. Format “"Fliteral literal A floating-point number (see Section 3.2.2). The floating-point operator is useful because floating-point number in an instruction that accepts a $°F3.7,R0 MOVF #3.7,R0O W MOVL “o example: e For it allows integers. 3-14 NOTE THE RECOMMENDED INSTRUCTION TO MOVE THIS FLOATING-POINT NUMBE: IS THE MOVF INSTRUCTION THE COMPONENTS OF MACRO SOURCE STATEMENTS 3.6.3.2 Complement Operator - The complement 1's complement of the specified value. operator produces the Format “Cterm term Any term or expression. be enclosed If an expression is specified, in angle brackets. it must VAX-11 MACRO evaluates the term or expression as a 4-byte value before complementing 3.7 PRODUCES FFFFFF00 (HEX) PRODUCES COMPLEMENT OF 25 (DEC) WHICH IS FFFFFFE6 W “C"XFF ~“C25 WP . LONG . LONG We example: e For it. (HEX) BINARY OPERATORS In contrast to unary operators, binary operators specifz actions to be performed on two terms or expressions. Expressions must be enclosed in angle brackets. Table 3-4 summarizes the binary operators. Table 3-4 Binary Operators Binary Operator Operator Name Example Operation e —— + Plus - sign A+B Addition Minus sign A-B Subtraction * Asterisk A*B Multiplication / Slash A/B Division @ At sign A@B Arithmetic shift & Ampersand A&B Logical AND ! Exclamation point A!B Logical inclusive OR \ Backslash A\B Logical exclusive OR All binary operators have equal priority. Terms or expressions can be grouped for evaluation by enclosing them in angle brackets. The enclosed terms and expressions are then evaluated first, and remaining operations are performed from left to right. . LONG . LONG 1+2%3 1+<2*3> ; ; 3-15 For example: EQUALS 9 EQUALS 7 THE COMPONENTS OF MACRO SOURCE STATEMENTS Note that a 4-byte result is returned from all binary operations. If a 1l-byte or 2-byte operand is used, the result is the low-order byte(s) of the 4-byte result. VAX-11l MACRO displays an error message if the truncation causes a loss of significance. The following sections describe the arithmetic logical inclusive OR, and 1logical exclusive detail. 3.7.1 Arithmetic shift, logical AND, OR operators in more Shift Operator The arithmetic shift operator (@) is used to perform 1left and right arithmetic shift of arithmetic gquantities. The first argument is shifted left or right the number of bit positions specified by the second argument. argument is shifted If the second argument is positive, the first left; 'if the second argument is negative, the first argument 1is shifted right. When the first argument is shifted low-order bits are set to 0; and when the first argqument is shifted right, the high-order bits are set to the value of the original high-order bit (the sign bit). left, "B101@4 l1e2 e #<"B1100000@-5>,R0 . LONG . LONG Logical The logical For example: w > 3.7.2 “B1010 “B1100 "X1234@-A Logical (&) takes the A&B 1010000 (BINARY) 100 (BINARY) 11 (BINARY) YIELDS YIELDS 10000 (BINARY) 123 (HEX) logical ; Inclusive The logical inclusive of two operands. For YIELDS YIELDS YIELDS AND Operator AND operator . LONG 3.7.3 l1@Aa W MOVL W . LONG . LONG «e example: e For the AND of YIELDS two operands. 1000 (BINARY) OR Operator OR operator (!) takes the logical YIELDS 1110 inclusive example: A = "B1010 B = “B1100 .LONG A!B ; 3-16 (BINARY) OR THE COMPONENTS OF MACRO SOURCE STATEMENTS 3.7.4 Logical Exclusive OR Operator The logical exclusive OR operator of two For (\) takes the logical exclusive OR arguments. example: A = "B1010 B = "B1100 . LONG 3.8 A\B ; YIELDS 0110 (BINARY) a specific DIRECT ASSIGNMENT STATEMENTS A direct assignment statement equates a symbol to value. Unlike a symbol that is wused as a label, a symbol defined with a direct assignment statement can be redefined as many times as desired. Formats symbol=expression symbol==expression symbol A user-defined symbol. expression An expression that does not contain any Section 3.5). undefined symbols . (see The format with a single equal sign (=) defines a local symbol and format with a double equal sign (==) defines a global symbol. Section 3.3.3 for more information about local and global symbols. The following three syntactic rules apply to direct the See assignment statements: e An equal sign (=) or double equal sign (==) must separate the symbol from the expression defining the symbol's value. Spaces preceding and/or following the direct assignment operators have no significance in the resulting value. e Only one symbol can be defined in a single direct assignment statement. @ A direct assignment comment field. statement can be followed only In addition, by DIGITAL convention, the symbol in a direct statement is placed 'in the label For field. s+ THE SYMBOL *“A' ; TO THE VALUE 1 ; THE SYMBOL 'B' B = A@5 127*10 E = <B/10>+A1-<C> 3-17 EQUATED IS EQUATED : TO 1@5 OR 20 (HEX)" s+ THE SYMBOL 'C' IS EQUATED : THE SYMBOL 'D' IS EQUATED ;s D = "X100/°X10 IS TO 1270 (DEC) a assignment example: A=1 C = by ; TO 10 (HEX) ;s THE SYMBOL ‘'E' IS EQUATED TO <1270/10>+32-16 H OR 143 (DECIMAL) THE 3.9 COMPONENTS OF MACRO SOURCE STATEMENTS CURRENT LOCATION COUNTER The period (.), the symbol for the current 1location counter, always has the value of the address of the current byte. VAX-11 MACRO sets the current location counter to 0 at the beginning of the assembly and at the beginning of each new program section. Every VAX-11 MACRO source statement that allocates memory in the object module increments the value of the current location counter by the number of bytes allocated. For example, the directive .LONG O increments the current location counter by 4, but a direct assignment statement, except the special form described below, does not increase the current location counter because no memory is allocated. The of current location counter the direct assignment can be explicitly set by a special form statement. The 1location counter can be either incremented or decremented. Explicitly setting the 1location counter is often useful when defining data areas. Data storage area should not be reserved by explicitly setting the 1location counter; the .BLK directives should be used instead (see Chapter 5). Format .=expression expression An expression that does not Section 3.5). contain any undefined symbols (see In a relocatable program section, the expression must be relocatable; that 1is, the expression must be relative to an address in the current program section (it can be relative to the current location counter). For example: = ,+40 : MOVES LOCATION COUNTER ; FORWARD When a program section previously defined in the current module continued, the current 1location counter is set to the last value the current location counter in that program section. is of When the current location counter is used in the operand field of an instruction, the current location counter has the value of the address of that operand--it does not have the value of the address of the beginning of the instruction. For this reason, the current location counter is not normally used as a part of the operand specifier. 3-18 CHAPTER 4 ADDRESSING MODES This chapter summarizes the VAX-11 addressing modes and contains examples of VAX-11 MACRO statements that use these addressing modes. The VAX-11/780 Architecture Handbook describes the addressing modes in detail. There are four types of addressing modes: Register e General e Program Counter e Index e Branch Although index mode is a general register mode, it is considered a separate type of mode because it can be used only in combination with another type of mode. Table 4-1 summarizes the addressing modes. 4.1 GENERAL REGISTER MODES The general register modes use registers RO through R12, AP (the as R12), FP, and SP. There are eight general register modes: e Register ® Register Deferred e Autoincrement e Autoincrement Deferred e Autodecrement e Displacement e Displacement Deferred e Literal same uy us aap eor3loeg *(€°p ¥ Aoy s I93s1b9y aTesduAuuAaIiagyyy9u9nj3y3ys‘ustuotuT1oerybjbp19briasoapua9ussPxps3iuOaawaisssWt1aiiuabsi13Idahuejba1ddxedaaio0uxsdgy1pors9sa9o3qbdvlsuusaIieriqpnhhdbuyeya1srlriisn1pobeaeYasoauus3+(jnydtjy3u(useyruS)auyyrUuepob)lIe‘oenOj*wl9oguj*-doaesuaeyissflaJsowedouisq°opdzJ*ZeoTu1TaT¥y0Yend13°wts0X8ie9SiY#8Aope3UaIopRjNXIYuA{yias1r3aqpjy9LojjuS3deysoDesa-tjyualipb3wbuuzed3oaaer92dosyjiyelazluqead1rsuoq‘osol4drysyvs3izJyeeydolj*rpl‘ul3io4dooa1jaw4ssdy9uowl3esae1ls8ads09sipyg9oubul0oSedside)asdspaudaes3oijpaupdeseo3jeupJoOd93lZ91qsOeNaxapur panurjuod)uo3xeu(ebed Xy Tea9311 e1qel T-¥ b~euXixsaHa p y SapoW ADDRESSING MODES adi3a ST Teas3l1l 9y3z ‘{pueasado syi| €-0 buisaipv S9pOW ADDRESSING MODES Tea9311#.S (13*T3-u9eo¥ldL) Jaspopy3uyulenaleywaos_s_d77oqaaeeisTppjjd[eesooInipr3ppluauaiwrrtoAjJir‘rg‘os@o8a3a3{dhaDAdqsiqsgp‘s‘SepTpT‘aigooaaj9m9moyyulMl)ppuSsu'eseeaailpppee !pueiasdo aylxTea931Ts1p2103s ON a 1 q e l T ¥ ( * 3 u 0 ) b u i s e a i p v S 9 p o W p1w9e3iaubdnoAoal)g 9p93aAbAp1uToTir3n31sRaRjTTaai9qpYYgvy 1SssSs9ssssJaaaaaeiiaaupappppippoeeeeeg_p____MgM1ge_9o aT2.neTwed|aviogp)oAapjJppAosouaay1tsloealrwmaiajyabp1's3iu3zoleoeoaarTpadusdpjnes‘ouilaJeaSosrpuTz8taJsdyparwlowpladoeaorialaIya‘do1!zssipoeolouslras!aeasiDidqtdplassdp'eoasl‘Bi1o[.la9®lysy3tl3lSMlsersaelaipple ZoTqSeoxXapul o m b u t ‘ j u s a s d e r d s t A 1 s A 1 3 0 9 d s a oa33nef1opsauqyy TTseeax@aal3p11Te###.?1 86 psj®9p©eaoyalo(rm3ejapuiyTeszo‘eanwaI3bsd‘o!s3ApeTquTeSdi‘TspIiapdpooramjirol‘aaspydaosmesbSuTauoeitpY3ei0 saX panurjzuod)uo3xau(sbed ADDRESSING 4-4 MODES ADDRESSING MODES ON ON ¢0d woil buTIsSsSaipvVSOpOW ST sseippe 8yl 31 Jr m——— so—— youeag adAilL 4-5 ADDRESSING MODES 4.1.1 Register Mode In register mode, register, except field operands, concatenated bytes are of in the the where with the the operand register register mode or double-precision operand is the contents quadword, double-precision for operand contents are n+l. of is the register in register n The results are if SP is used in floating-point, or the specified floating-point, or contents n+l. and of The the most of register least significant unpredictable if register PC is mode with a operand extending field n significant bytes used in quadword, into PC. Formats Rn AP FP SP n A number in the range of 0 through 12. Example 4.1.2 In CLRB RO CLRQ R1 TSTW R10 INCL R4 Register register operand. Section Deferred deferred Register 4.3). ; CLEAR LOWEST BYTE ; CLEAR R1 ; TEST LOWER ; ADD 1 TO AND OF RO R2 WORD OF R10 R4 Mode mode, the register deferred mode contains ¢an be the used address with index LDATA TO of the mode (see Formats (Rn) (AP) (FP) (SP) n A number in the range of 0 through 12. Example 10$: 4.1.3 In MOVAL LDATA,R3 CMPL ’ MOVE (R3) ,RO BEQL ; 10$ COMPARE VALUE ;i IF ARE CLRL (R3) MOVL (SP) ,R1 MOVZBL (AP) ,R4 Autoincrement autoincrement operand. After ADDRESS OF THEY AT THE ; CLEAR ; COPY TOP ITEM OF GET LDATA SAME, LONGWORD AT NUMBER OF R3 TO RO IGNORE LDATA STACK ARGUMENTS INTO R1 IN CALL Mode mode, the evaluating register the contains the address operand address contained that address By the size register, the processor increments operand data type. The processor increments the contents of in of of the the +the the ADDRESSING MODES register by 1, 2, 4, or 8 for a operand, respectively. byte, word, longword, or quadword Autoincrement mode can be used with index mode (see Section 4.3), d but in specifie register the as same the index register cannot be the autoincrement mode. Formats + (Rn) + {AP) + (FP) + (SP) n A number in the range of 0 through 12. MOVAL CLRQ CLRL TABLE,R1 (R1)+ + (R1) BYTARR,R2 + (R2) + (R2) (R5) +, (R4) +, (R3) we W6 we wo MOVAB INCB INCB XORL3 = we We We Wo W W N Example 4.1.4 GET ADDRESS OF TABLE CLEAR FIRST AND SECOND LONGWORDS AND THIRD LONGWORD IN TABLE LEAVE R1 POINTING TO TABLE +12 GET ADDRESS OF BYTARR INCREMENT FIRST BYTE OF BYTARR AND SECOND ; EXCLUSIVE-OR THE TWO LONGWORDS WHOSE ADDRESSES ARE STORED IN R3 AND R4 AND STORE RESULT IN IN R5, THEN ADDRESS CONTAINED; ADD 4 TO R3, R4, AND R5 Autoincrement Deferred Mode In autoincrement deferred mode, the register contains an address that increments the is the address of the operand address (a pointer to the operand). After evaluating the operand address, the processor contents of the register by 4 (the size in bytes of an address). Autoincrement deferred mode can be used with index mode (see Section 4.3), but the index register cannot be the same as the register specified in autoincrement deferred mode. Formats @ (Rn)+ + @ (AP) Q(FP)+ @(spP)+ n A number in the range of 0 through 12. ‘CLRB @ (R2)+ WMo PNTLIS,R2 @(R2)+ N We We Wi We MOVAL CLRQ W Example GET ADDRESS OF POINTER LIST CLEAR QUADWORD POINTED TO BY FIRST ABSOLUTE ADDRESS IN PNTLIS : THEN ADD 4 TO R2 CLEAR BYTE POINTED TO BY SECOND, ABSOLUTE ADDRESS IN PNTLIS THEN ADD 4 TO R2 4-7 ADDRESSING 4.1.5 we MOVE “e R10,@(RO) + IS POINTED we MOVL MODES TO RO R10 TO LOCATION TO BY WHOSE RO; THEN ADDRESS ADD 4 Autodecrement Mode In autodecrement mode, the processor decrem ents the contents of the register by the size of the operand data type; then the register contains the address of the operand. The processor decrements the register by operands, respectively. 1, Autodecrement the index 2, mode can register autodecrement 4, or be 8 used for with cannot be byte, index the mode. word, mode same as longword, (see the or Section register quadword 4.3), but specified in Formats - (Rn) - (AP) = (FP) -(SP) n A number in the range of 0 through 12. 4.1.6 W W Wy R1l,-(RO) IN PUSH We CMPB WHOSE OF N R3,-(SP) 8 QUADWORD ONTO N MOVZBL SUBTRACT SUBTRACT e -(R1) BYTE WE CLRQ We Example IS FROM R1 AND ADDRESS ZERO IS R1 THE R3 ZERO-EXTENDED ONTO THE OF NOW THE STACK AS LOW A STACK 1 FROM RO R1 WITH BYTE IN AND BYTE LONGWORD COMPARE WHOSE RO THE THEN LOW ADDRESS Displacement Mode In displacement mode, the sum of the displacement (sign extended to a contents operand. Displacement mode can be used with of longword) index mode the register and is the address of the the (ste Secition 4.3). Formats dis (Rn) dis (AP) dis (FP) dis (SP) n A number in the range of 0 through a displacement; 12. dis An expression preceded by specifying one which indicate displacement. of the the following number of 4-8 the eXpression can be displacement length specifiers, bytes needed to store the ADDRESSING MODES Displacement Length Specifier Meaning B” Ww” L Displacement redquires 1 byte Displacement requires 1 word (2 bytes) Displacement requires 1 longword (4 bytes) If no displacement length specified precedes the expression and the value of the expression is known, the assembler chooses the the store to needed 4) or 2, (1, smallest number of bytes If no length specifier precedes the expression and displacement. 1 the value of the expression is unknown, the assembler reserves 1if the Note that the displacement. for bytes) (2 word displacement is either relocatable or defined later in the source If the actual it unknown. the assembler considers program, the linker displacement does not fit in the memory reserved, displays an error message. ~ MovB ,R5 B"ACCOUNT(R3) CLRW L"STA(R1) MOVL RO,-2(R2) TSTB EXTRN(R3) AS A NE W W Mo ME W We VW W W PLUS ADDRESS OF KEYWORDS THE DISPLACEMENT IS STORED AS A BYTE CLEAR WORD WHOSE ADDRESS IS STA PLUS CONTENTS OF Rl THE DISPLACEMENT IS STORED LONGWORD MOVE RO TO ADDRESS THAT IS -2 PLUS THE CONTENTS OF R2 THE DISPLACEMENT IS STORED AS A BYTE TEST THE BYTE WHOSE ADDRESS IS EXTRN PLUS THE ADDRESS OF KEYWORDS THE DISPLACEMENT IS STORED AS A WORD SINCE EXTRN IS UNDEFINED MOVE <CONTENTS OF R5> + 2 TO RO W WO 2(R5) ,RO THE DISPLACEMENT IS STORED AS A BYTE GET BYTE WHOSE ADDRESS IS ACCOUNT WO MOVAB GET ADDRESS OF KEYWORDS GET BYTE WHOSE ADDRESS IS I0 PLUS ADDRESS OF KEYWORDS We _We W W B"IO(R3) ,R4 W KEYWORDS,R3 MOVB We MOVAB "o N Example Note If the value of the displacement is 0 and no displacement is specified, the length assembler uses register deferred mode rather than displacement mode. 4.1.7 Displacement Deferred Mode In displacement deferred mode, the sum of the contents of the register and the displacement {sign extended to a longword) is the address of the operand address {a pointer to the operand). Displacement deferred mode can be used with index 4.3). 4-9 mode (see Section ADDRESSING MODES Formats @dis (Rn) @dis (AP) @dis (FP) @dis (SP) n A number in the range of 0 through a displacement; 12. dis An expression preceded specifying by one which indicate displacement, of the the following number of the expression displacement bytes length needed to can be specifiers, store the Displacement Length Specifier Meaning B® Ww* Displacement requires 1 byte Displacement requires 1 longword Displacement requires 1 word L" (2 bytes) (4 bytes) If no displacement length specifier precedes the expression the value of the expression is know, the assembler chooses smallest number of bytes (1, 2, or displacement. If no length specifier the value word of (2 the displacement program, expression bytes) is the for either is the unknown, or considers displacement does not fit in an error message. displays the the defined it to store the expression and assembler displacement. relocatable assembler 4) needed precedes the reserves 1 Note that later in the If the actual unkndwn. memory and the reserved, if the the source 1linker ARRPOINT,R6 Ne We @16 (R6) W MOVAL CLRL we Example MOVL ; GET ADDRESS OF ARRAY OF CLEAR POINTERS LONGWQRD POINTED TO BY LONGWORD WHOSE ADDRESS IS 16 PLUS THE ADDRESS OF ARRPOINT THE @B OFFS(R6) ,@RSOFF (R6) DISPLACEMENT ; MOVE THE IS STORED AS NE WMo e 284 (R2) We W We We We " Wy 7 BY LONGWORD WHQSE ADDRESS IS CLRW 4.1.8 BYTE TO OFFS PLUS THE ADDRESS OF ARRPOINT TO THE ADDRESS POINTED TO BY LONGWORD WHOSE ADDRESS IS PLUS THE ADDRESS OF ARRPOINT RSOFFS THE FIRST DISPLACEMENT IS STORED AS A BYTE THE SECOND DISPLACEMENT IS STGRED AS A WOR CLEAR THE WORD THA? IS POINTED TO BY LONGWORD AT 84 PLUS THE CONTENTS OF R24-THE ASSEMBLER USES BYTE DISPLACEMENT AUTOMATICALLY Literal Mode In literal mode, mode A LONGWORD POINTED byte itself. Formats #literal S"#literal the value of the literal is stored in the addressing ADDRESSING MODES literal An expression, an integer constant, or a floating-point constant. ‘Phe literal must fit in the short 1literal form. That is, integers must be in the range of 0 through 63 and floating-point constants must be one of the 64 values listed in Table 4-2, Floating-point short literals are stored with a 3-bit exponent and a 3-bit fraction. Table 4-2 also shows the value of the exponent and the fraction for each 1literal. See the VAX-11l Architecture Handbook for information on the format of short literals. Table 4-2 Point Short Floating Literals Fraction 0 1 2 3 4 5 6 7 0 ., 0.5] 0.5625] 0,625} 0.6875} 0.75| 0.8125| 0.875 0.9375 1 1.00 1.125 | 1.25 1.37 1.5 1.625 1.75 1.875 2 2.0] 2.25 2.75 3.0 3.25 3.5 Exponent 2.5 3 4 5 4.0| 4.5 8.0{ 9.0 16.0]18.0 5.0 10.0 20.0 5.5 11.0 22.0 6.0 6.5 12.0 | 13.0 24.0 26.0 7.0 14.0 28.0 6 7 32.0]136.0 64.0]72.0 40.0 80.0 J44.0 88.0 48.0 | 52.0 96.0 |104.0 56.0 112.0 3.75 7.5 15.0 30.0 60.0 120.0 Example MOVL #1,R0 ; ; MOVB S”#CR,R1 RO IS SET TO 1; THE 1 IS STORED IN THE INSTRUCTION AS A SHORT ; LITERAL ; ; THE LOW BYTE OF Rl TO THE VALUE €R IS SET ; CR IS STORED IN THE INSTRUCTION MOVF ;s AS ; IF CR A SHORT LITERAL ; ; R6 IS SET TO THE FLOATING POINT VALUE 0.625; IT IS STOREfi IS NOT IN RANGE 0-63, : THE'LINKER PRODUCES A TRUNCATION ; ERROR #0.625,R6 ; IN ; LITERAL FORM THE FLOATING POINT SHORT Notes 1. When the #literal whether 4.2,4), to use format is used, The assembler uses immediate following eonditions are met: e the assembler litefal mode or immediate mode mode if chooses (see Section 4ny of the The value¢ of the literal does not f£it in the short literal form e The literal is a relocatabld or external Seetion 3,5) e The litéfal symbols is an expression that expression ceontains (see undefined ADDRESSING MODES The difference amount of between storage immediate that instruction. 2. The S"#literal format it mode and to store takes forces the literal mode the literal assembler to is in the the use 1literal In relative mode, the address specified is the address of the The assembler stores the address as a displacement from PC. operand. mode. 4.2 The PROGRAM COUNTER MODES program counter There are five Relative ® Relative e Absolute e Immediate ® General Relative Relative mode use PC program counter e 4,2.1 modes for a general register. modes: Deferred Mode can be used with index mode (see Section 4.3). Format address address An expression preceded by specifying one which indicate displacement, of the the an address; following number the expression displacement of bytes length needed can be specifiers, to store the Displacement Length Specifier Meaning B® wt L” If no Displacement requires 1 byte Displacement requires 1”7 word (2 bytes) Displacement requires 1 longword (4 bytes) displacement expression and assembler chooses the the length value specifier of the precedes expression the is smallest number of bytes (1, needed to store the displacement. If no 1length precedes the address expression and the value of the is (see unknown, the assembler uses the the default description of .DEFAULT in Chapter expression is either defined later in the another unknown, program section, the assembler address known, or 4) specifier expression displacement 5). If program the or considers the 2, length address defined the in value ADDRESSING MODES Wy DISPLACEMENT PREVIOUSLY DEFINED COMPARE “wo e GET LONGWORD AT LABEL; THE ASSEMBLER USES DEFAULT W <DATA+4> ,R10 Ny WMe CMPL LABEL,R1 We MOVL We Example 4.2.2 R10 UNLESS WITH LABEL IN THIS SECTION LONGWORD AT ADDRESS DATA+4; THE ASSEMBLER USES A WORD DISPLACEMENT Relative Deferred Mode In relative deferred mode, the address specified is the address of the operand address (a pointer to the operand). The assembler stores the address specified as a displacement from PC. Relative deferred mode can be used with index mode (see Section 4.3). Format @Qaddress address An expression specifying an address; the expression can be preceded by one of the following displacement length specifiers, which indicate the number of bytes needed to store the displacement. Displacement Length Specifier B” w” L® Meaning Displacement Displacement Displacement requires requires requires 1 byte 1 word (2 bytes) 1 longword (4 bytes) If no displacement 1length specifier precedes expression and the wvalue of the expression assembler chooses the smallest number of bytes the address 1is known, the (1, 2, or 4) needed to store the displacement. If no length specifier precedes the address expression and the value of the expression is unknown, the assembler uses the default displacement length (see the description of .DEFAULT in Chapter 5). If the address expression 1is either defined later in the program or defined in another program section, the assembler considers the value unknown. Example CLRL INCB @W” PNTR @L"COUNTS+4 ; LONGWORD AT PNTR; ; USES ; ; H 4,2.3 CLEAR LONGWORD POINTED TO BY ; A WORD THE ASSEMBLER DISPLACEMENT INCREMENT BYTE POINTED TO BY LONGWORD AT COUNTS+4; ASSEMBLER USES A LONGWORD DISPLACEMENT Absolute Mode In absolute mode, the address specified is the address of the operand. The address is stored as an absolute virtual address (compare relative mode, where the address is stored as a displacement from PC). ADDRESSING Absolute mode can be used with MODES index mode (see Section 4.3). Format @Q#address address An expression specifying an address. Example CLRL W Q@#ACCOUNT 4.2.4 We #3,@#SYSSFAO THE CONTENTS OF LOCATION THE CONTENTS OF LOCATION ACCOUNT; THE ADDRESS IS STORED ABSOLUTELY, W CALLS CLEAR 1100 (HEX) CLEAR CALL Ne W . W @$#°X1100 CLRB THREE THE NOT AS A PROCEDURE ARGUMENTS ON DISPLACEMENT SYSS$FAO THE WITH STACK specified is the operand. constant, or a W the literal RO IS SET TO N9 In immediate mode, IS STORED N Immediate Mode THE LOW BYTE OF Rl Formats #literal I"#literal literal An expression, an integer floating-point constant. Exdmple MOVL #1000,RO MOVB TO R6 MO §$BAR,R1 POINT VALUE 0.1; FLOATING 1000 SET 4-BYTE IT IS STORED POINT Ve WE VALUE (IT CAN NOT BE REPRESENTED AS A SHORT LITERAL) THE WO 1“$5,R0 1S AS A 5 IS STORED IN A LONGWORD BECAUSE THE 1~ FORCES THE ASSEMBLER TO USE IMMEDIATE MODE; We NP ADDL2 OPERAND THE VALUE OF BAR IS SET TO THE FLOATING NP e #0.1,R6 THE LONGWORD W MOVF 1000; IN A Notes l. When the #literal whether to use mode, 1If the format 1literal literal is is wused, the mode (Section an integer floating-point constant that fits the assembler uses 1literal mode. eXpression, the assembler uses from assembler chooses 4.1.8) or immediate 0 through in 63 or a the short literal form, If the 1literal 1is an 1literal mode if all the following conditions are met: e The expression e The expression contains no undefined symbols e The value of In all cases, other is the absolute expression the fits assembler 4-14 in uses the short immediate literal mode. form ADDRESSING MODES The difference between immediate mode and literal mode is the amount of storage required to store the 1literal in the instruction. The assembler stores an immediate mode 1literal in a byte, word, or longword depending on the operand data type. 2. The I"#literal format forces the assembler to use immediate mode. 4.2.5 General Mode In general mode, the address specified is the address of the operand. The linker converts the addressing mode to either relative or absolute mode. If the address to relative mode. is relocatable, the linker converts general mode If the address is absolute, the linker converts general mode to absolute mode. General mode is used to write position-independent code when the programmer does not know whether the address is relocatable or absolute. A general addressing mode operand requires 5 bytes of storage. General mode can be used with index mode (see Section 4.3). Format G"address address An expression specifying an address. Example ¢ CLEARS THE LONGWORD AT LABEL_1 IF LABEL 1 IS DEFINED AS ABSOLUTE N G“LABEL_l e CLRL N THEN THIS IS CONVERTED TO ABSOLUTE N MODE; W N CALLS #5,G"SYS$SERVICE ; ; 4.3 IF IT RELOCATABLE, IS DEFINED AS THEN THIS IS CONVERTED TO RELATIVE MODE CALLS PROCEDURE SYS$SERVICE WITH 5 ARGUMENTS ON STACK INDEX MODE Index mode is a general register mode that can be wused only in combination with another mode, called the base mode. The base mode can be any addressing mode except register, immediate, literal, index, or branch. The assembler first evaluates the base mode to get the base address. Then the assembler adds the base address to the product of the <contents of the index register and the number of bytes of the operand data type. This sum is the operand address. Combining following index mode with the addressing modes: e Register Deferred e Autoincrement e Autoincrement Deferred e Autodecrement other Index Index Index Index 4-15 addressing modes produces the ADDRESSING MODES The e Displacement Index e Displacement Deferred e Relative e Relative Deferred e Absolute e General process index of register Index Index Index Index Index first is evaluating the same for the base each of mode and then adding the these modes. Formats base-mode [Rx] base-mode [AP] base-mode [FP] base-mode [SP] base-mode Any addressing mode except register, immediate, or branch, specifying the base address. A number register. Table 4-3 lists in t%e the range formats of 0 through index 12, mode 1literal, specifying the addressing. Examples i ; REGISTER DEFERRED INDEX MODE “e " We SET N CLEAR IS BLIST REGISTER BYTE WHOSE ADDRESS ADDRESS OF BLIST PLUS 20*1 CLEAR QUADWORD WHOSE ADDRESS OF CLEAR WORD WHOSE ADDRESS IS 20*2; ADDRESS W9 WMe THE e (R9) [R1] OF INDEX IS BLIST THE PLUS ADDRESS 20%*8 AUTOINCREMENT INDEX MODE we wo wo CLRQ UP N #0OFFS,R1 (R9) [R1] OFFS % MOVL CLRB DEFINE GET ADDRESS "e BLIST,R9 We MOVAB N OFFS=20 WME i (R9)+([R1] ADDRESS R9 OF BLIST PLUS NOW CONTAINS OF BLIST+2 AUTOINCREMENT DEFERRED INDEX MODE ~e W W @(R8) +[R2] SET CLEAR WORD WHOSE ADDRESS UP OF INDEX NI CLRW GET ADDRESS IS W $#30,R2 STORED WM POINT,R8 CONTAINS e MOVAL MOVL We ¢ we “o CLRW 30*2 PLUS POINT POINT REGISTER THE ADDRESS IN POINT; 4 PLUS R8 NOW ADDRESS OF index, index ADDRESSING MODES ° ’ DISPLACEMENT DEFERRED INDEX MODE ADDARR,R9 MOVL $100,R1 @40 (R9) [R1] SET UP INDEX REGISTER TEST FLOATING POINT VALUE WHOSE ADDRESS IS 100*4 PLUS ®e TSTF GET ADDRESS OF ADDRESS ARRAY O MOVAL Wo ’ Wy . e THE ADDRESS STORED AT (ADDARR+40) Table 4-3 Index Mode Addressing Format* Mode F=============================F==================fl Register Deferred Index (Rn) [Rx] Autoincrement Index (Rn) +[Rx] Autoincrement Deferred @(Rn)+[§x] Autodecrement Index -(Rn) [Rx] Displacement Index dis (Rn) [Rx] Displacement Deferred @dis (Rn) [Rx] Index Index * Relative Index address [Rx] Relative Deferred Index @address [Rx] Absolute Index @#address[Rx] General Index G"address [Rx] Key: Rn Any general register RO through R12 or the AP, FP, register. Rx Any general register RO through R12 or the AP, FP, Rx cannot be the same register as Rn in the register. autoincrement deferred index, autoincrement index, decrement index addressing modes. dis An expression specifying a displacement. address An expression specifying an address. 4-17 ADDRESSING MODES Notes 1., If the base mode alters the contents of its register (autoincrement, autoincrement deferred, and autodecrement), the index mode cannot specify the same register. 2. The index register is added to the address after the base 1is completely evaluated. For example, in autoincrement deferred index mode, the base register contains the address mode of the operand address. The index register (times the length of the operand data type) is added to the operand address rather than to the address stored in the base register. 4.4 BRANCH MODE In branch mode, the address is stored as an implied displacement PC. This mode can only be used in branch instructions. displacement for conditional branch instructions and the instruction instruction a range is stored is stored in of 127 bytes in a a word The BRB byte. The displacement for the BRW (2 bytes). A byte displacement allows forward displacement allows a range of backward. The displacement from and 128 32767 bytes is relative past the byte or word where the VAX-11/780 Architecture Handbook bytes backward. forward and to the updated displacement 1is stored. for more information on ‘instructions. A See the the branch Format address address An expression that represents an address. N9 we LABEL CODES We BRW LABEL1 TOTAL BRANCH We BLEQ (R1)+,R0,TOTAL LESS N Example ADDL3 BRANCH VALUES TO THAN AND LABEL1l OR SET IF EQUAL CONDITION RESULT TO UNCONDITIONALLY word 32768 bytes PC, the byte IS 0 TO LABEL CHAPTER 5 GENERAL ASSEMBLER DIRECTIVES The general assembler directives provide facilities for performing eleven different types of functions. Table 5-1 lists these types of functions and the directives that fall under them. The remainder of this chapter describes the directives in detail, showing their formats For ease of reference, the and giving examples of their |use. directives are presented in alphabetical order. 1In addition, Appendix B contains a summary of all assembler directives. Table 5-1 Summary of General Assembler Directives Category Listing Control Directives Directives* . SHOW . NOSHOW .TITLE .SUBTITLE (.LIST) (.NLIST) (.SBTTL) « IDENT - PAGE Message Display Directives . PRINT .WARN Assembler Option Directives .ENABLE .DISABLE Data Storage Directives .BYTE .WORD « ERROR (.ENABL) (.DSABL) .DEFAULT . LONG .ADDRESS . QUAD . PACKED .ASCII .ASCIC .ASCID .ASCIZ . FLOAT .DOUBLE .SIGNED BYTE .SIGNED_WORD * The alternate form, if any, is given in parentheses. (continued on next page) GENERAL ASSEMBLER DIRECTIVES Summary of Table 5-1 (Cont.) General Assembler Category Directives Directives* w Location Control Directives .ALIGN . EVEN .ODD . BLKA «BLKB « BLKD . BLKF «BLKL «BLKQ « BLKW «END Program . PSECT Sectioning Directives .SAVE PSECT -RESTORE_PSECT Symbol Control Directives Directives .GLOBAL .EXTERNAL .DEBUG (.SAVE) (.RESTORE) (.GLOBL) (.EXTRN) -WEAK Routine Entry Definition Directives Point .ENTRY . TRANSFER -MASK Conditional and Subconditional Assembly Block Directives .IF . ENDC .IF FALSE .IF TRUE .IF TRUE FALSE LIIF - Cross-Reference (. IFF) (. IFT) (.IFTF) .CROSS Directives -NOCROSS Instruction Generation .OPDEF .REF1 Directives «REF2 .REF4 -REFS8 * The alternate form, if any, S 5-2 is given in parentheses. GENERAL ASSEMBLER DIRECTIVES .ADDRESS +ADDRESS -- ADDRESS STORAGE DIRECTIVE .ADDRESS stores successive longwords containing addresses in the object module. DIGITAL recommends that .ADDRESS rather than .LONG be used for storing address data to provide additional information to the linker. In shareable 1images, addresses must be specified with .ADDRESS to produce position-independent code. Format .ADDRESS address-list Parameter address-list A list of symbols or expressions, separated by commas, that VAX-11 MACRO interprets as addresses. Repetition factors are not allowed. Example TABLE: .ADDRESS LAB 4,LAB 3,ROUTTERM ; REFERENCE TABLE GENERAL ASSEMBLER DIRECTIVES ALIGN +ALIGN -- LOCATION COUNTER ALIGNMENT DIRECTIVE -ALIGN aligns an integer or the location counter a keyword. to the boundary specified by either Formats .ALIGN .ALIGN integer[,expression] keyword|[,expression} Parameters integer An integer in the range of aligned at an address that of the integer. 0 through 9. The location counter is is a multiple of 2 raised to the power keyword One of five keywords that specify the alignment location counter is aligned to an address multiple of the values listed below. Keyword Size (in BYTE WORD LONG 20 = 271 = 272 = 1 2 4 279 = 512 QUAD boundary. that is the The next Bytes) 2°3 =8 PAGE expression Specifies the £fill value to be stored expression must not contain any undefined absolute expression (see Section 3.5). in each byte. symbols and must be The an Example .ALIGN BYTE,O ; BYTE .ALIGN WORD ; WORD ALIGNMENT JALIGN 3,°aA/ / 7 .ALIGN PAGE : ALIGNMENT-FILL WITH NULL QUAD ALIGNMENT-FILL WITH BLANKS PAGE ALIGNMENT Notes 1. The alignment specified in .ALIGN cannot exceed the alignment of the program section in which the alignment is attempted (see the description of .PSECT). For example, if the default program section alignment (BYTE) is being used and .ALIGN is specified with a WORD or larger alignment, the assembler displays an error message. 2. 1If the optional expression is supplied, the bytes skipped by the 1location counter (if any) are filled with the value of that expression. Otherwise, the bytes are zero filled. GENERAL ASSEMBLER DIRECTIVES 3. Although most instructions do not require any data alignment other than byte alignment, execution speed is improved by the following alignments: Data Length Word Longword Quadword Alignment Word Longword Quadword GENERAL ASSEMBLER DIRECTIVES LASCIx ASCIx -- ASCII VAX-11 CHARACTER STORAGE DIRECTIVES MACRO has four ASCII character storage directives: Directive Function ASCII ASCII ASCIC Counted ASCID ASCIZ String-descriptor ASCII string storage Zero-terminated ASCII string storage string storage ASCII string storage Each directive is followed by a string of characters enclosed in a pair of matching delimiters. The delimiters can be any printable character except the space, tab, equal sign (=), semicolon (;), or left angle bracket (<). The character used as the delimiter cannot appear in the string itself. Alphanumeric characters can be used as delimiters; however, nonalphanumeric characters should be used to avoid confusion. Any character characters can convert ASCII 8-bit byte. except appear lowercase character ASCII the null, carriage within the string. alphabetic storage value characters directives to convert (see Appendix A) and return, and form feed The assembler does not uppercase. the characters store them one +to character their to a Any character, including the null carriage return, and form feed characters, can also be represented by an expression enclosed in angle brackets outside of the delimiters. The ASCII character storage directives store the 8-bit binary value specified by the expression. ASCII strings can be continued over several lines but the string on each 1line must be delimited at both ends; however, a different pair of delimiters can be used for each line. For example: CR=13 LF=10 .ASCII /ABC DEFG/ .ASCIZ .ASCIC JASCII @Any character can be delimitere@ ? lowercase is not converted to UPPER? ? this is a test!?XCR>KLF>!Isn't it?! .ASCII .ASCII \ Angle Brackets <are part <of> this> string \ / This string is continued / \ on the next line \ <CR>XLF>! this string includes an expression! - +ASCII <128+CR>? whose value The following sections describe each storage directives, giving the formats is a of and 13 plus 128? the four ASCII examples of each. character GENERAL ASSEMBLER DIRECTIVES .ASCII .ASCII -- ASCII STRING STORAGE DIRECTIVE LASCII stores in the next available byte the ASCII value of each character in the ASCII string or the value of each byte expression. Format .ASCII stging Parameter string A delimited ASCII string. Example CR=13 LF=10 .ASCII .ASCII "DATE: 17-NOV-1977" /EOF/<CR><LF> .ASCIC +ASCIC -- COUNTED ASCII STRING STORAGE DIRECTIVE .ASCIC performs the inserts function same .ASCII, except that The length given includes any because the count indicates the The count byte contains outside the delimited string but the length of the string in bytes. of bytes .ASCIC as a count byte before the string data. nonprintable excludes the count byte. characters .ASCIC is useful in copying text length of the text to be copied. Format .ASCIC string Parameter string A delimited ASCII string. Example #HELLO#<CR> .BYTE 6 #HELLO#<CR> NG .ASCII We WO .ASCIC “o " CR=13 THIS COUNTED ASCII STRING IS EQUIVALENT TO COUNT THE FOLLOWED BY THE ASCII STRING GENERAL ASSEMBLER DIRECTIVES .ASCID +ASCID -- -ASCID performs a string STRING-DESCRIPTOR ASCII The string information, 3) in a the descriptor same function before the STRING as STORAGE ASCII, string DIRECTIVE except that .ASCID descriptor consists of 1) two bytes of two bytes that specify the length of the 2) inserts data. descriptor string, and longword that points to the string. String descriptors are used calling procedures (see Appendix C of the VAX-11/780 Architecture Handbook) . Format .ASCID string Parameter string A delimited ASCII string. Example FOR CALL/ /SECOND ARGUMENT/ we STRING - /ARGUMENT ANOTHER PUSHAL DESCR1 PUSHAL DESCR2 CALLS #2,STRNG_PROC ws .ASCID PUT W .ASCID DESCR2: ON “e DESCR1: CALL DESCRIPTOR ONE ADDRESS THE OF DESCRIPTORS STACK PROCEDURE .ASCIZ +ASCIZ -~ «.ASCIZ performs appends a list need ZERO-TERMINATED ASCII a or null text only determine the same byte as string perform the a end of is the the STORAGE DIRECTIVE function as .ASCII, except that .ASCIZ final character of the string. Thus, when created search STRING for with the an .ASCIZ null directive, character string. the in the last CHARACTERS IN STRING Format .ASCIZ string Parameter string A delimited ASCII string. Example Wy e /A/<FF>/B/ e .ASCIZ /ABCDEF/ W FF=12 .ASCIZ 6 user byte 7 BYTES OF DATA 3 CHARACTERS IN STRINGS 4 BYTES OF DATA to GENERAL ASSEMBLER DIRECTIVES .BLKXx .BLKx -- BLOCK STORAGE ALLOCATION DIRECTIVES VAX-11 MACRO has seven block storage directives: Function Directive (longwords) .BLKA Reserves storage for addresses .BLKB Reserves storage for byte data .BLKD Reserves storage for double-precision, .BLKF Reserves storage for single-precision, .BLKL Reserves storage for longword data .BLKQ Reserves storage for quadword data .BLKW Reserves storage for word data floating-point data floating-point data (quadwords) (longwords) The value Each directive reserves storage for a different data type. VAX-11 which for items data of number the determines expression of the 4 For example, .BLKL 4 reserves storage for MACRO reserves storage. data. of bytes 2 for storage reserves 2 .BLKB longwords of data and The total number of bytes reserved is equal to the length of the type times the value of the expression as follows: Directive Number of Bytes Allocated .BLKB Value of expression « BLKW 2 * yvalue of expression .BLKA .BLKF data 4 * yalue of expression « BLKL +BLKD 8 * value of expression .BLKQ Formats .BLKA .BLKB .BLKD .BLKF .BLKL .BLKQ .BLKW expression expression expression expression expression expression expression Parameter expression An expression specifying the amount of storage to be allocated. All the symbols in the expression must be defined and the expression must be an absolute expression (see Section 3.5). the expression is omitted, a default value of 1 is assumed. 1f GENERAL ASSEMBLER DIRECTIVES 3 « BLKL . BLKF <3*4> N 15 « BLKQ NS W N0 .BLKB w0 Example SPACE SPACE SPACE SPACE FOR 15 BYTES FOR 3 QUADWORDS (24 BYTES) FOR 1 LONGWORD (4 BYTES) FOR 12 SINGLE PRECISION FLOATING-POINT VALUES (48 BYTES) GENERAL ASSEMBLER DIRECTIVES .BYTE -~ BYTE STORAGE DIRECTIVE .BYTE .BYTE generates successive bytes of binary data in the object module. Forma t .BYTE expression-list - Parameter expre ssion-list is Each expression One or more expressions separated by commas. Then the value of each first evaluated as a longword expression. expression The value of each expression is truncated to 1 byte. should be in the range of 0 through 255 for unsigned data or in the range of -128 through +128 for signed data. Each expression optionally can be followed by a repetition factor by a followed expression An brackets. square by delimited format: the has factor repetition expressionl[expression2] expre ssionl An expression that specifies the value to be stored. [expr ession2] will value An expression that specifies the number of times the undefined any contain not must expression The repeated. be 3.5). Section (see expression symbols and must be an absolute required. are The square brackets Example .BYTE .BYTE W <1024-1000>*2 0 X,X+3[5*4],% W4 "XA,FIF,10,65-<21*3> ‘ We .BYTE e .BYTE STORES A VALUE OF 48 STORES 4 BYTES OF DATA STORES 1 BYTE OF DATA STORES 22 BYTES OF DATA Notes The assembler displays an error message if the bytes high-order 3 of the longword expression has a value other than 0 or “XFFFFFF. At link time, a relocatable expression can result in a that exceeds 1 byte. a truncation diagnostic message N A W .BYTE RELOCATABLE VALUE A WILL CAUSE VAX-11 LINKER TRUNCATION DIAGNOSTIC IF THE STATEMENT HAS A VIRTUAL ADDRESS OF 256 OR ABOVE We A: For example: WO question. value the VAX-11l Linker issues in module object the for In this case, N 1. 5-11 GENERAL ASSEMBLER DIRECTIVES The .SIGNED BYTE directive assembler displays range 129 from -SIGNED_BYTE to for 255 more a is the same diagnostic is specified. information. as .BYTE message if See the except a value in description the the of GENERAL ASSEMBLER DIRECTIVES .CROSS .NOCROSS .CROSS AND .NOCROSS -- CROSS-REFERENCE DIRECTIVES ‘'VAX-11 MACRO produces a cross-reference 1listing when the CROSS qualifier is specified in the MACRO command. The .CROSS and .NOCROSS directives control which symbols are included in the cross-reference listing. The .CROSS and .NOCROSS directives have an effect only if /CROSS was specified in the MACRO command (see the VAX-11 MACRO User's Guide). By default, the cross-reference listing includes the definition and all the references to every symbol in the module. The cross-reference listing can be disabled for all symbols or for a specified 1list of symbols. .NOCROSS without a symbol list disables the cross-reference listing of all symbols. .CROSS without a symbol list reenables the cross-reference listing. Any symbol definition or reference that appears after .NOCROSS without a symbol 1list and before the next .CROSS without a symbol list is excluded from the <cross reference listing. 1listing .NOCROSS with a symbol list disables the cross-reference the listed symbols. .CROSS with a symbol 1list reenables cross-reference listing of the listed symbols. for the Formats .CROSS .CROSS symbol-list .NOCROSS .NOCROSS symbol-list Parameter symbol-list A list of legal symbol names separated by commas. Examples LAB1l: . NOCROSS MOVL .CROSS LOC1l,LOC2 : ; ; STOP CROSS REFERENCE COPY DATA REENABLE CROSS REFERENCE The definition of LABl and the references to LOCl included in the cross reference listing. LAB2: .NOCROSS LOC1 ; .CROSS LOC1 ; MOVL LOC1,LOC2 ; ; and LOC2 are not DO NOT CROSS REFERENCE LOCl COPY DATA REENABLE CROSS REFERENCE OF LOC1 The definition of LAB2 and the reference to LOC2 are included in the cross reference, but the reference to LOCl is not included in the cross reference. 5-13 GENERAL ASSEMBLER DIRECTIVES Notes .CROSS without cross-reference with a symbol a symbol 1listing 1list will a symbol of list. If the cross-reference listing .CROSS with a symbol 1list cross-reference symbol listing is 1list. 5~14 not reenable the specified in .NOCROSS of all symbols is disabled, will have no effect until the reenabled by .CROSS without a GENERAL ASSEMBLER DIRECTIVES .DEBUG .DEBUG -- DEBUG SYMBOL ATTRIBUTE DIRECTIVE .DEBUG specifies that the symbols in the list are made known to the During an interactive debugging session, these symbols can debugger. be used to refer to memory locations or to examine the values assigned to the symbols. Format .DEBUG symbol-list Parameter symbol-list A list of legal symbols separated by commas. Example Note = INPUT,OUTPUT, LAB_30,LAB_40 e .DEBUG MAKE THESE SYMBOLS KNOWN TO THE DEBUGGER list to the symbol The assembler adds the symbols in the symbol mmer need not specify The progra table in the object module. global symbols e becaus ive direct global symbols in the .DEBUG table. See symbol 's module object the in put are y ticall automa information making on ation inform the description of .ENABLE for about all symbols available to the debugger. 5-15 GENERAL ASSEMBLER DIRECTIVES .DEFAULT « DEFAULT ~- -DEFAULT determines and DEFAULT CONTROL DIRECTIVE relative the deferred default displacement addressing modes (see length for Sections the 4.2.1 and relative 4.2.2), Format .DEFAULT DISPLACEMENT, keyword Parameter keyword One of three keywords--BYTE, displacement WORD, length. LONG--indicating the default Example .DEFAULT DISPLACEMENT,WORD w9 MOVL LABEL LONG ASSEMBLER WME NE @COUNTS+4 N INCB DISPLACEMENT, LONG Notes l. IS DEFAULT ASSEMBLER USES WORD DISPLACEMENT UNLESS NE .DEFAULT WORD WO Ne we LABEL,R1 HAS IS BEEN DEFINED DEFAULT USES LONGWORD DISPLACEMENT UNLESS COUNTS HAS BEEN DEFINED .DEFAULT has no effect on the default displacement displacement and displacement deferred addressing modes Sections 4.1.6 and 4.1.7). 2. If there is displacement no .DEFAULT length is in a a source longword. module, the for (see default .DISABLE «DISABLE -- -DISABLE See the FUNCTION disables, CONTROL or description DIRECTIVE inhibits, of .ENABLE the for specified more assembler information. functions. Format .DISABLE argument-list Parameter argument-list One or more description of of the of symbolic the specified, they symbolic arguments listed in Table 5-2 in the (ENABLE. Either the long form or the short form arguments can be used. IFf multiple arguments are must be separated by commas, spaces, or tabs. Note The alternate form of .DISABLE is 5-16 .DSABL. GENERAL ASSEMBLER DIRECTIVES .DOUBLE .DOUBLE -- FLOATING POINT STORAGE DIRECTIVE .DOUBLE evaluates the specified floating-point constants stores and .DOUBLE generates 64-bit, in the object module. results the of sign, 8 bits of bit (1 data -point floating , double-precision exponent, and 55 bits of fraction). See the description of .FLOAT for information on storing single precision floating point numbers. Format .DOUBLE literal-list Parameter literal-list The A list of floating-point constants (see Section 3.2.2) . except operators binary or unary any contain constants cannot unary plus or unary minus. .DOUBLE 1. 2. 5, 10, 15, 0, 0.5 W CONSTANT LIST - .DOUBLE 1000,1.0E3,1.0000000E-9 .DOUBLE 3.1415928, 1.107153423828 WO Example Double precision floating point numbers are They are not effected by .ENABLE TRUNCATION. always rounded. The floating point constants in the literal 1list must not preceded by the floating point operator ("F). be GENERAL ASSEMBLER DIRECTIVES .ENABLE +-ENABLE -- -ENABLE enables negative form, FUNCTION CONTROL DIRECTIVE the specified .DISABLE, ® Creating e Making all enabling the @ Specifying references. e local Truncating assembly control label the 1local symbols available traceback feature. that or wundefined rounding Suppressing the referenced. @ Specifying that listing all .ENABLE assembler and its functions. blocks. PC symbol of numbers. ® function. following of to the references single-precision, symbols references debugger that are are are and external floating-point defined but not absolute not relative. 1listed in Table Format .ENABLE argument-list Parameter argument-~list One or Either can If be more the symbolic form or used. multiple commas, of the long arguments spaces, or the are arguments short specified, Long Form ABSOLUTE the symbolic they must be 5-2. arguments separated tabs. Table -ENABLE form of and .DISABLE 5-2 Symbolic Arguments Default Short AMA Form Condition Disabled Function When ABSOLUTE is enabled, all PC relative addressing modes are assembled as absolute DEBUG DBG Disabled When addressing DEBUG is local symbols in the object symbol the table enabled, all are included module's for use on next debugger. (continued modes. by page) by GENERAL ASSEMBLER DIRECTIVES Table .ENABLE and 5-2 (Cont.) .DISABLE Symbolic Arguments Default Long Form GLOBAL Short Form GBL Condition Function Enabled When GLOBAL is enabled, all undefined symbols are considered external When GLOBAL is symbols. disabled, any undefined symbol that is not listed in a .EXTERNAL directive causes LOCAL_BLOCK LSB Disabled an assembly error. When LOCAL BLOCK is enabled, the current local label block is ended and a When new one is started. LOCAL BLOCK is disabled, the current local label See block is ended. Section 3.4 for a complete description of local label blocks. SUPPRESSION SUP Disabled When SUPPRESSION is enabled, all symbols that are defined but not referred to are not listed When in the symbol table. SUPPRESSION is disabled, all symbols that are defined are listed in the symbol TRACEBACK TBK Enabled table. When TRACEBACK is enabled, the program section names and lengths, module names, and routine names are the debugger. included in the object module for use by the When TRACEBACK debugger. is disabled, VAX-11 MACRO excludes this information and, in addition, does not make any local symbol information available to TRUNCATION FPT Disabled When TRUNCATION is enabled, floating-point numbers are truncated. When TRUNCATION is disabled, floating-point numbers are rounded. GENERAL ASSEMBLER DIRECTIVES o We TRUNCATION,TRACEBACK ASSEMBLE AS -e GLOBAL UNDEFINED ROUND DO NOT ~y .DISABLE ABSOLUTE, we .ENABLE we Example alternate form of .ENABLE is ADDRESS MODE. REFERENCES ARE FLOATING-POINT MODE GLOBAL NUMBERS. PUT ANY DEBUGGING INFORMATION INTO OBJECT MODULE Note The RELATIVE ADDRESS ABSOLUTE .ENABL. GENERAL ASSEMBLER DIRECTIVES .END .END -- ASSEMBLY TERMINATION DIRECTIVE .END terminates the source program. No additional text should occur beyond this point in the current source file or in any additional If any source files specified in the command line for this assembly. message error an displays assembler the occur, does text additional and ignores the text. The additional text does not appear in either the listing file or the object file. Format <END [symbol] Parameter symbol (called The address execution is to begin. the transfer address) at program which Example .ENTRY . START,O .END START ; ENTRY MASK ; MAIN PROGRAM section that has 1. The transfer address must be in a program 2. When an executable image consisting of séveral object modules is 1linked, only one object module should be terminated by an .END directive that specifies a transfer address. All other object modules should be terminated by .END directives that If an executable image do not specify a transfer address. contains more than one or address transfer no either contains the EXE attribute transfer address, (see the description of .PSECT). the VAX-11 Linker displays error an message. 3. If the source program contains an unterminated conditional block when the .END directive 1is specified, the code assembler displays an error message. .ENDC .ENDC -~ END CONDITIONAL DIRECTIVE .ENDC terminates the description of Format . ENDC conditional range started by .IF for more information and examples. .IF. See the GENERAL ASSEMBLER DIRECTIVES .ENTRY +-ENTRY -- ENTRY DIRECTIVE .ENTRY defines a symbolic name register save mask (2 bytes) at as a global counter at symbol with a value equal to the .ENTRY directive. The entry the transfer address of the program. determine which registers are These saved returns registers are control procedure call for an entry that location. point and symbol The value of point can stores a is defined the be 1location used as the The register save mask is used to saved before the procedure is called. automatically restored when the procedure to the calling program. See the description of the instructions in the VAX-11/780 Architecture Handbook. Format «ENTRY symbol ,expression Parameter symbol The symbolic name for the entry point. expression The register save mask for the entry point. be an absolute expression and must not symbols. The expression must contain any undefined Example CALC, "M<R2,R3,R7> l. The register setting the 3.6.2.2). 2. An STARTS 2,3,7 We Notes PROCEDURE REGISTERS PRESERVED ®e Wwe .ENTRY RET HERE. ARE BY CALL AND INSTRUCTIONS mask operator ("M) is convenient bits in the register save mask to use for (see Section assembly error occurs if the expression has bits o, 1, 13 set. These bits correspond to the registers RO, AP, and FP and are reserved for the CALL interface. or 3. DIGITAL recommends that .ENTRY be used entry points including the transfer Although the following construct also its use is discouraged: symbol:: Although a .WORD procedure called, the registers and to define address defines of an all 12, Rl, callable the program. entry point, expression starting with entry mask is not the symbol cannot be this construct checked used in a can be for any illegal .MASK directive. GENERAL ASSEMBLER DIRECTIVES .ENTRY should be used only for procedures that will be called A routine that is entered by the CALLS or CALLG instruction. .ENTRY because by the BSB or JSB instruction should not use These these instructions do not expect a register save mask. routines should begin in the following format: symbol:: first instruction The first instruction of the routine immediately follows symbol. the GERERAL ASSEMBLER DIRECTIVES .ERROR «ERROR --ERROR ERROR DIRECTIVE causes terminal or the batch assembler log file to and display in the an error listing file message (if there .ERROR is the on is one). Format .ERROR [expression] ; comment Parameters expression An expression whose during ; value assembly. is displayed when encountered comment A comment that assembly. The is displayed comment when must be .ERROR preceded is by a encountered during semicolon. Example .IF DEFINED LONG‘MESS «IF GREATER lOOO-WORK_AREA -ERROR 25 ; NEED LARGER WORK_AREA . ENDC « ENDC If the symbol value of 1000 LONG_MESS or less, $MACRO-E-GENERR, is the defined and if the symbol WORK_AREA has following error message is displayed: Generated ERROR: 25 NEED a LARGER WORK_AREA Notes 1. .ERROR, .WARN, directives. indicating set of that and .PRINT They can a macro call coenditions (see macre calls). 2. When the total assembly is number of are called the message display be uséd to display information contains an error Chapter finished, errors and 6 the warnings for more the 3. 1If and included in a maéro library illegal displays sequence warnings. -ERROR is an information on assembler and of the lines causing the errors or warnings on See the VAX-1l1 MACRO User"s Guide for moré errors or the numbers the terminal. information on (see the VAX-11 MACRO User's Guide), the comment should end with an additional semicolon. ©Otherwise, the librarian will strip the comment from the directive and it will not be displayed when the macro is called. 4. 5. The the line contaihing listihg file. the .ERROR directive If the expression has a value of the error message. 5-24 0, it is is not included in not ‘displayed in GENERAL ASSEMBLER DIRECTIVES .EVEN .EVEN -- EVEN LOCATION COUNTER ALIGNMENT DIRECTIVE .EVEN ensures that the current value of the location counter by 1 adding already even, if the current value is odd. no action is taken. is even If the current value is Format .EVEN .EXTERNAL .EXTERNAL -- EXTERNAL SYMBOL ATTRIBUTE DIRECTIVE .EXTERNAL indicates that specified symbols are external; that is, the symbols are defined in another object module and cannot be defined until link time (see Section 3.3.3). Format .EXTERNAL symbol-list Parameter symbol-list A list of legal symbols separated by commas. Example . EXTERNAL . EXTERNAL SIN,TAN,COS SINH,COSH,TANH ; THESE SYMBOLS ARE DEFINED IN ; EXTERNALLY ASSEMBLED MODULES Notes 1. If the GLOBAL arqument is enabled (see Table 5-2 in the description of .ENABLE), all unresolved references will be marked as global and external. Thus, if GLOBAL 1is endbled, However, if the programmer need not specify .EXTERNAL. GLOBAL is disabled, the programmer must explicitly specify .EXTERNAL, to declare any symbols that are defined externally but referred to in the currént module. 2. If GLOBAL is disabled and the assembler finds symbols that are not defined in the currént module and are not listed in a .EXTERNAL directive, the assembler displays an error message. 3. The alternate form of .EXTERNAL is .EXTRN. GENERAL ASSEMBLER DIRECTIVES .FLOAT «FLOAT -- -FLOAT evaluates results in FLOATING-POINT the specified the object single-precision, exponent, and description of floating-point STORAGE DIRECTIVE floating-point module. constants . FLOAT and stores generates the 32-bit, floating-point data (1 bit of sign, 8 bits of 23 bits of fractional significance). See the .DOUBLE for information on storing double-precision numbers. Format .FLOAT literal-list Parameter literal-list A list of floating-point constants cannot unary and plus constants contain unary any (see unary or Section binary 3.2.2). operators minus. The except Example .FLOAT 134.5782,74218.34E20 +FLOAT 134.2,0.1342E3,1342E-1 +FLOAT .FLOAT -0.75,1E38,-1.0E-37 0,25,50 ; SINGLE ; THESE ; DATA ; LIST PRECISION ALL GENERATE 134.2 Notes l. 2. See the description of .ENABLE for information floating-point rounding or truncation. The floating preceded by point the constants floating in point 5-26 the unary literal on list operator specifying must (°F). not be GENERAL ASSEMBLER DIRECTIVES .GLOBAL «.GLOBAL -~ GLOBAL SYMBOL ATTRIBUTE DIRECTIVE names are either globally .GLOBAL indicates that specified symbol defined 1in the current module or externally defined in another module (see Section 3.3.3). Format .GLOBAL symbol-list Parameter symbol-list A list of legal symbol names separated by commas. Example .GLOBAL LAB_40,LAB_30 ; MAKE THESE SYMBOL NAMES .GLOBAL UKN_13 ; TO ALL LINKED MODULES s GLOBALLY KNOWN Notes 1. DIGITAL .GLOBAL is provided for MACRO-11 compatibility only. that global definitions be specified by a double recommends and 3.8) colon or double equals sign (see Section 2.2.1 and by .EXTERNAL (when specified references be external that necessary). 2. The alternate form of .GLOBAL is 5-27 .GLOBL. GENERAL ASSEMBLER DIRECTIVES JADENT «IDENT -~ - IDENT provides IDERTIFICATION DIRECTIVE identification a means is in of identifying addition to the the object module. name assigned module with .TITLE. A character string can be specified label the object module. This string is printed in the listing file as well as appearing in the object module. to This the object in .IDENT to header of the Format . IDENT string Parameter string A 1- to 1l5-character string that identifies the module, such as a string that specifies a version number. The string must be delimited. The delimiters can be any paired printing characters, other long than as string the 1left delimiting the angle bracket (<) character is not itself. or the semicolon (:), as contained in the text Example .IDENT The character /3-47/ string ;7 3-47 is included in VERSION AND the object EDIT NUMBERS module. Notes l. If one source directive part 2. of the module given contains establishes object module more the than one character .IDENT, the string 1last that forms identification. 1If the delimiting characters do not match, or if an delimiting character is used, the assembler displays message. illegal an error GENERAL ASSEMBLER DIRECTIVES AF ~ «IF -- CONDITIONAL ASSEMBLY BLOCK DIRECTIVES A conditional assembly block is a series of source statements that is assembled only if a certain condition is met. .IF starts the conditional block and .ENDC ends the conditional block. Each .IF must have a corresponding .ENDC. The .IF directive contains a condition test and one or two arguments. The condition test specified Iis applied to the argument(s). If the test is met, all MACRO statements between .IF and .ENDC are assembled. If the test 1is not met, the statements are not assembled. An exception to this occurs when subconditional directives are used (see the description of .IF_x directive). Conditional blocks can be nested, that is a conditional block <can be inside of another conditional block. 1In this case the statements in the inner conditional block are assembled only if the condition is met for both the outer and inner block. Format .IF condition argument (s) «ENDC Parameters condition A specified condition that must be met if the block 1is to be included in the assembly. Table 5«3 lists the conditions that can be tested by the conditional assembly directives. The condition space, or must tab. be separated from the argument(s) by a comma, argument (s) The symbolic argument(s) or expression(s) of the specified conditional test, If the argument is an expression, it cannot contain any undefined symbols and must be an absolute expression (see Section 3.5). range The block of source code that is conditionally assembly. 5-29 included in the GENERAL ASSEMBLER DIRECTIVES Table Condition Condition Tests for 5-3 Conditional Assembly Complement Test Condition Test Argument Type Number Directives of | Condition that Arguments | Assembles Block —{ Long Short | Long Short Form Form Form Form EQUAL EQ NOT_EQUAL NE Expression 1 Expression 0 GREATER GT LESS_EQUAL LE Expression 1 (or not is equal equal Expression is to greater than 0 (or less or egqual to 0) LESS_THAN LT GREATER_EQUAL GE Expression 1 Expression is to 0) than less than 0 (or greater than or equal to 0) DEFINED DF NOT DEFINED NDF Symbolic 1 Symbol - is defined (or not defined) BLANK* B NOT BLANK* NB Macro 1 Argument IDENTICAL* IDN BIFFERENT* DIF Macro 2 Arguments - nonblank) is blank (or are identical (or different) * The BLANK, NOT BLANK, IDENTICAL, and DIFFERENT conditions are only useful in macro definitions. Chapter 6 describes macro directives in detail. Examples example .IF EQUAL of a conditional ALPHA+1 assembly directive wo An ASSEMBLE s 1. DO BLOCK IF ALPHA+1=0 NOT ASSEMBLE « ENDC Nested conditional . IF condition,argument (s) condition,argument (s) .IF directives « ENDC . ENDC 5-30 take the is: form: IF ALPHA+1l NOT=0 GENERAL ASSEMBLER DIRECTIVES 3. The following assembly .IF .IF is DEFINED DEFINED conditional directives to occur: can govern whether SYM1 SYM2 . ENDC . ENDC In this example, if the outermost condition is not satisfied, no deeper level of evaluation of nested conditional statements within the program occurs. Therefore, both SYM1 and SYM2 must be defined for the code to be assembled. Notes 1. If .ENDC occurs outside a assembler 2. displays an error assembly block, the message. VAX-1ll MACRO permits a nesting depth of 31 conditional assembly levels. If a statement attempts to exceed this nesting level depth, 3. conditional the assembler displays an error message. The assembler displays an error message if .IF specifies any of the following: a condition test other than those in Table 5-3, an illegal argument, or a null argument specified in an .IF directive. 4. The .SHOW and .NOSHOW directives control whether condition blocks that are not assembled are included in the listing file. 5-31 GENERAL ASSEMBLER DIRECTIVES JF_Xx «IF_x —- VAX-11 SUBCONDITIONAL ASSEMBLY BLOCK MACRO has three subconditional DIRECTIVES assembly Directive block directives: Function .IF_FALSE If the condition of the assehbly false, the program is to include following the .IF FALSE directive .IF_TRUE up to the next subconditional end of If the the conditional condition the program following the to the next of -IF_TRUE_FALSE - the Always of assembly subconditional include block the and tests directive or source to the code true, source code continuing up to assembly block. the tests source code continuing block. is to include .IF TRUE directive conditional block directive or assembly the the and the end following the .IF_TRUE FALSE directive and continuing up to the next subconditional directive or to the end of the conditional assembly block. This source code included regardless of whether the condition the assembly block tests true or false. The implied is of argument test specified conditional or assembly block in the block is of a subconditional directive is the condition when the conditional assembly block was entered. A subconditional directive in a nested conditional is not evaluated if the preceding (or outer) condition not satisfied (see examples 3 and 4 below). A conditional a nested the inner directive block with a subconditional directive is different than conditional block. 1If the condition in the .IF is not met, conditional block(s) are not assembled, but a subconditional can cause a block to be assembled. Formats .IF_FALSE . IF_TRUE . IF_TRUE_FALSE Examples Assume SYM is defined: SYM we DEFINED symbol TESTS “-e . IF that ASSEMBLES ; TESTS . ;7 .IF . ; ASSEMBLE .IF_TRUE 5-32 SINCE THE FALSE WAS TESTS ASSEMBLES THE TRUE. SYM IS FOLLOWING SINCE TRUE. o - IF_FALSE TRUE -e l. DO SYM CODE. PREVIOUS NOT FOLLOWING THE DEFINED. IS CODE. DEFINED. FOLLOWING CODE. \ e FOLLOWING TRUE. SYM IS CODE “wo UNCONDITIONALLY. TESTS We .IF_TRUE ASSEMBLES ASSEMBLES - .IF_TRUE_FALSE -y GENERAL ASSEMBLER DIRECTIVES DEFINED. CONDITIONAL ASSEMBLY BLOCK. REMAINDER OF . ENDC W TESTS Wy .IF_TRUE symbol TESTS WO .IF_FALSE that DEFINED. N Y and TESTS WO X DEFINED defined DEFINED. " DEFINED .IF is ASSEMBLES “§ .IF X TESTS we symbol DEFINED. We that DOES N0 Assume CODE. TRUE. FALSE. TRUE. Y is SYMBOL SYMBOL FALSE. defined: IS DEFINED. X SYMBOL THE not Y Y IS IS FOLLOWING SYMBOL NOT ASSEMBLE Y THE NOT NOT CODE. IS NOT FOLLOWING « ENDC « ENDC defined .IF_FALSE .IF NOT_DEFINED B that symbol W A and TESTS e is ASSEMBLES TRUE. B A IS THE FALSE. is not A defined: DEFINED. FOLLOWING “wo A TESTS - DEFINED symbol NOT ASSEMBLE we .IF that NESTED CONDITIONAL .o Assume IS IS NOT EVALUATED. defined but symbol THE CODE. DEFINED. DOES FOLLOWING CODE. DIRECTIVE . ENDC .IF_FALSE W TESTS DEFINED. FALSE. Y is DOES FOLLOWING NOT ASSEMBLE NESTED CONDITIONAL IS EVALUATED. NOT NESTED DIRECTIVE defined: SYMBOL WMo not N Y is We DEFINED X X Ne .IF DEFINED symbol wo .IF that e Assume WE . ENDC X IS NOT THE CODE. DIRECTIVE SUBCONDITIONAL IS NOT EVALUATED. GENERAL ASSEMBLER DIRECTIVES -IF_TRUE . ; NESTED ; DIRECTIVE SUBCONDITIONAL IS NOT EVALUATED. a conditional «ENDC . ENDC If a subconditional assembly block, The the alternate .IF_TRUE_FALSE directive appears outside assembler displays forms are .IFF, an of .IF_FALSE, .IFT, and 5-34 .IFTF. error message. .IF_TRUE, and GENERAL ASSEMBLER DIRECTIVES AIF «IIF —-- IMMEDIATE CONDITIONAL ASSEMBLY BLOCK DIRECTIVE .IIF provides a means of writing a one-line conditional assembly block. The condition to be tested and the conditional assembly block are expressed completely within the 1line containing the .IIF directive; no terminating .ENDC statement is required. Format .IIF condition argument(s), statement Parameters condition One of blocks must the in be legal Table condition tests defined for 5-3 (See the description of separated from the argument(s) by a conditional assembly .IF). The condition comma, space, or tab. argument (s) The argument associated with the immediate conditional directive; that 1is, an expression or symbolic argument (described in Table 5-3). If the argument is an expression, it cannot contain any undefined symbols and must be an absolute expression (see Section 3.3.3). The argument (s) must be separated from the statement by a comma. statement The statement to be assembled if the condition is satisfied. Example Condition .IIF Argument DEFINED EXAM, Statement BEQL This directive generates the following defined within the source program: BEQL ALPHA code if the symbol EXAM is ALPHA Note The assembler displays an error message if .IIF specifies any of the following: a condition test other than those listed in Table 5-3, an illegal argument, or a null argument. GENERAL ASSEMBLER DIRECTIVES LIST +LIST -- LISTING DIRECTIVE .LIST is equivalent more information. to the .SHOW. See the description of .SHOW for Formats . LIST .LIST argument-list Parameter argument-list One or more of the symbolic argument defined in Table 5-7 description of .SHOW. Either the long form or the short the arguments can be used. 1If multiple arguments are they must be separated by commas, spaces, or tabs. 5-36 in the form of specified, GENERAL ASSEMBLER DIRECTIVES .LONG « LONG -- LONGWORD STORAGE .LONG generates DIRECTIVE successive longwords of data in the object module. Format .LONG expression-list Parameters expression-list One or more optionally sguare expressions separated by commas. Each expression can be followed by a repetition factor delimited by brackets. An expression followed by a repetition factor has the format: expressionl [expression2] expressionl An expression that specifies the value to be stored. [expression2] An expression that specifies the number of times the value will be repeated. The expression must not contain any undefined symbols and must be an absolute expression (see Section 3.5). The square brackets are required. LAB 3, "X7FFFFFFF, “XF@4 .LONG 0[22] A'ABCD' we .LONG .LONG 3 LONGWORDS OF DATA Wy LAB_3: 1 LONGWORD e Example 22 OF DATA LONGWORDS OF DATA a that Note Each expression in the represented in 32 bits. 1list must have value can be GENERAL ASSEMBLER DIRECTIVES .MASK «MASK —-= MASK +-MASK reserves DIRECTIVE word for See the description example of .MASK. a of a register save .TRANSFER for mask more for a transfer information and vector. for an Format .MASK symbol [,expression] Parameters symbo 1 A symbol defined in an .ENTRY directive. expre ssion A register save mask. Notes 1. If .MASK does not contain an expression, the assembler directs the 1linker to copy the register save mask specified in .ENTRY to the word reserved by .MASK. If .MASK contains an expression, the assembler directs the linker to combine this expression with the register save mask specified in .ENTRY and store the result in the word reserved by .MASK. The linker performs an inclusive OR operation to combine the mask in the entry point and the value of the expression. Consequently, a register specified in either be included in the combined mask. See for more information on entry masks. the .ENTRY or .MASK will description of .ENTRY .NLIST +«NLIST -- LISTING DIRECTIVE .NLIST is equivalent information. to .NOSHOW. See the description of .SHOW for more Formats «NLIST .NLIST argument-list Parameter argument-list One or more description of of the symbolic .SHOW. arguments Either the listed long in form or Table the the arguments can be used. If multiple arguments are they must be separated by commas, spaces, or tabs. 5-38 5-7 short in the form of specified, GENERAL ASSEMBLER DIRECTIVES .NOCROSS .NOCROSS -- CROSS REFERENCE DIRECTIVE VAX-11 MACRO produces a cross-reference listing when the CROSS qualifier is specified in the MACRO command. The .CROSS and .NOCROSS directives control which symbols are included in the cross-reference listing. of .CROSS. The description of .NOCROSS is included with the description .NOSHOW .NOSHOW -- LISTING DIRECTIVE .NOSHOW specifies listing control options. .SHOW for more information. See the description of Formats . SHOW .SHOW argument-list ‘Parameter argument-list One or more of the symbolic arguments listed in Table 5-7 in the description of .SHOW. Either the long form or the short form of the arguments can be used. If multiple arguments are specified, they must be separated by commas, spaces, or tabs. .ODD .ODD -~ ODD LOCATION COUNTER ALIGNMENT DIRECTIVE .ODD ensures that the current value of the location counter is odd by adding 1 if the current value is even. If the current value is already odd, no action is taken. Format .ODD 5-39 GENERAL ASSEMBLER DIRECTIVES .OPDEF «OPDEF ~-- OPCODE -OPDEF defines table. The permanent opcode DEFINITION DIRECTIVE an opcode, which it assembler searches symbol name or table. create a This new inserts this into a user-defined table directive before can it redefine opcode searches the an one. existing Format .OPDEF opcode value,operand-descriptor-list Parameters opcode An ASCII can be string up through Z; not the characters 15 the digits underline should specifying to delimiters. 0 (), _ dollar start with name of long and through sign a digit the can 9; and ($), and and opcode. contain the should The string the letters A special period not (.). be characters The string surrounded by opcode. The value An expression expression absolute that must specifies not expression expression (hexadecimal must contain (see be in FFFF). the any value of the undefined values Section the 3.5). of 0 range and must be The value of through decimal an the 65535 operand-descriptor-list A list of operands allowed operand and in the the descriptors type list. of each. Table 5-4 tnat specifies Up the 16 number of descriptors are to lists the operand operand descriptors. Table 5-4 Operand Descriptors Data Access Byte Word Type Type Long- Floating| Double word Point Floating | word Quad- Point Address AB AW AL AF AD AQ Read-only RB RW RL RF RD RQ Modify MB MW ML MF MD MQ Write-only WB WW WL WF WD WQ Field VB VW VL VF VD vVQ Branch BB BW - - - - GENERAL ASSEMBLER DIRECTIVES Examples .OPDEF .OPDEF .OPDEF .OPDEF MOVL3 DIVF2 MOVC5 CALL “XFFA9,RL,ML,WL ; ; : DEFINES AN INSTRUCTION, MOVL3, WHICH USES THE RESERVED OPCODE FF. ; REDEFINES THE DIVF2 AND “X46 ,RF,MF ; MOVC5 INSTRUCTIONS. *+ “X2C,RW,AB,AB,RW,AB ~“X10,BB :+ EQUIVALENT TO A BSBB Notes 1. (see the A macro can also be used to redefine an opcode Note that the macro .MACRO in Chapter 6). description of name table is searched before the user-defined opcode table. 2. 1in .OPDEF is useful execute user-written that instructions "custom" creating Note that DIGITAL does not microcode. This support or provide tools for wuser-written microcode. directive is supplied to allow programmers who have developed tools and written microcode to execute their microcode in a MACRO program. 3. to The operand descriptors are specified in a format similar the operand specifier notation described in the VAX-11/780 The first character specifies the Architecture Handbook. operand access type and the second character specifies the operand data type. GENERAL ASSEMBLER DIRECTIVES .PACKED « PACKED -- PACKED DECIMAL STRING STORAGE - PACKED generates packed decimal data, DIRECTIVE 2 digits per byte. Packed decimal data is wuseful in calculations requiring exact accuracy. Packed decimal data is operated on by the decimal string instructions. See the VAX-11/780 Architecture Handbook for more information on the format of packed decimal data. Format +PACKED decimal-string[,symbol] Parameters decimal-string A decimal number from 0 through g%g?é).Each digit can be in the 31 digits long with an optional range of 0.through 9 (see Section symbol An optional number as a of symbol decimal that is digits assigned in the digit. a value string. The equivalent to sign counted is not the Example . PACKED -12,PACK_SIZE - PACKED +500 .PACKED 0 -O,SUM_SIZE . PACKED «PAGE -- .PAGE forces PAGE EJECTION a new page printed in the listing. VAX-11 MACRO ignores operation describes Format . PAGE ; PACK_SIZE GETS VALUE OF : SUM_SIZE GETS VALUE OF 2 1 DIRECTIVE in the .PAGE is performed only macro directives and listing; in a the macro directive itself definition. during macro expansion. facilities in detail. The is not paging Chapter 6 GENERAL ASSEMBLER DIRECTIVES .PRINT « PRINT -- ASSEMBLY MESSAGE DIRECTIVE .PRINT causes the assembler to display an informational message. The message consists of the value of the expression and the comment the on The message is displayed specified in the .PRINT directive. The terminal for interactive jobs and in the log file for batch jobs. message produced by .PRINT is not considered an error or warning message. Format .PRINT [expression] ;comment Parameters expression An expression whose value is displayed when .PRINT is encountered during assembly. comment A comment that is displayed when assembly. .PRINT is encountered during The comment must be preceded by a semicolon. Example .PRINT ; 2 THE SINE ROUTINE HAS BEEN CHANGED Notes 1. the message display .PRINT, .ERROR, and .WARN are called information to display used can be They directives. illegal indicating that a macro call contains an error or an 6 for more information on Chapter (See conditions of set macro calls). 2. VAX-11 the (see library If .PRINT is included in a macro an the comment should end with Guide), User's MACRO be will the comment Otherwise, semicolon. additional stripped the macro 3. from the directive and will not be displayed when is called. If the expression has a value of 0, it is not displayed the message. 5-43 with GENERAL ASSEMBLER DIRECTIVES .PSECT « PSECT ~- PROGRAM .PSECT defines SECTIONING a program section program section once it is Program sections can be used ® Develop ® Separate @ Allow ® Protect read-only @ Identify sections ® See the When name, Control the memory attributes assembler section attributes, includes all and data and modules data to and of the in which User's access it object If of module program for to a of instructions new the that the assembler encounters a previously defined so being the a more modified debugger sections are stored information program that and program section. follow the on specifies section 0. instructions to data from .PSECT directive creates alignment same instructions Guide a the that program section until it encounters another The assembler starts all program sections at a relocatable refers from data encounters name, and programs order MACRO its to: instructions virtual and defined. sections. the program modular different VAX-1l program DIRECTIVE using a stores The 1in new the assembler .PSECT directive in .PSECT directive. location counter of a .PSECT directive that specifies the name »>rogram section, it stores the new data or that they lcgically follow the 1last entry in the previously defined program section. Specifically, the 1location counter is set to the value of the location counter at the end of the previously defined program section. The programmer need not list the attributes when continuing a program section but any attributes that are listed must be the same as those previously listed for the program section. The assembler automatically absolute program section and Any symbol -PSECT definitions directive defines two program the unnamed (or blank) that sections: program the section. appear before any instruction, data, placed in: the absolute program section. are or Any instructions or data that appear before the first named program section is defined are placed in the unnamed program section. Any -PSECT directive that does not include a program section name specifies the unnamed program section. A maximum of The 254 attributes contents ensure of that attributes However, user-defined, listed the the in the program contents of assembler and program .PSECT section. the program the 1linker listed. the named sections directive The do does actually check sections with the same name have exactly the assembler and linker display an error message if attributes are not consistent. 5-44 only assembler section can that be defined. describe not check include all the to the program same attributes. The the program section GENERAL ASSEMBLER DIRECTIVES Program section names are independent of local symbol, global symbol, and macro names. Thus, the same symbolic name can be used for a program section and for a local symbol, global symbol, or macro name. Formats .PSECT .PSECT program-section-name{,argument-list] Parameters program-section-name The name of the program section. This name can be up to 15 characters 1long and can contain any alphanumeric character and the underline ( ), dollar sign ($), and period (.) characters. However, the first character must not be a digit in the range of 0 through 9. argument-list A list containing the program section attributes and the program section alignment. Table 5-5 1lists the attributes and their functions. Table 5-6 lists the default attributes and their opposites. Program sections are aligned when an integer in the range of 0 through 9 is specified or when one of the five keywords 1listed below is specified. If an integer is specified, the program section is 1linked to begin at the next wvirtual address that 1is a multiple of 2 raised to the power of the integer. If a keyword 1is specified, the program section is linked to begin at the next virtual address that is a multiple of listed below: DN ~ BYTE WORD LONG QUAD PAGE BYTE is the ~ ”~ ~ ~ (in Bytes) 0100 Size WWhHHO Keyword nununn the values default. Table 5-5 Program Section Attributes Attribute Function Name ABS Absolute--The linker assigns the program section an absolute address. The contents of the program section can be only symbol definitions (usually definitions of symbolic offsets to data structures that are used by the routines being assembled). An absolute program section contributes no binary code to the image, so its byte allocation request to the linker is 0. The size of the data structure being defined is the size of the absolute program section printed 1in the "program section synopsis" at the end of the listing. Compare this attribute with its opposite, REL. (continued on next page) 5-45 GENERAL ASSEMBLER DIRECTIVES Table 5-5 (Cont.) Program Section Attributes Attribute Function Name | CON Concatenate--Program sections with the same name and attributes (including CON) are merged into one program section. Their contents are merged in the order 1in which the linker acquires them. The allocated virtual address space is the sum of the individual requested allocations. EXE Executable--The program section contains instructions. This attribute provides the capability of separating instructions from read-only and read/write data. The linker uses this attribute 1in gathering program sections and in verifying that the transfer address is in an executable program section. GBL Global--Program sections that have the same name attributes, including GBL and OVR, will have the relocatable address sections are in Linker Reference clusters). This in memory even when the LCL LCL. Local--The cluster. GBL. program section 1is restricted Compare this attribute with its LIB Library Segment--Reserved NOEXE Not Executable--The it does NOPIC program different clusters (see the VAX-1l1l Manual for more information on attribute is specified for FORTRAN COMMON block program sections (see the VAX-1l IV-PLUS User's Guide). Compare this attribute opposite, and same not contain for program future section contains Content--The is assigned to a fixed location it is in a shareable image). its to its opposite, use. instructions. Non-Position-Independent FORTRAN with data program in virtual only; section memory (when NORD Nonreadable-~Reserved NOSHR No Share--The program section is reserved for private use at execution time by the initiating process. NOWRT Nonwritable--The program section's contents altered (written into) at execution time. OVR Overlay--Program attributes, for future sections including base OVR, use. with have the the same same cannot name be and relocatable address in memory. The allocated virtual address space 1is the requested allocation of the largest overlaying program section. Compare this attribute with its opposite, CON. (continued on next page) GENERAL ASSEMBLER DIRECTIVES Table 5-5 (Cont.) Program Section Attributes Function Attribute Name can Position~Independent Content--The program section can be assigned to any it is, that relocated; be memory area (when it is in a shareable image). PIC future use. RD Readable--Reserved for REL Relocatable--The linker assigns the program section a The contents of the program base address. relocatable attribute this Compare section can be code or data. with its opposite, ABS. Share--The program section can be shared at execution This attribute is assigned time by multiple processes. into a to a program section that can be linked SHR shareable image. USR User Segment-~Reserved for future use. WRT Write--The program section's contents (written into) Default at execution time. Table can be altered 5-6 Program Section Attributes Attribute Opposite Attribute CON OVR EXE NOEXE GBL PIC Default LCL NOPIC RD SHR NORD REL ABS WRT NOWRT NOSHR CODE, NOWRT, EXE, LONG . PSECT RWDATA ,WRT,NOEXE, QUAD -8 “eo - . PSECT w0 Examples PROGRAM SECTION TO CONTAIN EXECUTABLE CODE PROGRAM SECTION TO CONTAIN DATA MODIFIABLE GENERAL ASSEMBLER DIRECTIVES Notes The .ALIGN directive cannot specify an alignment greater than that of the current program section; consequently, .PSECT should specify the largest alignment needed in the program section. For efficiency of execution, an alignment of longword or larger is recommended for all program sections that have longword data. The attributes of the default unnamed program sections program section names are absolute and the default 1listed below. Note include that the periods and enclosed Attributes and Alignment the spaces. Program Section Name . ABS . NOPIC,USR,CON,ABS,LCL,NOSHR,NOEXE,NORD, NOWRT,BYTE . BLANK . NOPIC,USR,CON,REL,LCL,NOSHR,NOEXE,RD,WRT,BYTE GENERAL ASSEMBLER DIRECTIVES .QUAD .QUAD -- QUADWORD STORAGE DIRECTIVE .QUAD generates 64 bits (8 bytes) of binary data. Format .QUAD literal .QUAD symbol Parameters literal Any constant value. This value can be preceded by “o, "B, "X, or hexadecimal, or “A to specify Decimal is the default radix. “D to specify the radix as octal, binary, decimal, respectively; or it can be preceded by the ASCII text operator. symbol A symbol defined somewhere in the program. This symbol results in a sign-extended, 32-bit value being stored in a quadword. Example . QUAD “A'..ASK?..' :+ EACH ASCII CHARACTER IS STORED .QUAD 0 ; QUAD 0 . QUAD . QUAD . QUAD “X0123456789ABCDEF “B1111000111001101 LABEL ; IN A BYTE ; QUAD HEX VALUE SPECIFIED ; QUAD HEX VALUE SPECIFIED : LABEL HAS A 32 BIT ; VALUE ZERO EXTENDED. Note (.BYTE, .QUAD is different from other data storage directives in that it does not evaluate expressions and .LONG) .WORD, and It does not accept a list. that it accepts only one value. GENERAL ASSEMBLER DIRECTIVES -REFn +REFn -- OPERAND GENERATION DIRECTIVES VAX-11 MACRO Chapter 6) has to four define operand storage new opcodes: directives used Directive Function REF1 Generates a byte operand REF2 Generates a word operand REF4 Generates a longword operand REF8 Generates a quadword operand -REFn is provided provides greater consequently, in macros for compatibility with VAX-11 MACRO VI1.0. functionality and is easier to use than .OPDEF should be used instead of (see .OPDEF .REFn; .REFn. Formats .REF1 operand .REF2 operand .REF4 operand .REF8 operand Parameter operand An operand of byte, +.MACRO MOVL3 .BYTE A,B,C “XFF, "XA9 respectively. word, longword, or quadword context, Example .REF4 A .REF4 B ; THIS OPERAND HAS s THIS OPERAND HAS 's THIS OPERAND HAS .REF4 C .ENDM MOVL3 MOVL3 R0, @LAB-1 (R7) +[R10] , LONGWORD CONTEXT LONGWORD CONTEXT LONGWORD CONTEXT This example uses .REF4 to create a new instruction, MOVL3, which uses the reserved opcode FF. See the example in .OPDEF for a preferred method to create a new instruction. GENERAL ASSEMBLER DIRECTIVES .RESTORE_PSECT +RESTORE_PSECT -- RESTORE PREVIOUS PROGRAM SECTION CONTEXT DIRECTIVE .RESTORE_PSECT retrieves the program section from the top of the If program section context stack, an internal stack in the assembler. .RESTORE PSECT is issued, the assembler the stack is empty when displays an error message. When.RESTORE_PSECT retrieves a program section, it restores the current location counter to the value it had when the program section was saved. The local label block is also restored if it was saved when the program section was saved. Format N .RESTORE_PSECT Example .SAVE PSECT and .RESTORE PSECT are useful in macros program sections (see ~Chapter 6). that define The macro definition below saves the current program section context and defines new program If the it restores the saved program section. Then, sections. macro did not save and restore the program section context each time the macro was invoked, the program section would change. S INITD LEV=2 DEFINE SYMBOLS MG MAXNUM=100 W RATE1=16 NG RATE2=4 WP DATA,NOEXE,LONG 100 NE .PSECT .BLKL MO WM .BLKB 16 .RESTORE_PSECT DEFINE ANOTHER PSECT 100 LONGWORDS IN TABL MORE STORAGE RESTORE THE PSECT EFFECT WHEN WE TABL: TEMP: . THE CURRENT PSECT SAVE DEFINE NEW PSECT WO SYMBOLS,ABS IN WO HELP PSECT NS .SAVE .PSECT INITIALIZE SYMBOLS AND DATA AREAS WE "o .MACRO MACRO IS INVOKED . ENDM Note The alternate form of .RESTORE_PSECT is .RESTORE. 5-51 GENERAL ASSEMBLER DIRECTIVES .SAVE__PSECT +SAVE_PSECT -- -SAVE_PSECT stores SAVE CURRENT the PROGRAM current program the program section context stack, leaving the current program section -SAVE_PSECT program and .RESTORE_PSECT sections -RESTORE_PSECT (see for SECTION CONTEXT DIRECTIVE are Chapter another example section context on an internal assembler context in effect. useful 6). using in macros See the the top stack, that of while define description of .SAVE_PSECT. Format .SAVQ_PSECT [LOCAL_BLOCK] Parameter LOCAL_BLOCK An optional is to be keyword that specifies that the current local saved with the program section context. 1label Example -y LABEL “ o WILL GENERATE LOCAL THIS SINCE IS symbol THE IN A AN DEFINITION DIFFERENT ERROR FOR LABEL .PSECT WO NS NS SET LOCAL TO MO ORIGINAL PSECT THAT THIS IS STILL LOCAL LABEL BLOCK THAT WAS STARTED BY NI RSB NEW NOTE LOAD UP STRING NP PRINT IT PSECT BACK TYPE OUT .PSECT STRINGS IT WY BSBW W“PNTR,RO NEW CREATES BLOCK NOT WME MOVAB TO ALSO POINTER TO STRING STRING TO BE PRINTED N .RESTORE_PSECT LABEL WE TEXT/ SWITCH THIS MO /SOME ASCII BLOCK WE . 20$ LOCAL SAVE CURRENT PSECT NUMBER STRINGS BLOCK ! .SAVE_PSECT .ASCII 208 CREATES BRANCH IS LOW BIT CLEAR NP Undefined THIS NP SMACRO-E-UNDEFSYMBOL, PNTR = 0 Ne .WORD R0,20$ NG START:: “BLBC MG PROGRAM BLOCK AS IN SAME ADDRESS LOCAL LABEL REFERENCE 4 ; THIS TIME USING .SAVE_PSECT LOCAL_ BLOCK ’ N0 BECAUSE STRINGS W .PSECT 5-52 LOCAL BRAKCH N0 LOCAL_BLOCK NEW WILL NOT PRODUCE AN e .SAVE_PSECT CREATES WE R0,20% WS BLBC THIS BLOCK QW NG -n LABEL:: s - e OTHER IF LABEL LOW BIT CLEAR ERROR LOCAL LABEL BLOCK IS SAVED SAVE CURRENT PSECT NUMBER AND THE LQCAL LABEL BLOCK SWITCH TO NEW PSECT THIS ALSO CREATES NEW LOCAL LABEL BLOCK .ASCII /SOME ASCII TEXT/ N9 .RESTORE_PSECT NE SET POINTER TO STRING TEXT TO BE PRINTED BACK TO ORIGINAL PSECT NOTE WE ARE BACK wO = RSB WS PRINT_IT WE WTM PNTR, RO BSBW WO 20S: MOVAB WO WO NP PNTR ME GENERAL ASSEMBLER DIRECTIVES IN LABEL BLOCK STARTED OTHER_LABEL LOCAL BY LOAD UP STRING ADDRESS TYPE IT OUT IS NOW IN SAME LOCAL LABEL BLOCK AS REFERENCE Notes If the stack is full when .SAVE§PSECT 1. occurs. The stack capacity is is 1issued, an error includes the values of the The program section context and the maximum value assigned to current location counter the location counter The alternate form of in the current program section. .SAVE_PSECT is .SAVE. GERERAL ASSEMBLER DIRECTIVES SHOW .NOSHOW -SHOW AND .NOSHOW -- LISTING DIRECTIVES -.SHOW and .NOSHOW specify listing control options in the of a program. .SHOW and .NOSHOW can be used with argument list. source text or without an When used with an argument list, .SHOW causes certain types of 1lines to be included in the listing file and .NOSHOW causes certain types of lines to be excluded. .SHOW and .NOSHOW control the listing of the source 1lines that are in conditional assembly blocks (see the description of .IF), macros, and repeat blocks (see Chapter 6). When used without arguments, these directives alter the listing level count. The listing level count is initialized to 0. Each time .SHOW appears in a program, the listing level count is incremented; each time .NOSHOW appears in a program, the listing level count is decremented. When the (unless listing the level 1line count is contains an negative, error). the 1listing Conversely, is when suppressed the listing level count is positive, the listing is generated. When the count 0, the line is either listed or suppressed, depending on the value the listing control symbolic arguments. is of Formats «.SHOW .SHOW argument-list . NOSHOW .NOSHOW argument-list Parameter argument-list One or more of the optional symbolic arguments, defined in Table 5-7. Either the long form or the short form of the arguments can be used. Each argument can be used alone or in combination with other arguments. If multiple arguments are specified, they must be separated by commas, tabs, or spaces. If any argument is not specifically included in a listing control statement, its default value (Show or Noshow) is assumed 5-54 throughout the source program. GENERAL ASSEMBLER DIRECTIVES Table .SHOW and Long Form 5-7 .NOSHOW Symbolic Arguments Short. Form Default Function .= BINARY Pem— MEB Noshow —] Lists macro expansions and repeat block expansions that generate binary code. BINARY is a subset of EXPANSIONS. CALLS MC Show CONDITIONALS CND Show DEFINITIONS MD Show Lists macro calls and repeat block specifiers. Lists unsatisfied conditional code associated with the conditional assembly directives. Lists macro and repeat range definitions that appear in an input source file. EXPANSIONS ME Noshow Lists macro gnd repeat range expansions. Example .MACRO XX .SéOW ; LIST NEXT LINE. ; DO NOT LIST REMAINDER OF MACRO . NOSHOW - . ; EXPANSION. ; DO NOT LIST MACRO EXPANSIONS. .EfiDM .NOSHOW EXPANSIONS ‘e XX Notes 1. listed be to count allows macros 1level 1listing The a macro definition can specify .NOSHOW at the selectively; beginning to decrement the 1listing count and can specify .SHOW at the end to restore the listing count to its original value. 2. The alternate forms .NLIST. of .SHOW and .NOSHOW are .LIST and GERERAL ASSEMBLER DIRECTIVES .SIGNED__BYTE .SIGNED_BYTE -~ SIGNED BYTE DATA DIRECTIVE .SIGNED_BYTE indicates uses is equivalent that this the information to .BYTE, except that VAX-11 data is signed in the object module. to test for MACRO The linker overflow conditions. Format -SIGNED BYTE expression-list Parameters expression-list An expression or list of expressions separated by commas. expression optionally can be followed by a repetition delimited An by square brackets. expression followed by a repetition factor has the Each factor format: expressionl{expression2] expressionl An expression that specifies the value to be stored. [expression2] An expression that specifies the number of times the value will he repeated. The expression must not contain any undefined symbols and must be an absolute expression (see Section 3.5). The square brackets are required. Example -SIGNED BYTE LABEL1~-LABEL2 ; -SIGNED BYTE DATA MUST FIT ALPHA{20] ; IN BYTE Note Specifying conditions 128 data through but .SIGNED BYTE allows when the value of the 1linker to the expression is 255. Values in this range can be cannot be stored as signed data in a detect in the stored byte. as overflow range of unsigned GENERAL ASSEMBLER DIRECTIVES SIGNED_WORD -SIGNED_WORD ~- SIGNED WORD STORAGE .SIGNED WORD 1is equivalent indicates that the data is uses this information to test is useful fits in DIRECTIVE to .WORD except that the signed in the object module. for overflow conditions. assembler The linker .SIGNED WORD after the case instruction to ensure that the displacement a word. Format .SIGNED _WORD expression-list Parameters expression-list An expression or list of expressions separated by commas. expression optionally can be followed by a repetition delimited by square brackets. An expression followed by a repetition factor has the Each factor format: expressionl[expression2] expressionl An expression that specifies the value to be stored. [expression2] An expression that specifies the number be repeated. The expression symbols and must be an abgolute The of times the value will must not contain any undefined expression (see Section 3.5). square brackets are required. Example CASE,SRC,DISPLIST,TYPE=W;LIMIT=#0,NMODE= S~ #,?BASE, ?MAX ~ we wa .MACRO MACRO TO USE CASE SRC IS SELECTOR, OF DISPLACEMENTS, INSTRUCTION DISPLIST 1S LIST TYPE 1S B-BYTE s TMo W-WORD, L-LONG, LIMIT IS THE BASE VALUE OF SELECTOR SRC, LIMIT,NMODE '<<MAX-BASE>/2>-1 e CASE'TYPE N BASE: CASE CASEW W W , CASE IVAR LOCAL LABEL USED TO COUNT ARG3 <ERR_PROC;SORT,REV SORT> ; IVAFR,$0,57$#<330001$-3000085/2>-1 30000%: 4 «SIGNED_WORD ERR PROC~30006GS -SIGNED_WORD REV SORT-30000¢ .SIGNEDWOED 30001%: OFFSET LIST “b .ENDM § SORT~30000$ = IF IVAR=0, ERPON; WSCRT. LABEL SPECIFYING BASE ; QPFSET LIST ; OFPSET LIST : OFFSET LIST Gy MAX: EP~-BASE LOCAL LABEI SPECIFYING BASE TO SET UP OFFSET LIST we .SIGNED_WORD .ENDR WO EP,(DISPLIST> wg . IRP CASE INSTRUCTIOM LOCAL LABEL USED 7O COUNT ARGSH =}, FOWARD SORT; =2,BACKWARD SORI GENERAL ASSEMBLER DIRECTIVES CASE TEST CASEL TEST, #1,S " #<<30003$-30002$>/2>-1 <TEST1,TEST2,TEST3>,L,#1 30002: s+ “o “e 30003s: In this CASEW, example, or directives the CASE macro CASEL instruction. used LOCAL LABEL SPECIFYING BASE TEST1-30002$ TEST2-30002$ TEST3-30002$ e .SIGNED WORD .SIGNED_WORD .SIGNED_WORD to define uses : OFFSET LIST OFFSET OFFSET LIST LIST ; LOCAL LABEL ; VALUE OF TEST CAN BE .SIGNED WORD to USED TO COUNT ARGS create a 1,2, OR CASEB, See Chapter 6 for a description of the the macro. Note Specifying conditions .SIGNED WORD allows when the the 1linker to detect overflow value of the expression is in the range of 32768 through 65535. Values in this unsigned data but cannot be stored as range can signed data be stored in a word. as 3 GENERAL ASSEMBLER DIRECTIVES .SUBTITLE -SUBTITLE -- SUBTITLE DIRECTIVE .SUBTITLE causes the assembler to print a line of text in the table of contents that is produced immediately before the assembly listing. The assembler also prints the line of text as the subtitle on the second 1line of each assembly 1listing page. This subtitle text is printed on each page until altered by a subsequent .SUBTITLE directive in the program. Format .SUBTITLE comment-string Parameter comment-string An ASCII string are truncated. from 1 This to 47 characters long; string represents the printed in the table of contents assembly listing. and as the excess line of characters text to be subtitle in the Examples 1. .SUBTITLE CONDITIONAL ASSEMBLY This directive cause the assembler to print text as the subtitle of the assembly listing: the following CONDITIONAL ASSEMBLY 2. TABLE OF (1) (2) (2) 5000 1300 2300 (3) (4) (4) (5) CONTENTS ASSEMBLER DIRECTIVES MACRO DEFINITIONS DATA TABLES AND INITIALIZATION 4800 MAIN ROUTINE 2800 CALCULATIONS 5000 I/0 ROUTINES 1300 CONDITIONAL ASSEMBLY During assembly, a table of contents 1is printed for the assembly listing. It contains the source page number and the line sequence number of the source file and the text accompanying each .SUBTITLE directive. Note The alternate form of .SUBTITLE is .SBTTL. GENERAL ASSEMBLER DIRECTIVES -TITLE «TITLE -- TITLE DIRECTIVE .TITLE assigns a name to the object module. This name or fewer nonblank characters following the directive. is the first 15 Format .TITLE module-name comment-string Parameters module-name An identifier from 1 to 15 characters long. comment~string An are ASCII string from 1 to 47 characters long; excess characters truncated. Example .TITLE EVAL EVALUATES EXPRESSIONS Notes The module name specified with .TITLE bears no relationship to the file specification of the object module, as specified in the VAX-11 MACRO command line. Rather, the object module name appears in the linker load map, and is also the module name that the debugger and librarian recognize. If .TITLE is not specified, MACRO assigns the default name +MAIN, to the object module. If more than one .TITLE directive is specified in the source program, the last .TITLE directive encountered object module. establishes the name for the entire When evaluating the module-name, MACRO ignores all spaces and/or tabs up to the first nonspace/nontab character after +TITLE, GERERAL ASSEMBLER DIRECTIVES .TRANSFER - TRANSFER -~ TRANSFER DIRECTIVE .TRANSFER redefines a global symbol for use in a shareable image. The linker redefines the symbol as the value of the location counter at the .TRANSFER directive after a shareable image is linked. When shareable images are relinked, they should be relinked so that the programs linked with them need not be relinked. This can only be achieved if the entry points in the shareable image do not change their addresses when the source code is changed and the image is relinked. To build such a shareable image, the programmer creates an object module that contains a transfer vector for each entry point and does not change the order of the transfer vectors. This object module is 1linked at the beginning of the shareable image and the addresses will remain fixed even if source code for a routine is changed. After each .TRANSFER directive, a register save mask ({(for procedures only) and a branch to the first instruction of the routine should appear. Figure 5-1 illustrates the use of entry vectors. The .TRANSFER directive does not cause any memory to be allocated and does not generate any binary code. It merely generates instructions to the linker to redefine the symbol when a shareable image is being created. .TRANSFER can be used with procedures entered by the CALLS or CALLG instruction. In this case, .TRANSFER 1is used with the .ENTRY and .MASK directives. The branch to the actual routine must be a branch to the entry point plus 2. Adding 2 to the address is necessary to bypass the 2-byte register save mask. Linked with Object Modules Linked with Shareable Image Program * Calling CALLS Procedure - Program ROUTB .TRANSFER ROUTA .MASK ROUTA Transfer BRW ROUTA+2 Vector .TRANSFER ROUTB-= Module MASK RQUTB BRW ROUTB+2 — * Calling CALLS Procedure ° ROUTB * Shareable < Image Other Obiect Mocliul . ¢ .ENTRY ROUTB,0 ;START OF ROUTINE-= Object : RET Modules ENTRY ROUTB, 0= ; START OF ROUTINE 2 RET . Figure 5-1 Using Transfer Vectors 5-61 GENERAL ASSEMBLER DIRECTIVES Format . TRANSFER symbol Parameter symbol A global symbol that is an entry point in a procedure or routine. Example ROUTINE ROUTINE A, "M<R4,R5> - ;s COPY ENTRY MASK s AND ADD REGISTERS BRW ROUTINE A+2 ;s ; 4 AND 5 BRANCH TO ROUTINE ’ (PAST ENTRY MASK) .MASK ROUTINE_A, "M<R2,R3> -y . ENTRY A w9 . TRANSFER ENTRY POINT, SAVE REGISTERS 2 AND 3 RET In this example, .MASK copies a routine's entry mask to the new entry address specified by .TRANSFER. If the routine 1is placed in a shareable image and then called, registers 2, 3, 4, and 5 will be saved. 5-62 GENERAL ASSEMBLER DIRECTIVES .WARN +WARN -- WARNING DIRECTIVE .WARN causes the assembler to display a warning message on the terminal or batch log file and in the listing file (if there is one). Format .WARN [expression] j;comment Parameters expression An expression whose value during assembly. is displayed when .WARN is encountered scomment A comment that is displayed when .WARN comment must be preceded by a semicolon. is encountered. The Example .IF DEFINED FULL .IF DEFINED DOUBLE .WARN s PREC THISCOMBINATION NOT TESTED .ENDC .ENDC If the symbols FULL and DOUBLE_PREC are both warning message is displayed. EMACRO-W-GENWRN, Generated WARNING: defined, the following THIS COMBINATION NOT TESTED Notes 1. .WARN, .ERROR, directives. and .PRINT are called the message display They can be used to display information indicating that a macro call contains an error or an illegal set of conditions (see Chapter 6 for more information on macro 2. calls). When the assembly is finished, the assembler displays the total. number of errors and warnings and the page numbers and line numbers of the lines causing the errors or warning on the terminal (or in the batch log file). See the VAX-11 MACRO User's Guide for more information on errors and warnings. 3. If .WARN is included in a macro library (see the VAX-11 MACRO User's Guide), the comment should end with an additional semicolon. Otherwise, the comment will be stripped from the directive and will not be displayed when the macro is called. 4. The line containing the the listing file. 5. If the expression has the warning message. .WARN directive is a value of 0, it is not not included in displayed in GERERAL ASSEMBLER DIRECTIVES WEAK «WEAK -~ WEAK SYMBOL ATTRIBUTE DIRECTIVE .WEAK specifies symbols that are either defined externally in another module or defined globally in the current module. .WEAK suppresses any object library search for the symbol. When .WEAK specifies a symbol that is not defined module, the symbol 1is externally defined. 1If the symbol's definition in another module, it uses that the 1linker value of 0 not search does not find an external definition, and the linker does not report an error. a library for the symbol, but if a module library for uses it. another reason contains the in the current linker finds the definition. If symbol the symbol has a The 1linker does brought in from a definition, the 1linker When .WEAK specifies a symbol that is defined in the current module, the symbol 1is considered to be globally defined. However, if this module is inserted in an object library, this symbol is not inserted in the library's symbol table. Consequently, searching the library at link time included. to resolve this symbol does not cause Format .WEAK symbol-list Parameter symbol-list A list of legal symbols Example .WEAK IOCAR,LAB 3 separated by commas. the module to be GENERAL ASSEMBLER DIRECTIVES -WORD +WORD -- WORD STORAGE .WORD generates DIRECTIVE successive words (2 bytes) of data in the object module. Format +WORD expression-list Parameter expression-list One or more optionally square An expressions can be separated followed by by a commas. repetition Each factor brackets. expression followed by a repetition factor has expression delimited the by format: expressionl [expression2] expressionl An expression that specifies the value to be stored. [expression2] An expression that specifies the number of times the value will be repeated. The expression must not contain any undefined symbols and must be an absolute expression (see Section 3.5). The square brackets are required. Example .WORD “X3F,FIVE[3],32 Notes l. The expression truncated to is a first word. The evaluated value of as the a longword, expression then should be in the range of -32768 through 32767 for signed data or 0 through 65535 for unsigned data. The assembler displays an error if the high-order 2 bytes of the longword expression have a value other than 0 or “XFFFF. / 2. The the the .SIGNED WORD directive is the same as .WORD except that assembler displays a diagnostic message if a value is in range from 32768 to 65535. CHAPTER 6 MACROS By using macros, sequence A macro of definition definition arguments the a source can can formal programmer can lines a into contains the optionally be used arguments a source have throughout are use single 1line to insert a program. the replaced lines formal of sequence by the the macro. arguments. of actual source The macro These formal lines. Later, arguments in the macro call. The macro call consists of the macro name actual arguments. The assembler replaces macro any call with the occurrences actual arguments the macro lines formal specified in the arguments in the macro in macro the definition. macro call. It definition This process by the replaces with is the called expansion. By default, They source of optionally followed the line containing are macro expansions are not printed in the assembly listing. printed only when the .SHOW directive (see description in Chapter 5) specifies the EXPANSIONS argument. In the examples in this chapter, the macro expansions are listed as they would appear if .SHOW EXPANSIONS was specified in the source file. The macro categories directives provide facilities of functions. Table 6-1 lists directives that arguments, of 6.1 the ARGUMENTS have arguments the macro. definition: thenm. types the Formal that The number of equal to the if the number describes are presented in in detail. alphabetical For macro ease order. of strings arguments: given in arguments are 1is, after the in macro separated actual and macro call the specified macro name calls and by commas, by in or Actual the name of name in the macro the .MACRO directive. formal tabs, formal. after arguments in macro spaces. actual arguments in the macro call can be less than or number of formal arguments in the macro definition. But of actual arguments is greater than the number of formal arguments, the Formal actual assembler displays arguments an normally relationship. That 1is, the first replaces all occurrences of the first definition. However, this strict overridden 6.1 Section eight and the IN MACROS two are directives Actual arguments definitions can be and wunder performing categories Section 6.2 describes the directives reference, Macros fall for these by the use of keyword error message. maintain a strict positional actual argument in a macro call formal argument in the macro positional relationship can be arguments (see Section 6.1.2). MACROS Table 6-1 Summary of Macro Directives Category Directives* Macro Definition Directives .MACRO . ENDM Macro Library Directives . LIBRARY +MCALL Macro Deletion Directive «.MDELETE Macro Exit Directive «MEXIT Argument Attribute Directives «NARG «NCHR +NTYPE Indefinite Repeat Block Directives «IRP « IRPC Repeat Block Directives +.REPEAT End Range Directive « ENDR alternate form, An example of a macro definition using 1 2 W MACRO IS IS IS 3 1 2 MACRO We 3,2,1 We X-Y | STORE + LONG +.WORD .BYTE W two examples show possible calls and expansions of above. We . LONG «WORD .BYTE ARG2 IS FIRST ARGUMENT IS THIRD ARGUMENT IS SECOND ARGUMENT STORE e STORE ARGl ARG3 N X 1. ARG3 ARG2 1is ARG1,ARG2,ARG3 N The following macro defined STORE ARG1 any, formal arguments follows: W .MACRO . LONG -WORD .BYTE - ENDM if in parentheses. WO The wo * given (.REPT) CALL FIRST ARGUMENT THIRD ARGUMENT SECOND ARGUMENT CALL X IS FIRST ARGUMENT Z IS THIRD ARGUMENT X~Y IS SECOND ARGUMENT the MACROS 6.1.1 Default Default Values values are They are used formal argument. Default values values when are example of a «MACRO STORE .« LONG ARG1 .WORD ARG3 .BYTE . ENDM ARG2 in defined 1is the 3. 6.1.2 names three . LONG 12 -WORD .BYTE 1000 0 STORE 1 5,X « LONG 12 «WORD +BYTE X 5 STORE 1 . LONG 1 -WORD .BYTE 1000 0 examples a in macro specifying show possible the macro definition specified In macro call the the arguments are combined in a macro, correspond by position to the formal used. argument and call a follows: values follows: calls and expansions of the If a ; NO ARGUMENTS SUPPLIED ; LAST TWO ARGUMENTS ; FIRST ARGUMENT SUPPLIED SUPPLIED keyword a formal keyword overrides should arguments. argument argument, any Keyword formal in any argument arguments arguments, only are some of call. arguments macro all in many or not default definition. has arguments are for ARG1l=12,ARG2=0,ARG3=1000 to be one as call = default-value definition which need any definition. macro allow a macro call to specify the arguments the macro call must specify the same formal appear when macro the Arguments arguments however, that useful in above. Keyword Keyword order; the .MACRO directive STORE 2. in specified STORE The following macro defined 1. macro are value specified formal-argument-name An that no the be either When only the arguments; corresponds argument all positional positional and positional the to that keyword both a appears other argument definition macro definition specifies for keyword arguments arguments positional last the in the same argument. For example, the following +.MACRO STORE « LONG ARG1l «WORD +BYTE ARG3 ARG2 « ENDM STORE ARGl ,ARG2,ARG3 three arguments: MACROS The following macro call STORE . LONG .WORD .BYTE specifies keyword arguments: ARG3=27+5/4 ,ARG2=5,ARG1=SYMBL SYMBL 27+5/4 5 Because the keywords are specified in the macro call, the arguments in the macro call need not be given in the order they were listed in the macro definition. 6.1.3 String Arguments If an actual argument is a string containing characters that the assembler interprets as separators (such as a tab, space, or comma), the string must be enclosed by delimiters. String delimiters are usually paired angle brackets (<>). However, the assembler also interprets any delimiter. character Thus, to after programmer can use the circumflex The an initial circumflex (7) as pass an angle bracket as part of a string, form of the delimiter. a the following are examples of delimited macro arguments: <HAVE THE SUPPLIES RUN OUT?> <LAST NAME, FIRST NAME> <LAB: CLRL R4> “$ARGUMENT IS <LAST,FIRST> FOR CALLS% "?EXPRESSION IS <5+3>*<4+2>? In the last two examples the initial circumflex indicates the percent sign (%) and question mark (?), respectively, are the delimiters. Note that only the left hand delimiter is preceded by a circumflex. The assembler interprets a string argument enclosed by delimiters as one actual argument and associates it with one formal argument. If a string argument that contains separator characters is not enclosed by delimiters, the assembler interprets it as successive actual arguments and associates For example, it with successive the formal following macro call «.MACRO REPEAT .ASCII .ASCII /STRNG/ /STRNG/ - ENDM REPEAT arguments. has one formal argument. STRNG The following two macro calls demonstrate actual arguments with and without delimiters. 1. 2. REPEAT .ASCII .ASCII <A B C D E> /A B CD E/ /A B C D E/ REPEAT A B C D E $MACRO-E-TOOMNYARGS, Too many arguments in MACRO call Note that the assember interpreted the second macro call as having five actual arguments instead of one actual argument with spaces. When a macro is called, the assembler removes present) around a string before associating the delimiters (if it with the formal arguments, \ MACROS If a string contains a semicolon, the string must be enclosed by delimiters, or the semicolon will mark the start of the comment field. To pass a number containing a radix or unary operator (for example, “XF19), the entire argument must be enclosed by delimiters, or the assembler will interpret the radix operator as a delimiter. The following. are macro arguments that are enclosed in delimiters because they contain radix operators: <"XF19> <"B01100011> <°F1.5> Macros can be nested, that is a macro definition can contain a call to another macro. 1If within a macro definition, another macro is called and passed a string argument, the programmer must delimit the argument so that the entire string 1is passed to the second macro as one argument., The following macro definition contains a call to the REPEAT in an earlier example: LABl: +MACRO .BYTE CNTRPT LABl,LAB2,STR_ARG LAB2-LABl-1 ; LENGTH OF REPEAT <STR_ARG> CALL REPEAT MACRO « ENDM CNTRPT e defined macro 2+STRING LAB2: Note that the argument in the call to REPEAT is enclosed 1in angle brackets even though the actual argument does not contain any separator characters. This is done because the actual argument in the call be to REPEAT is a formal argument in the macro definition and will replaced with an actual argument that may contain separator characters, The following example calls the macro CNTRPT which in turn macro CNTRPT +.BYTE REPEAT .ASCII .ASCII ST: calls the REPEAT: ST,FIN,<LEARN YOUR ABC'S> FIN-ST-1 : LENGTH OF 2*STRING <LEARN YOUR ABC'S> ; CALL REPEAT MACRO /LEARN YOUR ABC'S/ /LEARN YOUR ABC'S/ FIN: An alternative method to pass string arguments in nested macros is to enclose the macro argument in nested delimiters. In this case the macro time calls in the macro definitions should not have delimiters. Each the delimited argument is used in a macro call, the assembler removes the outermost pair of delimiters before associating it with the formal argument. This method is not recommended because it requires that the programmer know how deeply a macro is nested. The following macro definition also contains a call to the macro: .MACRO CNTRPT2 +BYTE LAB2-LAB1-1 REPEAT STR_ARG - ENDM CNTRPT2 LAB2: LABl,LAB2,STR_ARG ; LENGTH OF e LABl: CALL 2*STRING REPEAT MACRO repeat MACROS Note that brackets. The the following BEG: argument in example calls the call to REPEAT the macro BEG,TERM,<<MIND .BYTE TERM-BEG-1 REPEAT <MIND .ASCII .ASCII /MIND YOUR P'S AND Q's/ /MIND YOUR P'S AND Q'S/ P'S AND ; YOUR P'S AND not enclosed in angle CNTRPT2: CNTRPT2 YOUR is Q'S>> LENGTH OF 2*STRING Q'S> TERM: Note that not enclosed even though in delimiters because around the string 6.1.4 Argument The a argument macro precede the concatenation If an apostrophe 1is expanded. For the argument is Note that expansion. the concatenate two call operator, in in the the argument if ARGl the is a actual in the formal argument is expanded 1if ARG2 itself ARG2'L does separate not the two a definition CONCAT that two formal An example TEST5: TESTSX: two delimiters that uses concatenates can either source. text before when the macro associated the is with to ABCDETEST. is the actual a formal appear in is argument apostrophe when expanded formal to the argument MOVL. the arguments macro with are needed because each from the expansion. concatenation follows: RO,R'NUM CONCAT successive arguments of enclosed INST,SIZE,NUM INST''SIZE TEST'NUM'X: Note the argument argument MOV, arguments, macro macro name, An . ENDM in ('), actual concatenation «MACRO TEST'NUM': is is Apostrophes formal argument name, text that follows the example, apostrophe two name ABCDE'ARGl For text. apostrophes. Two apostrophes operation discards an apostrophe of definition nested apostrophe argument with follows the with the the the successive example macro expansion contains constant the TEST, expanded. with REPEAT CNTRPT2 some formal example, associated To to concatenated an apostrophe concatenated macro with precedes apostrophe If is call to the Concatenation follow a actual call argument. argument or the delimiters, a macro apostrophes INST call CONCAT MOV,L,5 MOVL RO,R5 and and are used when SIZE. expansion follows: concatenating the MACROS 6.1.5 When a Passing Numeric Values of Symbols symbol actual is specified as an argument, the name of the symbol, not the numeric value of the symbol, is passed to the macro. However, the value of the symbol can be passed by inserting a backslash before the symbol in the macro call. The assembler then passes the characters representing the decimal value of the symbol to the macro. For example, if the symbol COUNT has a value of 2 and the actual "2" to argument specified is \COUNT, the assembler passes the string the macro; it does not pass the name of the symbol, "COUNT". Passing numeric values of symbols 1is especially useful with apostrophe (') concatenation operator for creating new symbols. An example of a macro definition for passing numeric values of the symbols follows: .MACRO TESTDEF,TESTNO,ENTRYMASK="2"M<>? .ENTRY TEST'TESTNO,ENTRYMASK .ENDM TESTDEF The following example defined above: COUNT = shows a ; possible USES ARG call and CONCATENATION expansion of the macro 2 TESTDEF \COUNT COUNT .ENTRY TEST2, M<> COUNT + 1 TESTDEF \COUNT, "?"M<R3,R4>? .ENTRY TEST3, "M<R3,R4> 6.1.6 Created Local Labels Local labels are often very useful in macros. Although the programmer can specify 1local labels in the macro definition, these local labels might be cause errors. duplicated local labels local labels. elsewhere However, in the the macro These in the expansion labels local programmer are can which called label block and might thus use the assembler to create will not conflict with other created local labels. Created local labels range from 30000$ through 65535$. Each time the assembler creates a new local label, it increments the numeric part of the label name by 1. Consequently, no user-defined 1local 1labels should be in the range of 300008 through 655358. The programmer specifies a placed in front of the created local label by a question mark (?) formal argument name. When the macro is expanded, the assembler creates a new local label if the corresponding actual argument 1is blank. I1f the corresponding actual argument is specified, the assembler substitutes the actual argument for the formal argument. Created local symbols can be used only in the first 31 formal arguments specified in the .MACRO directive. Created local labels arguments; created actual arguments. can be 1local associated only with positional 1labels cannot be associated with actual keyword MACROS The following label: example is «.MACRO POSITIVE TSTL ARG1 a BGEQ Ll ARG1 ,ARG1 Ll: « ENDM POSITIVE The following both l. three created calls local POSITIVE TSTL definition specifying a created local ARG1,?L1 MNEGL show macro and labels expansions and a of the macro user-specified defined local above label: RO RO BGEQ 300008 MNEGL RO,RO 300008$: 2. POSITIVE TSTL COUNT COUNT BGEQ 30001$ MNEGL COUNT,COUNT 300018: 3. POSITIVE TSTL 6.1.7 The VALUE,10$ VALUE BGEQ 10$ MNEGL VALUE,VALUE Macro String three macro e S$SLENGTH e 3$LOCATE e 3IEXTRACT Operators string operators are: These operators perform string manipulations on macro arguments and ASCII strings. They can be used only in macros and repeat blocks. The following sections describe these operators and give their formats and examples of their use. MACROS %LENGTH 6.1.7.1 a SLENGTH Operator string. For example, - The 3LENGTH operator the value of returns $LENGTH(<ABCDE>) is the length of 5. Format $LENGTH(string) Parameters string A macro argument or a delimited delimited by angle brackets or circumflex (see Section string. The a character string can be preceded by a 6.1.3). Examples definition: CHK_SIZE .IF GREATER EQUAL 1. calls and ARGUMENT ARGl expansions of CHK_SIZE A .IF GREATER EQUAL .IF LESS_THXN « ERROR « ENDC .IF FALSE MACRO CHECKS IS BETWEEN 3 IF ARGl AND 6-%LENGTH (ARG1) 6 CHARACTERS LONG ; ARGUMENT ARGl IS GREATER THAN 6 CHARACTERS « ENDC .IF_FALSE - ERROR ; « ENDC - ENDM CHK_SIZE Macro $LENGTH (ARG1) -3 we .IF LESS THAN .ERROR ARG1 wo .MACRO Wo Macro ; the macro 1-3 6—-1 ; ; IS IS ; IF MORE THAN 6 . ;3 IF LESS THAN 3 LESS THAN 3 CHARACTERS ; OTHERWISE DO ; NOTHING defined BETWEEN above: ; SHOULD BE 3 AND TOO SHORT 6 CHARACTERS LONG ARGUMENT A IS GREATER THAN 6 CHARACTERS ; IF MORE THAN 6 ; IF LESS THAN 3 $MACRO-E-GENERR, Generated ERROR: ARGUMENT A IS LESS THAN 3 CHARACTERS «ENDC 2. ; OTHERWISE DO CHK_SIZE ABC .IF GREATER_EQUAL .IF LESS_ THAN « ERROR ; ; SHOULD BE OK 3-3 ; IS BETWEEN 3 AND 6-3 ; 6 CHARACTERS LONG ARGUMENT ABC IS GREATER THAN 6 CHARACTERS « ERROR « ENDC ; ARGUMENT ABC « ENDC .IF_FALSE ; ; IS IF MORE THAN 6 IF LESS THAN 3 LESS THAN 3 CHARACTERS ; OTHERWISE DO MACROS %LOCATE 6.1.7.2 S$LOCATE Operator - The %LOCATE within a string. If SLOCATE finds operator locates a substring substring, it returns the character position of the first the match 1in the string. For example, the value of %LOCATE(<D>,<ABCDEF>) is 3. Note that the first character position of a string is 0. If SLOCATE does not find a match, it returns a value equal to the length of the string. For example, the value of $LOCATE(<Z>,<ABCDEF>) is 6. The $LOCATE expression. operator returns a numeric a match value that of the character of can be used in any Format $LOCATE(stringl,string2 [,symbol] ) Parameters stringl A string that specifies the substring. The substring can be either a macro argument or a delimited string. The delimiters can be either angle brackets or a character preceded by a circumflex. string?2 The string either that a is macro can be either circumflex. searched argument angle for or a the substring. delimited brackets or decimal number a The string. character string can be The delimiters preceded by a symbol An optional symbol or that specifies the position in string2 at which the assembler should start the search. If this argument is omitted, the assembler starts the search at position 0 (the beginning of the string). A symbol must be an absolute symbol that has been previously defined and a number must be operators an unsigned are not decimal number. Expressions allowed. and radix ' Example Macro definition: +.MACRO .IF BIT_NAME EQUAL ARG1 ; ;7 « ERROR ; ARGl IS AN INVALID BIT «ENDC . ENDM Macro 1. calls and BIT_NAME expansions of BIT_NAME ESC .IF 12-15 EQUAL « ERROR « ENDC CHECKS IF ARGl IS IN LIST ¥LOCATE (ARGl ,<DELDFWDLTDMOESC>) ~15 ; ESC the IS macro AN defined INVALID BIT IF IT IS NOT IT IS DO PRINT ERROR PRINT ERROR NAME ; IF ;7 NOTHING above: ; IS IN LIST ; IF IT IS NOT IT IS DO NAME ; IF MACROS 2 BIT_NAME FOO .IF 15-15 EQUAL - 2. ; $MACRO-E-GENERR, Generated ERROR: FOO . ENDC IS AN ; NOT IF IN IT LIST IS NOT PRINT ERROR INVALID BIT NAME IF IT IS DO Note If the optional symbol is specified, the search character position of string2 specified by example, the because there begins at the symbol. value of %LOCATE(<ACE>,<SPACE_HOLDER>,5) is no match after the 5th character position. the For 1is 12 %EXTRACT 6.1.7.3 SEXTRACT Operator - The $EXTRACT operator extracts a substring from a string. It returns the substring that begins at the specified position and is the specified 1length. For example, the value of $EXTRACT(2,3,<ABCDEF>) is CDE. Note that the first character in a string is in position 0. Format $EXTRACT(symboll,symbol2,string) Parameters symboll A symbol or decimal number that specifies the starting position of the substring. A symbol must be an absolute symbol that has been previously defined and a number must be an unsigned decimal number. Expressions and radix operators are not allowed. symbol 2 A symbol or decimal number that specifies the 1length of the substring. A symbol must be an absolute symbol that has been previously defined and a 'number must be an unsigned decimal number. Expressions and radix operators are not allowed. string A macro argument or a delimited string. The delimited by angle brackets or a character string can be preceded by a circumflex. Example Macro XX = definition: RESERVE ARGl .MACRO $LOCATE(<=>,ARGl) .IF EQUAL «WARN ; -MEXIT . ENDC XX-$LENGTH (ARG1) INCORRECT FORMAT FOR MACRO CALL - ARGl MACROS $EXTRACT(0,XX,ARG1) :: XX = XX+1 Macro $EXTRACT (XX, 3,ARG1) - ENDM RESERVE calls 1. XX .BLKB and expansions RESERVE = of the macro defined above: FOOBAR 6 .IF EQUAL IMACRO-W-GENWRN, XX-6 Generated WARNING: INCORRECT FORMAT FOR MACRO CALL - +MEXIT 2. RESERVE «IF LOCATION=12 EQUAL «WARN ; XX-11 INCORRECT FORMAT FOR MACRO CALL - LOCATION=12 «MEXIT « ENDC LOCATION:: XX = XX+1 +BLKB 12 Notes If the starting position specified is greater than or the 1length of the string, $EXTRACT returns a null string of 0 characters). If the length specified is 0, returns a null string. 6.2 The equal to string (a $EXTRACT MACRO DIRECTIVES remainder detail, of showing directives are this chapter their formats presented describes and giving in alphabetical the macro examples order. of directives their use. 1in The FOOBA MACROS .ENDM « ENDM--END DEFINITION DIRECTIVE .ENDM terminates the macro definition. for an example of the use of .MACRO See the description of .ENDM. Format .ENDM [macro-name] Parameter macro-—-name The The name of the macro whose definition is to be terminated. but, if specified, it must match the is optional; name macro name defined in the matching .MACRO directive. assembler the that so specified be should improperly nested macro definitions. The can name macro any detect Note If .ENDM is encountered outside a macro definition, the assembler displays an error message. .ENDR « ENDR--END RANGE DIRECTIVE .ENDR indicates the end of a repeat range. It must statement of every indefinite repeat block directive the See and every repeat block directive (.REPEAT). these directives Format . ENDR for examples of the use of .ENDR. be the final (.IRP and « IRPC) description of MACROS .IRP « IRP-~INDEFINITE +-IRP replaces specified in REPEAT ARGUMENT a formal an argument argument the expansion of the directive specifies the -IRP At is analogous each replaced directive with a list. with This indefinite end of macro of successive replacement repeat the block repeat with block, elements from macro by name, -IRP can appear indefinite do The other either repeat -REPEAT). for as macros within block, rules specifying for or or described outside repeat specifying macro arguments occurs during The .ENDR range. only one this argument., argument is argument list. The within the source program, do not require calling the in this another block .IRP formal formal the and its range are coded inline of macro definition and its range type actual process range. definition the successive This those to expansion DIRECTIVE chapter. macro (see arguments definition, the description of are the arguments. same as Format «IRP symbol,<argument list> Parameters symbol A formal argument specified actual formal argument is that 1is arguments specified, successively replaced with enclosed in angle brackets. the assembler displays an message. <argument the If no error list> A list of expanding consist actual arguments the indefinite of separated actual one or by a arguments more 1legal are enclosed in angle brackets and used in repeat range. An actual argument can characters; multiple arguments must be separator specified, no (comma, action space, is or tab). If no taken. range The block of an of source actual definitions and text argument repeat to in be the ranges. repeated list. .MEXIT once for each The range can is legal within occurrence contain the macro range. MACROS Example Macro definition: .MACRO .NARG .IRP SUBR,Al1,A2,A3,A4,A5,A6,A7,A8,A9,A10 CALL SUB COUNT ARG,<Al0,A9,A8,A7,A6,A5,A4,A3,A2,A1> ARG, +.IIF NOT_BLANK «ENDR ; #<COUNT-1>,SUBR CALLS PUSHL ARG NOTE SUBR IS COUNTED CALL_SUB .ENDM Macro call and expansion of the macro defi ed above: CALL SUB COUNT .NARG TEST,INRES,INTES,U LIS,OUTCON,#205 TES, ARG,<,,,s,%205,0UTCON,UNLIS,ININRES> .IRP ARG PUSHL ARG, .IIF NOT_BLANK « ENDR .IIF .IIF .IIF .IIF NOT_BLANK NOT_BLANK NOT_BLANK NOT BLANK .IIF NOT_BLANK .IIF NOT BLANK .IIF .IIF .IIF .IIF CALLS NOT BLANK NOT_BLANK NOT_BLANK NOT BLANK , , , , PUSHL PUSHL PUSHL PUSHL #205, PUSHL , OUTCON, UNLIS, INTES, INRES, F<COUNT-1>,TEST PUSHL PUSHL PUSHL PUSHL PUSHL #205 OUTCON UNLIS INTES INRES ; NOTE TEST IS COUNTED This example uses the .NARG directive to count the arguments and the .IIF NOT_BLANK directive (see descriptions of .IF and .IIF in Chapter If the to determine whether the actual argument is blank. 5). argument is blank, no binary code is generated. MACROS IRPC « IRPC-~INDEFINITE REPEAT CHARACTER DIRECTIVE +-IRPC is similar to .IRP except that .IRPC permits single-character substitution, rather than argument substitution. On each iteration of the indefinite repeat range, the formal argument is replaced with each successive character in the specified string. The .ENDR directive specifies the end of the range. .IRPC is analogous argument. At each to a macro expansion is replaced with successive string. The directive and Source program other macros +.IRPC can indefinite and do not described appear either repeat within calling with block, characters 1its range this or definition the require in repeat block, of only this from the are coded the or outside block macro another formal argument actual argument inline within the by chapter. repeat one formal name, macro as do definition, (see description of .REPEAT). Format «IRPC symbol,<string> « ENDR Parameters symbol A formal specified argument argument that is successively replaced with the enclosed in angle brackets. If no formal characters is specified, the assembler displays an error message. <string> A sequence of characters the enclosed expansion of the indefinite brackets are required only when characters, their use is in angle repeat the recommended brackets range. string for and Although contains legibility. used the in angle separating range The block of source text to be repeated once for each occurrence a character in the 1list. The range can contain macro definitions and repeat ranges., .MEXIT is legal within the range. of Example Macro Definition: .MACRO +.NCHR « IRPC HV = HV"A?CHR? HASH_SYM HV,<SYMBOL> CHR,<SYMBOL> .ENDR . ENDM HASH_SYM SYMBOL MACROS Macro call and expansion of the macro defined above: <MOVC5> HASH_SYM HV,<MOVC5> .NCHR CHR,<MOVC5> .IRPC HV+“A?CHR? HV HV HV o HV w HV uwnun .ENDR HV This HV+"A?M? HV+"A?20? HV+"A?2V? HV+"A?C? HV+"A?5? example characters uses in actual the .NCHR argument. directive to count the number of MACROS .LIBRARY « LIBRARY--MACRO -LIBRARY adds searched libraries specified LIBRARY DIRECTIVE a name whenever are to a to .MCALL the or searched the in assembler. VAX-11 an the MACRO undefined reverse library opcode order is in 1list that encountered. which they is The were If the programmer omits any information from the macro-library-name argument, default values are assumed. The device defaults to the user's disk; the directory defaults to the user's directo ry; and the file type defaults to MLB. DIGITAL recommends line with directive. the The that libraries be specified in the MACRO command /LIBRARY qualifier rather than with the .LIBRARY .LIBRARY directive makes moving files cumbersome. Format -.LIBRARY macro-library-name Parameter macro-library-name A delimited library. string that is the file specification of Example .LIBRARY /DBl:[TEST]USERM/ .LIBRARY ?DBl:SYSDEF.MLB? .LIBRARY \CURRENT.MLB\ ; MACRO LIBRARY USERM.MLB a macro MACROS .MACRO «MACRO--MACRO DEFINITION DIRECTIVE .MACRO begins the definition of a macro. and It gives the macro name If the name specified a list of formal arguments (see Section 6.1). is the same as the name of a previously defined macro, the previous The .MACRO replaced with the new one. definition is deleted and directive is followed by the source text to be included in the macro expansion. The .ENDM directive specifies the end of the range. Macro names do not conflict with user-defined symbols. user-defined symbol can both have the same name. A macro and a When the assembler encounters a .MACRO directive, it adds the macro its macro name table and stores the source text of the macro to name No other ©processing occurs (up to the matching .ENDM directive). until the macro is expanded. The symbols in the formal argument list are associated with the macro to the scope of the definition of that macro. 1limited are and name argument list this name can be any legal the actual For this reason, the symbols that appear in the formal can also appear elsewhere in the program. Format .MACRO macro-name .ENDM [formal-argument-list] [macro name] Parameters macro-name The name of the macro to be defined; symbol up to 15 characters long. formal-argument-list The symbols, separated by commas, to be replaced by arguments in the macro call. range The source text to be included in the macro expansion. MACROS Example Macro definition: MYSYM= .MACRO USERDEF .PSECT DEFS,ABS 5 HIVAL= "XFFF123 LOWVAL= 0 .PSECT RWDATA,NOEXE,LONG TABLE: .BLKL 100 LIST: .BLKB 10 .MACRO USERDEF .ENDM USERDEF - ENDM USERDEF Macro calls 1. and ; expansions USERDF ; .PSECT MYSYM= of the SHOULD NULL TO NULL above: 5§ “XFFF123 0 .PSECT RWDATA,NOEXE,LONG TABLE: BLKL 100 LIST: -BLKB 10 .MACRO USERDEF «ENDM USERDEF 2. the TO EXPAND DATA LOWVAL= In defined IT DEFS,ABS HIVAL= USERDF this some macro REDEFINE macro source ; example, symbols is ; when SHOULD the macro and data called a second IT EXPAND NOTHING is storage REDEFINE called areas time, the and the first then time redefines macro it defines itself. When expansion contains no VAX-11/780 opcode, the text. Notes l. 2. 1If a macro has macro is used allows a macro same has name instead programmer If a macro a the the library, to as a the temporarily same the of name ,MCALL as a redefine VAX-11/780 directive the macro. Otherwise, because the (as the opcode), the assembler libraries., 3. instruction. must symbol is will not an This opcode. opcode be feature used and to is in define already defined search the macro The programmer can redefine a macro with new source text during assembly by specifying a second .MACRO directive with the same name. Including a second .MACRO directive within the original macro definition causes the first macro call to redefine the macro. This is useful when a macro performs initialization or defines symbols; that 1is, when an operation is performed only once. The macro redefinition can eliminate unneeded source text in a macro or it can delete the entire macro. The .MDELETE directive provides another way to delete macros. MACROS -MCALL «MCALL--MACRO CALL DIRECTIVE +MCALL specifies the names of the system and/or user-defined that are required to assemble the source program but are not in the source file. macros defined If any named macro is not found upon completion of the search (that is, 1f the macro is not defined in any of the macro libraries), the assembler displays an error message. Format «MCALL macro-name-list Parameter macro-name-list A list of macros to be defined be separated by commas. for this assembly. The names must W INSQUE SUBSTITUTE e +MCALL LIBRARY we Example MACRO INSTRUCTION FOR IN INSQUE Note +MCALL is provided recommends that unknown symbol in macro libraries. for it not error be used. with expands find the message. .MCALL must be used: when a (see description of .MACRO). When MACRO-11; the macro unknown There 1is macro has VAX-11] DIGITAL an the opcode field, it automatically searches all If it finds the symbol in a library, it uses the macro definition and MACRO does displays an compatibility not MACRO reference. symbol in the one exception the same name finds If VAX-11 library, it for which as an opcode MACROS .MDELETE «MDELETE-~MACRO DELETION DIRECTIVE .MDELETE deletes the definitions of specified macros. The macros actually deleted is printed in the assembly listing line as the .MDELETE directive, number of on the same .MDELETE completely deletes the macro, freeing memory as necessary, whereas the technique of macro redefinition explained 1in the description of .MACRO merely redefines the macro. Format .MDELETE macro-name-list Parameter macro-name-list A list of macros whose definitions must be separated by commas. Example .MDELETE USERDEF, $SSDEF,ALTR are to be deleted. The names MACROS MEXIT +MEXIT--MACRO EXIT DIRECTIVE +.MEXIT terminates a macro expansion before the end of the macro. Termination is the same as if .ENDM was encountered. The directive can also be used within repeat blocks. .MEXIT 1is most wuseful in conditional expansion of macros because it bypasses the complexities of nested conditional directives and alternate assembly paths. Format «MEXIT Example «.MACRO ALTR +.IF N EQ ; START +MEXIT ; TERMINATE «ENDC ; END ; NORMAL - ENDM In this equals N,A,B ALTR example, if 0, conditional expansion the would be the actual terminated argument block by CONDITIONAL MACRO CONDITIONAL END for would be OF the ASSEMBLY BLOCK. EXPANSION. ASSEMBLY BLOCK. MACRO. formal assembled, argument and the N macro .MEXIT. Notes l. 2. 3. When .MEXIT occurs in a repeat block, the terminates the current repetition of the range and further expansion of the repeat range. When macros next higher If or repeat blocks are level of expansion. .MEXIT occurs block, the outside assembler a displays nested, macro an .MEXIT definition error message. assembler suppresses exits or a to the repeat MACROS .NARG +NARG-~NUMBER OF ARGUMENTS DIRECTIVE .NARG determines the number of arguments in the current macro call. .NARG counts all the positional arguments specified including arguments in the macro call, The value (specified by adjacent commas). any keyword assigned to the specified symbol does not include either arguments or any formal arguments that have default values. null Format symbol «NARG Parameter symbol A symbol that 1s assigned arguments in the macro call. a value equal the to number of Example Macro definition: .MACRO CNT ARG Al,A2,A3,A4,A5,A6,A7,A8,A9=DEF9,A10=DEF10 «WORD COUNTER .ENDM CNT_ARG «NARG COUNTER Macro calls and : COUNTER IS SET ; expansions of STORE VALUE TO NO. OF ARGS OF COUNTER the macro defined above: 1. CNT_ARG « NARG «WORD TEST,FIND,ANS COUNTER COUNTER ; ; ; 3 COUNTER WILL COUNTER IS SET TO NO. OF ARGS STORE VALUE OF COUNTER 2. CNT_ARG «NARG COUNTER ; ; COUNTER WILL COUNTER IS SET «WORD COUNTER ; STORE VALUE CNT_ARG «NARG TEST,A2=SYMB2,A3=5Y3 COUNTER ; ; COUNTER WILL COUNTER IS SET «WORD COUNTER ; STORE VALUE ; KEYWORD ARGUMENTS 3. 4, 0 TO NO. OF ARGS OF COUNTER 1 TO NO. OF ARGS OF COUNTER CNT_ARG ,SYMBL,, ; COUNTER WILL 3 « NARG COUNTER ; COUNTER TO -WORD COUNTER ; STORE ; NULL IS SET VALUE OF ARGUMENTS ARE NOT NO. OF COUNTED ARGS COUNTER ARE COUNTED Note If an .NARG error appears outside of message. a macro, the assembler displays MACROS .NCHR «NCHR--NUMBER OF CHARACTERS DIRECTIVE .NCHR determines the number of characters in a specified character string. It can appear anywhere 1in a VAX-1ll MACRO program and is useful in calculating the length of macro arguments. Format .NCHR symbol,<string> Parameters symbol A symbol that characters in is assigned the specified a wvalue character equal to the number of string. <string> must be delimited by angle brackets or a character preceded by circumflex only if the specified character string contains legal separator (comma, space, and/or tab) or a semicolon. A sequence of printable characters. The character string a a Example 2. calls and CHAR expansions of the macro <HELLO> .NCHR CHRCNT,<HELLO> .WORD CHRCNT .ASCII /HELLO/ CHAR <14, «NCHR CHRCNT,<14, 75.39 «WORD CHRCNT +ASCII /14, 75.39 4> 75.39 4/ W CHAR N4 /MESS/ W .ASCII . ENDM STORE VALUE N CHRCNT DEFINE ASSIGN STORE CHARACTERS W +WORD MESS FINISH defined TO CHRCNT above: CHRCNT WILL ASSIGN STORE VALUE STORE CHARACTERS ; 4> MACRO VALUE “o CHAR CHRCNT ,<MESS> Wme 1. +.MACRO « NCHR W Macro definition: we Macro VALUE = 5 TO CHRCNT ; CHRCNT WILL = 12(DEC) ASSIGN VALUE TO CHRCNT ; STORE VALUE i STORE CHARACTERS MACROS .NTYPE «NTYPE--OPERAND TYPE DIRECTIVE .NTYPE determines the addressing mode of the specified operand. The value of the symbol is set to the specified addressing mode. In most cases, an 8-bit (l-byte) value is returned. Bits 0 through 3 are the register associated with the mode, and bits 4 through 7 are the addressing mode. To provide concise addressing information, the mode bits 4 through 7 are not exactly the same as the numeric value of the addressing mode described in Table 4-1. Specifically, literal mode is indicated by a 0 in bits 4 through 7 instead of the values 0 through 3 described in Table 4-1. Mode 1 indicates an immediate mode operand, mode 2 indicates an absolute mode operand, and mode 3 indicates a general mode operand. For indexed addressing mode, a 16-bit (2-byte) value is returned. The high-order byte contains the addressing mode of the base operand specifier and the low-order byte contains the addressing mode of the primary operand (the index register). See the for more VAX-11/780 Architecture information on Handbook or addressing Chapter 4 of this manual modes. Format .NTYPE symbol ,operand Parameter symbol Any legal VAX-11 MACRO symbol. This symbol is assigned a value equal to the 8- or 16-bit addressing mode of the operand argument that follows. operand Any legal address expression, as used argument is specified, 0 is assumed. with an opcode, If no Example Definition: “e ADDRESS AND, AND GENERATES IF NOT, THE MACRO SIMPLY PUSHES THE ARGUMENT ON THE A WARNING STACK MESSAGE. we Wwe W THE FOLLOWING MACRO IS USED TO PUSH AN ADDRESS ON THE STACK. 1IT CHECKS THE OPERAND TYPE (BY USING .NTYPE) TO DETERMINE IF THE OPERAND IS AN Wp W Macro «MACRO A = .NTYPE A@-4&"XF .IF PUSHADR ADDR A,ADDR F2 ; ; IDENTICAL 0,<ADDR> PUSHL #0 JMEXIT ASSIGNS OPERAND TYPE TO A ISOLATE ADDRESSING MODE IS ARGUMENT EXACTLY ; STACK ; EXIT FROM MACRO O ZERO . ENDC W 0 We = »IIF LESS_EQUAL A-1l, ERR=1 - ERR ERR ERR IS TELLS IF MODE IS = 0 FOR ADDRESS, MODE NOT LITERAL ADDRESS 1 WHEN NOT OR IMMEDIATE PUSHAL ERR=1 ERR ADDR .IFF PUSHL ADDR -WARN ; ADDR IS NOT AN ADDRESS of the macro W A-5, IS MODE NOT IS MODE ADDRESS? W EQUAL EQUAL YES, We .IF NO TMy .IIF W MACROS THEN REGISTER STACK ADDRESS STACK OPERAND & WARN . ENDC . ENDM calls 2. 3. expansions PUSHADR (RO) PUSHAL (RO) YES, PUSHADR (R1) [R4] ; VALID ARGUMENT PUSHAL (R1) [R4] ; YES, PUSHADR ; IS STACK ; ; NOT AN ADDRESS THEN STACK OPERAND #1 $#1 Generated PUSHADR RO PUSHL RO that to program. WARNING: #1 IS space, not WARNING: this ,SHOW RO example ZERO NOT AN IS NOT AN ADDRESS THEN STACK listed was & WARN ADDRESS NOT AN ADDRESS is EXPANSIONS, ZERO i ; Generated save BINARY, ADDRESS ; ¥MACRO-W-GENWRN, .SHOW STACK ADDRESS 0 ¥MACRO-W-GENWRN, Note ARGUMENT STACK #0 PUSHADR PUSHL 5. above: VALID PUSHL 4, defined e 1. and e Macro PUSHADR as it OPERAND would specified 1in & WARN appear the if source MACROS .REPEAT «REPEAT--REPEAT BLOCK DIRECTIVE .REPEAT repeats a block of code, a specified number of times, inline with other source code. The .ENDR directive specifies the end of the range. Format .REPEAT expression « ENDR Parameters expression An expression whose value controls the number of times the range is to be assembled within the program. When the expression is less than or equal to 0, the repeat block is not assembled. The expression must not contain any undefined symbols and must be an absolute expression (see Section 3.5). range The source text to be repeated the number of times specified by the value of the expression. The repeat block can contain macro definitions, indefinite repeat blocks, or other repeat blocks. .MEXIT is legal within the range. Example Macro definition: +MACRO «REPEAT COPIES NUM .ASCII /STRING/ STRING,NUM « ENDR «BYTE 0 . ENDM COPIES Macro calls and 1, expansions of COPIES <ABCDEF>,5 .REPEAT 5 .ASCII /ABCDEF/ « ENDR .ASCII .ASCII .ASCII .ASCII .ASCII .BYTE /ABCDEF/ /ABCDEF/ /ABCDEF/ /ABCDEF/ /ABCDEF/ 0 the macro defined above: MACROS . 2. VARB = 3 COPIES <HOW MANY .REPEAT 3 TIMES>,\VARB .ASCII /HOW MANY TIMES/ « ENDR .ASCII +.ASCII .ASCII /HOW MANY TIMES/ /HOW MANY TIMES/ /HOW MANY TIMES/ .BYTE 0 Note The alternate form of .REPEAT is .REPT. APPENDIX ASCII Table each. A-1 lists the ASCII A CHARACTER SET characters Table and the hexadecimal code A-1 Hexadecimal /ASCII Conversion HEX ASCII HEX ASCII HEX ASCII HEX ASCII Code Char. Code Char. Code Char. Code Char. — — m—— e ee e— 00 01 02 03 04 NUL SOH STX ETX EOT 20 21 22 23 24 SP ! " # S 40 41 42 43 44 @ A B 05 06 ENQ ACK 25 26 % & 45 46 07 08 09 0A 0B BEL BS HT LF VT 27 28 29 2A 2B ' ( ) * + 47 48 49 4A 4B 0cC FF 2C ’ oD OE CR SO 2D 2E 2F . / 10 DLE 30 0 11 12 13 14 DC1 DC2 DC3 DC4 31 32 33 34 1 2 3 4 52 53 54 15 NAK 35 5 16 SYN 36 6 17 18 19 1A ETB CAN EM SUB 37 38 39 3A 1B 1C 1D ESC FS GS 3B 3C 3D 1E RS 3E 1F Us 3F OF SI 60 61 62 63 64 \ a b C d E F 65 e 66 G H I J K 67 68 69 6A 6B f g h i j k 4C L 6C 1 4D 4E 4F M N o} 6D 6E m n 50 P 70 P 51 Q R S T 71 q 72 73 74 r s t 55 U 75 u 56 \Y/ 76 v 7 8 9 : 57 58 59 5A W X Y Z 77 78 79 7A w X y pA ; < 5B 5C 5D [ \ 7B 7C 7D { | } 7E ~ 7F DEL = > ? 5E 5F C D ] —_ 6F o for APPENDIX B VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY B.1 The ASSEMBLER DIRECTIVES following table summarizes the VAX-11 MACRO assembler directives. Table B-1 Assembler Directives Format Operation .ADDRESS address-list Stores address +ALIGN keyword [,expression] Aligns successive the location the boundary keyword .ALIGN integer [,expression] Aligns longwords counter specified string Stores the ASCII (enclosed string Stores the a string Stores to the (27integer) string count ASCII delimiters), descriptor +ASCII to the string in delimiters), preceded by .ASCID by location counter boundary specified by .ASCIC of data byte (enclosed preceded by the ASCII string a in string (enclosed in delimiters) .ASCIZ string Stores the ASCII in delimiters) byte. .BLKA expression ’ string followed (enclosed by a 0 Reserves longwords of address data .BLKB expression .BLKD expression Reserves bytes for data Reserves quadwords double-precision, data for floating-point (continued on next page) VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY Table B-1 (Cont.) Assembler Directives Operation Format .BLKF expression Reserves longwords single-precision, for floating-point data .BLKL expression Reserves longwords for data .BLKQ expression Reserves gquadwords for data .BLKW expression Reserves words data .BYTE expression-list Generates successive bytes of data; each byte contains the value of the specified expression .CROSS Enables for cross-referencing of all symbols .CROSS symbol-list Cross-references specified symbols .DEBUG symbol-list .DEFAULT DISPLACEMENT, .DISABLE argument-list .DOUBLE Makes symbol debugger keyword literal-list names known Disables function(s) argument-list Generates specified floating-point Equivalent to .DISABLE .ENABL argument-list Equivalent to .ENABLE .ENABLE Enables function(s) argument-list [macro-name] « ENDR .ENTRY symbol specified in Indicates logical end of source program; optional symbol specifies transfer address [symbol] . ENDC .ENDM in 8-byte, .DSABL argument-list .END the Specifies the default , displacement length for the relative addressing modes double-precision, data argument-list to [,expression] Indicates end of assembly block conditional Indicates end of macro Indicates end of repeat Procedure entry directive (continued on definition block next page) VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY Table B~-1 (Cont.) Assembler Directives Format .ERROR Operation [expression] j;comment +.EVEN Displays Ensures counter if .EXTERNAL .EXTRN specified symbol-list symbol-list +FLOAT literal-list it symbol-list message that the current location has an even value (adds 1 is odd) Indicates specified externally defined Equivalent Generates to symbols are .EXTERNAL 4-byte, single-precision, data .GLOBAL error floating point Indicates specified symbols symbols are global . GLOBL Equivalent +IDENT string Provides means of labeling object module with additional data .IF condition argument (s) to .GLOBAL Begins a conditional assembly block of source code which is included in the assembly only if the stated condition is met with respect to the argument (s) specified . IFF Equivalent .IF_FALSE Appears only within a conditional assembly block; begins block of code to be assembled if the original condition tests false «IFT Equivalent to .IF_TRUE «IFTF Equivalent to .IF_TRUE_FALSE .IF_TRUE Appears to only .IF_FALSE within a conditional assembly block; begins block of code to be assembled if the original condition tests true .IF_TRUE_FALSE Appears only within a conditional assembly block; begins block of code to be assembled unconditionally (continued on next page) VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY Table B- 1 Assembler (Cont.) Directives Operation Format fi= .IIF condition argument(s), statement Acts as l1-1line a conditional assembly block where the condition is tested for the the argument specified; statement is assembled only if the condition tests true .IRP symbol, <argument list> Replaces a formal argument with successive actual arguments specified in an argument list .IRPC symbol, <string> Replaces a formal argument with successive single characters specified ‘in string .LIBRARY macro-library-name Specifies a macro library .LIST Equivalent to [argument-list] .LONG expression-list .SHOW Generates successive longwords of each longword contains the data; value of the specified expression. .MACRO macro-name argument-list Begins a macro definition .MASK symbol Reserves a word for and copies a [,expression] .MCALL macro-name-list register Specifies the system and/or user-defined macros in libraries that are required to assemble the source .MDELETE macro-name-list save mask Deletes program from memory the macro definitions of the macros in the list Exits from the expansion of a macro before the end of the macro «MEXIT is .NARG symbol encountered Determines the number of arguments in the current macro call .NCHR symbol,<string> Determines the number of characters in a specified character string .NLIST Equivalent [argument-list] .NOCROSS to .NOSHOW Disables cross-referencing of all symbols (continued on next page) VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY Table B- 1l (Cont.) Assembler Directives Operation Format .NOCROSS Disables cross-referencing of specified symbols symbol-list - NOSHOW Decrements .NOSHOW argument-list Controls listing of macros and conditional assembly blocks .NTYPE Can appear only within a macro definition; equates the symbol to the addressino mode of the specified operand symbol ,operand listing level count Ensures that the current location .ODD counter has an odd value if it is even) Defines an opcode operand list .OPDEF opcode value, operand~descriptor-list . PACKED decimal-string [,symbol] . PAGE and (adds 1 data, 2 its Generates packed decimal digits per byte Causes the assembly listing to skip to the top of the next page, and to increment the page count . PRINT [expression] }comment Displays the specified message - PSECT Begins or resumes the blank program section .PSECT section-name argument-list Begins or resumes a user-defined program section .QUAD literal Stores 8-bytes of data .QUAD symbol Stores 8-bytes of data .REF1 operand Generates byte operand «REF2 operand Generates word operand .REF4 operand Generates .REF8 operand Generates quadword operand longword operand .REPEAT expression the Begins a repeat block; section of code up to the next .ENDR directive is repeated the number of times specified by the expression «REPT Equivalent to .REPEAT (continued on next page) VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY Table B-1 (Cont.) Assembler Directives Format Operation . RESTORE Equivalent .RESTORE_PSECT Restores program section from the program section stack .SAVE Equivalent [LOCAL_BLOCK] -SAVE_PSECT [LOCAL_BLOCK] to to .RESTORE_PSECT context context .SAVE_ PSECT Saves current program section context on the program section context stack .SBTTL comment~string Equivalent to . SHOW Increments listing .SHOW argument-list Controls listing of macros and conditional assembly blocks .SIGNED BYTE expression-list Stores successive bytes of signed data (8 -.SIGNED_WORD expression-list Stores successive words of signed data (16 .SUBTITLE level count bits) bits) .SUBTITLE comment-string Causes the specified string to be printed as part of the assembly listing page header; the string component of each .SUBTITLE is collected into a table of contents at the beginning of the assembly listing .TITLE module-name Assigns the first 15 characters the string as an object module name and causes the string to appear on each page of the assembly listing comment-string .TRANSFER symbol .WARN [expression] in Directs the linker to redefine the value of the global symbol for use in a shareable image j;comment Displays specified warning message .WEAK symbol-list Indicates that each of the listed symbols has the weak attribute .WORD expression-list Generates successive words of data; each word contains the value of the corresponding specified expression VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY B.2 The SPECIAL CHARACTERS following table summarizes the VAX-11 Table Special Character Characters Character Used MACRO special characters. B-2 in VAX-11 MACRO Statements Name Function (s) _ Underline Character in symbol names $ Dollar Character in symbol names . Period Character in names, sign symbol current location counter, decimal point : Colon = Equal # Label sign terminator Direct assignment macro keyword Tab Field terminator Space Field terminator Number sign and operator argument and terminator Immediate addressing mode indicator @ At sign Deferred addressing mode indicator and arithmetic shift operator ’ Comma Field, operand, and item separator ; Semicolon Comment + Plus Autoincrement sign field indicator addressing mode indicator, unary plus operator, and arithmetic addition operator - Minus sign Autodecrement indicator, arithmetic and * Asterisk line addressing mode unary minus operator, subtraction operator, continuation indicator Arithmetic multiplication operator / Slash Arithmetic division operator & Ampersand Logical AND ! Exclamation point Logical inclusive operator OR operator (continued on next page) VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY B-2 Table (Cont.) Special Characters Used in VAX-1l MACRO Statements (s) Function Character Name Character Logical exclusive OR and numeric Backslash \ conversion indicator in macro arguments Unary operator indicator and ° Circumflex [] Square brackets () Parentheses Register deferred addressing mode <> Angle brackets Argument or expression grouping ? Question mark Created label indicator in macro ! Apostrophe Macro argument concatenation $ Percent sign Macro string operators B.3 macro argument delimiter Index addressing mode and repeat count indicators indicators delimiters arguments indicator OPERATORS Unary Operators B.3.1 The following table summarizes the VAX-1l MACRO unary operators. Table B-3 Unary Operators Unary Operator Operator Effect Example Name m + Plus sign +A - Minus sign -A Results in the positive value of A (default) Results in the negative (2's complement) value of A “B Binary “B11000111 Specifies that 11000111 is a binary number (continued on next page) VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY Table B-3 Unary Unary Operator Operator Name D (Cont.) Operators Example Decimal Effect D127 Specifies that decimal "0 Octal 034 Specifies that octal X Hexadecimal “XFCF9 ASCII 34 is an number Specifies that FCF9 is a “A 127 is a number “A/ABC/ hexadecimal number Produces an ASCII string; the characters between the matching delimiters are converted to ASCII representation M Register mask “M<R3,R4,R5> | Specifies the registers R3, R4, and RS register mask °F Floating point e “F3.0 Complement “Cc24 in the Specifies that 3.0 is a floating-point number Produces the 1l's complement value of 24 (decimal) B.3.2 The Binary Operators following table summarizes the VAX-11l Table B-4 MACRO binary operators. Binary Operators Binary Operator Operator Name Example Operation = + Plus - Minus * sign =5 A+B Addition A-B Subtraction Asterisk A*B Multiplication / Slash A/B Division @ At sign A@B Arithmetic & Ampersand A&B Logical AND ! Exclamation point A!B Logical inclusive OR \ Backslash A\B Logical exclusive OR sign Shift VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY B.3.3 Macro String Operators The following table summarizes the operators can be used only in macros. Table Macro String macro string $LOCATE (stringl,string2[,symbol]) Operators Function Returns the length of the string Locates the substring stringl within string2 starting the search at the character position specified by $EXTRACT (symboll,symbol2,string) These B-5 Format $LENGTH (string) operators. symbol Extracts a substring from string that begins at character position specified by symboll and has a length specified by symbol2 B.4 ADDRESSING MODES The following table summarizes the VAX-11 MACRO addressing modes. oTeI9dUAduuuKAIa1gDyyyyu93Hy3y‘uusSuo1ouToebrHryjp19TiOOsuePSI1s3paO1sdsueoeNwUet1siiuSa911JhddHeud3ib1xxXdeadoosxsdqu1y9d3ra9aqbb3oduususlorteq1npdAHyubhyaIs1oyr1rn3poo6aYes9s3aouga(uT3nlYddyylueUssyWgT)w9Suyiu©rdpb+Ie‘eonoy3*l9wogujd*d-ieuseaylldslzjSa@edouw1qo“°e‘pcJZ*dzdTou1eaYe0¥ynT3f1dJ°tX0s89YSeT¥9Ap®3UToRNjXIYuA{say1yrpjq3e93L3uuoJSzyaedDoas3wiy-uiz1p3Walbebuxuaea@o38edI9rdyoyi9dsizlaUeIeadqTSsu1oqo‘saolyuqdtr8i3YyTvs3ajeyx83doojyyip*1‘ul3ogdoa1jo4wgsdys9us3we3a3e95183qlYs0d1pgy9sj06lu3u3z91oSedsd1de)issSpau3dSdeIo3a1Upa9edP3ejokUe0pJDO9yléoTqOseoN9xapur sTeIadi3p1e adA3 91-q4eLd S .5 uor3odes *(€°% psnurluUO0D)uo3x3u(ebed b u i s a i p y S 9 p P O W b193st1boy ursaipy T-eBwXr3oHap , VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY uy B-11 Xy VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY B-12 bursaipy Tewroap 3x3u(abed aweidb&oyigS99p3APeTOTINpRaTuwIuYwysJTBeWaxI1aOp3IIeT¥#anteAaYyLlsT[eoIi9p3uTe[otappdaarTTi33otTsooaagddssSSTT9Yy3lléda1qsOeaNxapur VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE SUMMARY Sps93a6osdnyYraf1i3Top1slLxpoqeay#eds s_SpadBrM19jT0r1e3odpsseJ‘sw3¢Mau1os_pw{ia'deaDgr1z9stp ITSpe2¢8Rpau1y3eT0i3las#d_o bursaipy sS9pon a1qer 9-g (*3u0) 193Uno)sai1pe_g\'4saipeJoayx{pueiadoay3 ‘pqiuaowdmobe1udsoItp Spasur1jT0re3oasds ‘p1se9ioi3m0ob&umoqr -BX9H | — B-13 piompenb odAg (*3u0) youeag 9PON x 3 B W I 0 g I23Uno) 3aps¢YIa‘swoBTpodpy1L2eToglUusaai1y3ueTiikSsgbj3IppssSrlapJ3j{oIopdPeeud3aDruodls1idwwop3pJS-saxouy9‘ea0eely9sxIsolaTueaylqep‘BSp[3uleuYa1Iydrt3e9y9ss{Jrxi3lio‘®sjXU3as{nx1t1r9ptd09Ta3jsIou3boi10aetssap03ydri11g9soeaSabw$edjupd£ha9{seoe8d‘S1Dpio0yT3dS3eqlT91[ney99SJd3lTUTdtypwsuplAo29ITnUo3u1paA9s3ua0esylm3ielJstsqqo1 bwxoepiubroigyXouaupteusirgaippv spouw-aseq[xy4]TewIOap3aaj9ypoy3ollw3-Ysaysedq1Sp3Usue3uoate3iUdJ1dI0optDarqakiyJ3oyOApszuaeqXpyub9eypaluraesdsjoao9anylp-{ oeid ¢9Tqexapur VAX-11 MACRO ASSEMBLER DIRECTIVES AND LANGUAGE s8x ON sa1pe_»o B-14 SUMMARY ON ‘ I 9 S d 1 g Y y e 1 3 U 0 e I d l 3 0 T S 1 a 1 S 2 a 3 n s u I f T o p e s g A E Y s A p 9 a 3 u f I o l e q s T u d n M w o S Y U O y T I o 3 1 u O N e I J i I S q U T °9(1*-3que90LD)bSuiOspaOiaWpv -BX3H saipe Teauan ~ 7 APPENDIX C PERMANENT SYMBOL T2 iLE The permanent symbol table (PST) contains the symbols that VAX-11 MACRO automatically recognizes. These symbols consist of both opcodes and assembler directives. Sections C.1 and C.2 below present the opcodes (instruction set) in alphabetical and numerical order, respectively. Appendix B (in Section B.l) presents the assembler directives. The VAX-11/780 Architecture of the instruction set. C.1 OPCODES Hexadecimal Value Handbook provides a detailed description (ALPHABETIC ORDER) Mnemonic Functional Name 9D ACBB Add compare and branch byte 6F 4F Fl ACBD ACBF ACBL Add Add Add compare compare compare and and and branch branch branch double floating long 3D 58 80 81 ACBW ADAWI ADDB2 ADDB3 Add Add Add Add compare and branch word aligned word interlocked byte 2 operand byte 3 operand 60 61 40 41 ADDD2 ADDD3 ADDF2 ADDF3 Add double 2 operand Add double 3 operand Add floating 2 operand Add floating 3 operand Cco ADDL2 Add Cl 20 21 ADDL3 ADDP4 ADDP6 Add long 3 Add packed Add packed AQ Al D8 F3 F2 78 F8 ADDW2 ADDW3 ADWC AOBLEQ AOBLSS ASHL ASHP Add word 2 operand Add word 3 operand Add with carry Add one and branch on less or equal Add one and branch on less Arithmetic shift long Arithmetic shift and round packed 79 El ASHQ BBC Arithmetic shift quad Branch on bit clear E5 E7 E3 BBCC BBCCI BBCS Branch Branch Branch on on on bit bit bit clear clear clear EQ BBS Branch on bit set long 2 operand operand 4 operand 6 operand and and and clear clear set interlocked PERMANENT SYMBOL TABLE Hexadecimal Value Mnemonic Functional Name on on E4 E2 BBSC BBSS Branch Branch bit bit set set and and clear set E6 BBSSI Branch on bit set and set 1E 1F 13 BCC BCS BEQL Branch on carry clear Branch on carry set Branch on equal 14 BGTR Branch 1A BGTRU Branch on greater 8A BICB2 Bit clear 8B CA CB B9 AA AB 88 BICB3 BICL2 BICL3 BICPSW BICW2 BICW3 BISB2 Bit Bit Bit Bit Bit Bit Bit clear byte 3 operand clear long 2 operand clear long 3 operand clear program status word clear word 2 operand clear word 3 operand set byte 2 operand 89 Cc8 A8 A9 93 D3 BISB3 BISL2 BISL3 BISPSW BISW2 BISW3 BITB BITL Bit set byte 3 operand Bit set long 2 operand Bit set long 3 operand Bit set program status word Bit set word 2 operand Bit set word 3 operand Bit test byte Bit test 1long B3 BITW Bit E9 E8 15 1B 19 1F 12 BLBC BLBS BLEQ BLEQU BLSS BLSSU BNEQ test word Branch on low bit clear Branch on low bit set Branch on less or equal Branch on less or equal Branch on less Branch on less unsigned Branch on not equal 12 03 11 31 10 30 1C 1D BNEQU BPT BRB BRW BSBB BSBW Branch on not equal unsigned Break point trap Branch with byte displacement Branch with word displacement Branch to subroutine with byte displacement Branch to subroutine with word displacement BVC BVS Branch Branch 13 18 1E c9 B8 BEQLU BGEQ BGEQU interlocked Branch on equal unsigned Branch on greater or equal Branch on greater or equal on unsigned greater byte 2 unsigned operand unsigned on overflow clear on overflow set FA CALLG Call with general FB 8F CF AF CALLS CASEB CASEL CASEW Call with Case byte Case long Case word BD CHME Change mode to executive BC CHMK Change mode to kernel BE CHMS Change mode to supervisor BF CHMU Change to user 94 CLRB Clear mode byte argument list stack ’ PERMANENRT SYMBOL TABLE Hexadecimal Value 7C DF D4 CLRD CLRF CLRL 91 CLRQ CLRW CMPB 29 2D 71 51 CMPC3 CMPC5 CMPD CMPF D1 CMPL 35 37 CMPP3 CMPP4 EC 7C B4 Functional Mnemonic Name d ouble £ loat 1 ong q uad w ord Compare byte Clear Clear Clear Clear Clear Compare Compare character character 3 operand 5 operand Compare Compare Compare double Compare CMPV Compare Compare packed packed field Bl CMPW Compare word ED CMPZV Compare zero-extended 0B 6C CRC CVTBD 4C 98 99 68 CVTBF CVTBL CVTBW CVTDB byte to long byte to word Convert double to byte 76 6A 69 48 CVTDF Convert double to CVTDL CVTDW CVTFB Convert 56 4A 49 CVTFD CVTFL CVTFW Convert Convert Convert F6 CVTLB Convert double to long double to word float to byte float to double float to long float to word long to byte 6E 4E CVTLD CVTLF Convert F9 CVTLP F7 CVTLW Convert Convert 36 08 24 Convert 6B CVTPL CVTPS CVTPT CVTRDL 4B 09 26 33 6D 4D 32 97 CVTRFL CVTSP CVTTP CVTWB CVTWD CVTWF CVTWL DECB Convert Decreme nt byte D7 B7 DECL DECW Decreme nt long word 86 87 66 DIVB2 DIVB3 DIVD2 67 46 47 DIVD3 DIVF2 DIVF3 floating long 3 operand 4 operand field Calcula te cyclic redundancy Convert byte to double Convert byte to float check Convert Convert Convert Convert Convert Convert Convert Convert Convert Convert Convert Convert Convert Convert float long to double long to float long to packed long to word packed to long packed to leading separate packed to trailing rounded double to long rounded float to long leading separate to packed trailing to packed word to byte word to double word to float word to long Decreme nt Divide byte 2 operand Divide byte 3 operand Divide double 2 operand Divide double 3 operand Divide floating 2 operand Divide floating 3 operand PERMANENT SYMBOL TABLE Hexadecimal Value coé DIVL2 C7 27 DIVL3 DIVP A6 A7 DIVW2 DIVW3 38 74 EDITPC EDIV EMODD 54 7A EMODF EMUL EE EXTV EF EXTZV 7B Functional Mnemonic Name Divide long 2 operand Divide long 3 operand Divide packed Divide word 2 operand Divide word 3 operand Edit packed to character Extended divide Extended modulus double EB FFC EA FFS Extended modulus floating Extended multiply Extract field Extract zero-extended field Find first clear bit Find first set bit 00 96 HALT INCB Halt Increment D6 B6 INCL INCW Increment long Increment word oA INDEX 0OE INSQUE Index calculation Insert into queue Insert field byte FO INSV 17 16 06 JMP JSB LDPCTX Jump 3A 39 92 D2 B2 LOCC MATCHC MCOMB MCOML MCOMW Locate character Match characters Move complemented byte Move complemented long Move complemented word DB MFPR Move from processor 8E 72 MNEGB MNEGD Move Move negated negated Jump to subroutine Load program context register byte double 52 MNEGF Move negated CE MNEGL AE MNEGW 9E 7E MOVAB MOVAD DE DE MOVAF MOVAL 7E MOVAQ Move negated long Move negated word Move address of byte Move address of double Move address of float Move address of long Move address of quad floating 3E 90 28 2C 70 50 DO 34 MOVAW MOVB MOVC3 MOVC5 MOVD MOVF MOVL MOVP Move address of word Move byte Move character Move character Move double Move float Move long Move packed 3 operand 5, operand PERMANENT SYMBOL TABLE Hexadecimal Value Mnemonic Functional Name DC MOVPSL Move program 7D MOVQ Move quad status 2E MOVTC Move translated characters 2F B0 MOVTUC MOVW Move Move translated word until 0A MOVZBL Move 2zero-extended 9B 3C MOVZBW MOVZWL Move Move byte zero-extended byte zero-extended word DA MTPR Move to processor 84 85 64 MULB2 MULB3 MULD2 Multiply byte 2 operand Multiply byte 3 operand Multiply double 2 operand 65 MULD3 Multiply double 44 45 C4 MULF2 MULF3 MULL2 Multiply Multiply Multiply floating 2 operand floating 3 operand long 2 operand long 3 longword character 3 long word long operand MULL3 Multiply 25 A4 MULP MULW2 Multiply packed Multiply word 2 operand A5 MULW3 Multiply 01 75 55 NOP POLYD POLYF No operation Evaluate polynomial Evaluate polynomial BA POPR Pop 0C 0D 9F 7F PROBER PROBEW Probe read access Probe write access Push address of byte Push address of double 3 to to register C5 word to operand operand double floating registers DF PUSHAB PUSHAD PUSHAF Push address of float DF 7F 3F PUSHAL PUSHAQ PUSHAW Push Push Push address address address of of of long quad word DD BB PUSHL PUSHR Push Push long registers 02 REI Return from exception or OF 04 REMQUE RET Remove Return from queue from called 9C 05 D9 ROTL RSB SBWC interrupt procedure Rotate long Return from subroutine Subtract with carry 2A SCANC Scan 3B F4 SKPC SOBGEQ Skip character Subtract one and for character branch on greater F5 SOBGTR Subtract branch greater 2B SPANC Span characters 82 83 62 SUBB2 SUBB3 SUBD2 Subtract byte 2 Subtract byte 3 Subtract double 63 42 43 C2 C3 SUBD3 SUBF2 SUBF3 SUBL2 SUBL3 Subtract Subtract Subtract Subtract 22 SUBP4 Subtract long 3 operand Subtract packed 4 operand 23 SUBP6 Subtract one and on operand operand 2 operand double 3 operand floating 2 operand floating 3 operand long 2 operand packed C-5 6 operand or equal PERMANENT SYNMBOL TABLE Hexadecimal Value A2 A3 07 95 73 53 Mnemonic Functional Name SUBW2 SUBW3 SVPCTX TSTB TSTD TSTF Subtract word 2 operand Subtract word 3 operand Save process context Test byte Test double Test float D5 TSTL Test long B5 TSTW Test word FC XFC Extended 8C 8D XORB2 XORB3 Exclusive-OR byte Exclusive-OR byte 2 operand 3 operand Cb AC AD XORL3 XORW2 XORW3 Exclusive-OR long Exclusive-OR word Exclusive-OR word 3 operand 2 operand 3 operand CcC XORL2 function call Exclusive-OR long 2 operand PERMANENT SYMBOL TABLE APPENDIX D HEXADECIMAL/DECIMAL CONVERSION Table D-1 lists the decimal value for each possible hexadecimal value in each byte of a 1longword. The following sections contain instructions to use the table to convert hexadecimal numbers to decimal and vice versa. D.1 HEXADECIMAL TO DECIMAL For each integer position of the hexadecimal value, 1locate the corresponding column integer and record its decimal equivalent in the conversion table. Add the decimal equivalent to obtain the decimal value. For example: DO500ADO D.2 (16) = ?2(10) D0000000 500000 = = 3,489,660,928 5,242,880 AQ0O DO = = 2,560 208 DO500ADO = 3,494,904,576 DECIMAL TO HEXADECIMAL Step 1l: locate in the conversion table the largest decimal value that does not exceed the decimal number to be converted. Step 2: record the hexadecimal equivalent followed by the number of O0s that corresponds to the integer c¢olumn minus 1. Step 3: subtract the table decimal value from the decimal number to be converted. Step 4: repeat steps 1 through 3 until the subtraction balance equals 0. Add the hexadecimal equivalents to obtain the hexadecimal value. HEXADECIMAL/DECIMAL CONVERSION Example: 22,466 (10) = ?(16) 20,480 1,792 = = 5000 700 -20,480 192 2 = = Co 2 ——e 1,986 s = — 22,466 = 57C2 22,466 - 1,792 - 194 192 2 - 2 0 D.3 POWERS OF 2 AND 16 This section lists the decimal values values are often useful in converting Powers of 2 Powers of of powers of 2 decimal numbers 16 2%*%n n 16**n n 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 16 256 4096 65536 1048576 16777216 268435456 4294967296 68719476736 1099511627776 17592186044416 281474976710656 4503599627370496 72057594037927936 1152921504606846976 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 and 16. These to hexadecimal. 01L67 v6ZO18’T86VWTL06‘E’6LSTO8V’°‘TC006© v$ LZ TrI69S‘8'‘Ov8B6P0VT°‘0LGIYT06v 0LT P$ 7Zv8goTE/‘LvoE6bVTe’‘6YL0 067L T©PSz¥L81’/‘’6289Ss20P064L 7%Z89L€89/‘'981¢C0 067L|YZbeoR6gAL‘'c0T026LN ZA719T0A07L6 064L 9Vog)90T9€T8L0w’’‘‘pC0sST6zs9Lee’'°iw0C8TSz996e’'°’‘TCtz¥Og990T96LST2£’‘°’'Z€6L9PZES’’‘'L0POT89OTTZV9O9¥09TI£9‘6€L1‘’‘6TPG28E8S9SP‘’T9TOZ6TpTWOg9099TE6€ZW8‘’‘G09€6Z86SLLE9VO99¥092X4ZG9S06YT‘‘Rs06SyFbVO9g¥9Z0¢9L1€G8o96‘’‘CgTzVO94¥09TL996T1¥D9g001ZT19 X3S€8rdH0E€8V82Z99/1‘€0L6€3’‘8d9T0V'L/£T8L’h'P5E9T0’E‘8TSCX38G€ZH8Z08TLeb8w'90'L’°o‘T39wItd8sZe'’°®‘€Eos8TeXd8€ZSH880Zs0Tsg9LT’(S’‘¢8¥LzowI6k¢v’0£z‘’’ECSsX38S€ZH0T880L9o92O‘3’''La9%TZ6E¢1ST€X38Z€SH88‘90ZL26D2'13‘02’d82ZS¥T¢8%XI8SZ€H08%D8¥IZ8Z0A'91‘LTsCXd8S€AIHO8002843v18dXdZ€8SH04S83 HEXADECIMAL/DECIMAL CONVERSION 969Ts.€h06Z‘’s‘1Le8’2v%L608'9Y12T oL JYOMONO1 INDEX A 3-12, mode, 4-15, 4-13, program Accuracy 3-13 Autodecrement 4-16 5-45 .ADDRESS directive, 5-3 Address, starting, 5-21, Autoincrement of, 4-2 through B-11 through B-14 .ALIGN directive, 5-4, 5-3 Autoincrement mode, AMA attribute, AND operator, AP register, 4-8 Base 5-5 .BLKA directive, .BLKB directive, 5-18 .BLKD directive, .BLKF directive, .BLKL directive, operator, Arithmetic in macros, through .BLKQ directive, .BLKW directive, 6-6 6-8 3-5 shift, 3-16 trap enable, .ASCIC directive, .ASCID directive, 3-13, .BLKx directive, labels, 3-7, 3-8 storage directives, Branch 3-14 Byte 5-7 5-8 set, A-l hexadecimal conversion, memory for, directive, 5-11 .BYTE A-1 storage through .ASCIZ directives, Assembler summary B-1 Call 5-65, of, 6-1 Changes 2-3, 5-1 through 6-17 5-1, 5-2, B-6 functions, 6-2, 5-18 separating, through 5~20 Assigning a value, 3-17 Assignment statements, 3-17, 3-18 indefinite repeat block, through Assembler 3-15 instruction, 5-22, 5-23 from VAX-11 MACRO V1.0, Character, 5-8 directives, through 6-29 5-9 C ~C operator, 5-6 5-8 directive, 5-11, 3-14 strings, 3-12, 3-13, 5-6 string storage, 5-6 through 5-8 .ASCIXx 5-9 4-18 data, reserving character 3-12, instruction, initializing memory with, 5-56 ASCII, operator, through Block Block 4-13 3-12 4-16 5-48 3-5 6-1 pointer, Arithmetic 4-15, 5-45, Argument, macro, mode, 4-7 4-12, 3-11, 5-5 3-16 concatenation 4-10, "B unary operator, 4-5, 4-15, specifier, through 5-4, 5-5 location counter, 5-25, 5-39 section, B” displacement 4-6, Binary operators, 3-15 3-17, B-9 Binary radix, 3-12 Blank lines, 2-2 Alignment, data, 5-4, program index mode, 4-16 5-22 Address, transfer, 5-21, 5-22 Addressing modes, 2-3, 4-1 through 4-18 summary 4-15 Autodecrement mode, 4-8 Autoincrement deferred index mode, 4-15, 4-16 Autoincrement deferred mode, 4-7, 4-8 floating-point numbers, 3-4 Addition, 3-15 Address data, initializing memory with, reserving memory for, 5-9 section, 5-48 index mode, 4-16 4-14 sections, of program through U1U'IU'IU'IQ:1UIU1(J'I Absolute, index mode, 5-44 | WO OWOWWOWYWYWLY “A operator, Attributes, set, 3-1, set, ASCII, ix 6-16, 3-3 3-2 A-1 special, 3-1 3-2, B-7, B-8 strings, 3-12, 3-13, 5-6 Characters, counting, 6-9, 6-25 Combining arguments Index-1 in macros, 6-6 INDEX Default values of macro Comment field, 2-1, 2-4 Complement operator, 3-15 arguments, 6-3 Deferred mode, autoincrement, 4-7 displacement, 4-9, register, 4-6 relative, 4-13 Defining, labels, 2-2 macros, 6-19, 6-20 Concatenated program sections, 5-46 Concatenating arguments in macros, 6-6 Conditional assembly blocks, 5-29 through 5-35 controlling listing of, 5-54, 5-55 one line block, 5-35 subconditionals, 5-32 through 5-34 Condition tests, 5-30 Continuation lines, 2-2 Continuing program sections, 5-44 Controlling listings, 5-54, 5-55 Counted ASCII string storage, 5-7 Counter, current location, 3-18 Counting characters, 6-9, 6-25 Counting macro arguments, Counts, repeat, 5-56, 5-57, 3-10, 6-24 5-11, 5-37, 5-65 .CROSS directive, 5-13, 5-14 Cross reference listing, 5-13, 5-14 Current location counter, opcodes, 5-40, 5-41 Degree of precision, 3-4 Deleting a macro, 6-22 Delimited ASCII strings, 5-6 Delimiters in macro arguments, 6-4 through 6-6 Descriptors, string, 5-8 Direct assignment statements, 3-17, 3-18 Directives, 2-3, 3-5, 5-1 through 5-65, 6-1 through 6-29 .DISABLE directive, 5-16, 5-18 through 5-20 LOCAL_ BLOCK attribute, 3-8 Disabling assembler functions, 5-16, Data, Data, mode, reserving memory for, 5-9 initializing memory with, 4-8, 4-9 specifier, 4-8 4-12, Division, 4-16 through 4-10, 4-13 3-15 Documenting a program, 2-4 .DOUBLE directive, 5-17 Double precision, 3-4, 5-17 Double-precision data, initializing memory with, 5-17 reserving memory for, 5-9 .DSABL directive, 5-16, 5-18 through 5-20 DV arithmetic trap enable, Debugging information, 5-15, 5-18 Decimal/hexadecimal conversion, 'D-1' through D-4 Decimal radix, 3-11, 3-12 Decimal strings, 3-4, 3-5, 5-42 .DEFAULT directive, 5-16 Default program sections, 5-44, 5-48 Default radix, 3-11 through 5-20 controlling default, 5-16 deferred index mode, 4-15, deferred mode, 4-9, 4-10 index mode, 4-15, 4-16 3-12 address, 5-3 ASCII, 5-6 through 5-8 byte, 5-11, 5-56 double-precision, 5-17 floating-point, 5-26 longword, 5-37 packed decimal, 5-42 quadword, 5-49 signed, 5-56, 5-57 word, 5-57, 5-65 DBG attribute, 5-18 .DEBUG directive, 5-15 5-18 Displacement, 3-18 D “D unary operator, 3-11, Data alignment, 5-4, 5-5 4-10 .ENABIL directive, 5-20 .ENABLE directive, 3-14 5-18 through 5-18 through 5-20 LOCAL_BLOCK attribute, 3-8 Enabling assembler functions, through 5-20 .END directive, 5-21 Index-2 5-18 INDEX .ENDC directive, 5-21, 5-29 through 5-31 Ending, conditional assembly blocks, 5-21, 5-29 through 5-31 macro definitions, 6-13, 6-19, 6-20 modules, Format, Functions, repeat range definitions, 6-13, 6-14 through 6-16 .ENDM directive, 6-13, 6-19, 6-20 .ENDR directive, 6-13 through 6-16 .ENTRY directive, 5-22, 5-23 Entry mask, 3-13, 3-14, 5-22, 5-23, 5-38 .ERROR directive, 5-24 Exclusive OR operator, 3-17 Executable program sections, 5-44 through 5-46 Expanding a macro, 6-1, Exponent, 3-4 6-2 Expressions, 3-9, 3-10 evaluation of, 3-9 floating point, 3-14 restrictions on, 3-10 .EXTERNAL directive, 5-25 External symbols, 3-7, 5-25, assembler, through 2-2 5-18 through GBL attribute, 5-18, 5-19 General mode, 4-15 General registers, 3-5 General register modes, 4-1 through 4-12 .GLOBAL directive, 5-27 Global program sections, 5-46 Global symbols, 2-2, 3-7, 3-17, 5-18, 5-19, 5-25, 5-27, 5-64 defining, 2-2 weak, 5-64 5-27 H 5-27, Hexadecimal/ASCII conversion, A-1l Hexadecimal/decimal conversion, string operator, .EXTRN directive, 5-25 .EVEN directive, 5-25 Exiting a macro, 6-13, G .GLOBL directive, '6-11 D-1 through D-4 Hexadecimal radix, 3-12 6-19, 6-20 F “F operator, 3-14, 3-15 Factors, repetition, 3-10, 5-37, 5-56, 5-57, 5-65 Field, comment, 2-1, 2-4 I~ addressing mode, 4-14, . IDENT directive, 5-28 rounding of, 5-18, 5-19 truncation of, 5-18, 5-19 Floating-point operator, 3-15 Floating-point short literals, 4-15 Identifying a module, 5-28, .IF directive, 5-29 through 5-60 5-31 through 5-11, label, 2-1 through 2-3 operand, 2-1, 2-3, 2-4 operator, 2-1, 2-3 .FLOAT directive, 5-25 Floating-point data, initializing memory with, 5-17, 5-26 reserving memory for, 5-9 Floating-point expressions, 3-14 Floating-point numbers, 3-3, 3-4, 3-14, 3-15 format of, 3-4 4-11 2-1 5-20 5-21 5-64 $EXTRACT macro statement, 2-4 Formatting with tabs, 2-1, FP register, 3-5, 3-14 FPT attribute, 5-18, 5-19 Frame pointer, 3-5 .IF_FALSE directive, 5-32 5-34 .IF_TRUE directive, 5-32 through 5-34 .IF_TRUE_FALSE directive, 5-32 through 5-34 .IFF directive, 5-32 through 5-34 .IFT directive, 5-32 through 5-34 .IFTF directive, 5-32 through 5-34 .IFx directives, 5-32 through 5-34 .IIF directive, 5-35 Immediate conditional block, 5-35 Imnmediate mode, 4-14 Inclusive OR operator, 3-17 Indefinite repeat blocks, 6-14, 6-15 Indefinite repeat character blocks, 6-16, 6-17 Index mode, 4-15 through 4-18 Index-3 INDEX Initializing memory with, address data, 5-3 ASCITI data, 5-6 through 5-8 byte data, 5-11, 5-56 floating-point data, 5-17, 5-26 longword data, 5-37 packed data, 5-42 quadword data, 5-49 word data, 5-57, 5-65 Instructions, 1-1, 2-3, C-1 Local program sections, 5-46 2LOCATE macro string operator, 6-10, 6-11 Location counter, 3-18 alignment, 5-4, 5-5, 5-28, 5-35 Logical AND operator, 3-16 Logical exclusive OR operator, 3-17 Logical 3-5, .LONG directive, through C-8 redefining, 5-40, 6-20 Integer expressions, 3-9, Integers, 3-3 initializing memory with, reserving memory for, 5-9 LSB attribute, 3-8, 5-19 3-10 symbols, 2-2, 3-7, .IRP directive, 6-14, 6-15 3-17 .IRPC directive, 6-16, 6-17 trap enable, 3-14 IV arithmetic in macros, Macros, 6-3, L L"” displacement specifier, 4-8 through 4-10, 4-12, 4-13 Label, defining a, 2-2 field, 2-1, 2-2 local, 3-7, 3-8 names, 2-2 terminator, 2-2 $LENGTH macro string operator, 6-9 Length of source line, 2-1 Lexical operators, 6-8 through 6-12 .LIBRARY directive, 6-18 Lines, continuation, 2-2 .LIST directive, 5-36, 5-54, 5-55 Listing, control of, 5-42, 5-54, 5-55 cross reference, 5-13, 5-14 table of contents, 5-59 Literal mode, 4-10 through 4-12 Literals, short, 4-10 through 4-12 Local label block, delimiters, 3-8 disabling, 3-8, 5-18, 5-19 enabling, 3-8, 5-~18, 5-19 restoring, 5-51 saving, 5-52 Local labels, 3-7, 3-8, 5-18, 5-19 created, 6-7, 6-8 5-37 “M operator, 3-13, 3-14 Machine instructions, 1-1 .MACRO directive, 6-19, 6-20 K arguments 5-37 Longword data, Internal Keyword 6-4 inclusive OR operator, 3-16 6-1 through 6-29 arguments in, 6-1 through 6-8 calls to, 2-3 controlling listing of, 5-54, 5-55 definitions of, 6-19, 6-20 deletion of, 6-22 exiting from, 6-23 expanding, 6-1, 6-2 libraries containing, 6-18 maximum line size, 2-2 names of, 3-6, 6-13, 6-19, 6-20 redefining, 6-19, 6-20 string operators in, 6-8 through 6-12 .MASK directive, 5-22, 5-38 Mask, register save, 3-13, 3-14, 5-22, 5-38 .MCALL directive, 6-21 .MDELETE directive, 6-22 Messages, printing assembly, 5-24, 5-43, 5-63 .MEXIT directive, 6-23 Mnemonic instructions, 3-5, C-1 through C-8 Modes, addressing, 2-3, 4-1 through 4-18 . summary of, 4-2 through 4-5, B-11 through B-14 Module, identifying, Multiplication, 3-15 5-28, 5-60 Names, macro, Index-4 3-6, 6-13, 6-19, 6-20 INDEX Names (Cont.) module, 5-60 register, symbol, Passing numeric values in macros, 6~7 3-5 PC register, 3-6 Permanent 3-5 symbols, 3-5, C-1 .NARG directive, 6-24 .NCHR directive, 6-25 Negative numbers, 3-3 .NLIST directive, 5-38, 5-54, 5-~55 .NOCROSS directive, 5-13, 5-14, 5-39 .NOSHOW directive, 5—39' 5‘54, Position-independent code, 5-46, 5-47 Precision of floating-point numbers, 3-4 .PRINT directive, 5-43 Printing assembly messages, 5-24, 5-43, 5-63 5-55 .NTYPE directive, Program counter modes, Number of macro 6-24 Numbers, Program 6-26 counter, through arguments, 6-1, 4-12 4-15 Program sections, 5-48 5-44 through 3-3 floating point, 3-3, 3-4, 3-14, 3-15, 5-17, 5-26 integer, 3-3 packed decimal, 3-4, 3-5, 5-42 Numeric control operators, 3-14, 3-15 Q .QUAD directive, Quadword initializing memory with, reserving memory for, 5-9 0 unary operator, 3-11, 5-40, directive, 3-12 Radix control, 3-11, 3-12 Radix default, 3-11 Radix operators, 3-11, 3-12 in macro arguments, 6-5 Real numbers, 3-3, 3-4 6-20 5-40, Redefining, 5-41 instructions, 5-40, 6-20 opcodes, 5-40, 6-20 .REFn directive, 5-50 Operand, field, 2-1, 2-3 generation directives, types, 6-26 macros, 5-50 Operator, binary, 3-15 through 3-17, field, 2-1, 2-3 macro string, unary, 3-10 6-8 through through B-9 6-12 3-15, 5-46 P Packed decimal strings, 5-42 .PACKED directive, 5-42 .PAGE directive, 5-42 Page ejection, 5-42 3-4, 3-5, 4-16 3-14 4-6 names, 3-5 save mask, Overlaid program sections, 4-15, mode, B-8, 3-17 6-20 6-19, Register, deferred index mode, deferred mode, 4-6 mask operator, 3-13, B-9 OR operators, 5-49 R Octal radix, 3-11, 3-12 .ODD directive, 5-39 Opcodes, C-1 through C-8 defining, 5-40, 5-41 redefining, 5-49 data, o) .OPDEF 3-5 3-13, 3-14, 5-22, 5-38 Relative, default displacement, 5-16 deferred index mode, 4-15, 4-16 deferred mode, 4-13 index mode, 4-15, 4-16 mode, 4-12, 4-13 Relocatable program sections, 5-47 Repeat blocks, 6-28, 6-29 character, indefinite repeat, 6-16, 6-17 controlling Index-5 listing of, 5-54, 5-55 INDEX Repeat blocks (Cont.) indefinite, 6-14, 6-15 Repeat counts, 3-10, 5-11, 5-56, 5-57, 5-65 .REPEAT directive, Repeating a block 6-29 Repetition 6-28, of factors, Storage, 5-37, ASCII, 5-8 5-3 5-6 through 5-8 byte, 5-11, 5-56 double-precision, 5-11, 5-9 longword, 5-37 packed decimal, 5-42 signed, 5-56, 5-57 quadword, 5-49 word, 5-57, 5-65 String, arguments 6-6 in macros, AsCII, 3-13, Rounding floating-point numbers, 5-18, 5-19 3-12, descriptors, operators, addressing mode, 4-10 through 5-52 Saving a program section, 5-52 Saving 5-52 local label block, .SBTTL directive, Sections, 5-18, Symbols, 5-44 program sections, 5-47 3-7 names 3-6 of, 5-25, 3-5, listing, 3-2, B-8 Stack pointer, 3-5 Starting address, 5-21, 5-22 Statement format, 2-1 through 2-4 5-27, 5-64 C-1 T Tab formatting, 2-1, 2-2 Table of contents, listing, 5-59 TBK attribute, 5-19 Technical changes from VAX-11 MACRO V1.0, ix Temporary labels, Terms, 3-9 3-7, 3-8 5-30 Textual operators, 3-12 .TITLE directive, 5-60 3-1, 6-12 undefined, 5-18, 5-19 user-defined, 2-2, 3-6 Testing conditions, blank, 2-2 continuing, 2-2 format of, 2-1 length of, 2-1 SP register, 3-5 B-7, through 5-20, internal, permanent, Shift operator, arithmetic, 3-16 Short literals, 4-10 through 4-12 .SHOW directive, 5-54, 5-55 .SIGNED_BYTE directive, 5-56 Signed data storage, 5-56 through 5-58 .SIGNED_WORD directive, 5-57, 5-58 Single precision, 3-4, 5-26 Single-precision data, initializing memory with, 5-26 reserving memory for, 5-9 Source lines, Special characters, 6-8 5-19 3-5, 3-17 through 5-48 Separating characters, 3-3 Shareable images, 5-61, 5-62 Shareable 5-6 external, 3-7, 5-25, 5-27, 5-64 global, 2-2, 3-7, 3-17, 5-18 5-=59 program, through through 5-8 Subtraction, 3-15 Suppressing symbol table 4-12 .SAVE directive, 5-52 .SAVE PSECT directive, 6-4 packed decimal, 3-4, 3-5, 5-42 Subconditional assembly blocks, 5-29 through 5-31 .SUBTITLE directive, 5-59 S S” 5-17 5-26 floating—-point, .RESTORE PSECT directive, 5-51 Restoring a program section, 5-51 Reserved bits in entry mask, 3-14, 5-22 storage, 5-9 through address, 6-28, 5-37, 5-56, 5-57, 5-65 .REPT directive, 6-28, 6-29 .RESTORE directive, 5-51 Reserving 5-6 5-9 Storing, 6-29 code, 3-10, reserving, ASCII, block, through 3-14 Traceback information, 5-19 .TRANSFER directive, 5-61, 5-62 Trap enable, arithmetic, 3-13, 3-14 Truncating floating=-point number, 5-18, 5-19 Type of operand Index-6 in macros, 6-24 INDEX U Unary operators, w 3-10 through W displacement specifier, 5-48 Word data, 3-15, B-8, B-9 in macro arguments, 6-5 summary of, 3-11, B-8, B-9 Undefined symbols, 5-18, 5-19 User-defined program sections, 5-44 through 4-8 through 4-10, 4-12, .WARN directive, 5-63 Warning directive, 5-63 .WEAK directive, 5-64 Weak symbols, 5-64 User-defined symbol, 2-2 User—-generated, errors, 5-24 messages, 5-43 opcodes, 5-40, 5-41 operands, 5-50 warnings, 5-63 Vector, X passing arguments by, transfer, Version number, 5-61, 5-28 4-13 initializing memory with, 5-57, 5-65 reserving memory for, 5-9 .WORD directive, 5-65 Write protecting program sections, 5-44, 5-46 “X unary operator, Value, 4-7, 5-62 6-7 Zero terminated ASCII string, 5-8 Index-7 3-12 VAX-11 MACRO Language Reference Manual AA-D032B-TE READER'S COMMENTS NOTE: This form is for document comments only. DIGITAL will use comments submitted on this form at the company's discretion. If you require a written reply and are eligible to receive one under Software Performance Report (SPR) service, submit your comments on an SPR form. Did you find this manual understandable, usable, Please make suggestions for and well-organized? improvement. Did you find errors in this manual? If so, specify the error and the page number. QO0O0adod Please indicate the type of reader that you most nearly represent. Assembly language programmer Higher-level language programmer Occasional programmer (experienced) User with little programming experience Student programmer Other (please specify) Name Date Organization Street City. State Zip Code or Country — — — Do Not Tear - Fold Here and Tape dlilgliltiall No Postage Necessary if Mailed in the United States BUSINESS REPLY MAIL FIRST CLASS PERMIT NO.33 MAYNARD MASS. POSTAGE WILL BE PAID BY ADDRESSEE RT/C SOFTWARE PUBLICATIONS TwW/A14 DIGITAL EQUIPMENT CORPORATION 1925 ANDOVER STREET TEWKSBURY, MASSACHUSETTS —_— - Do Not Tear - Fold Here 01876
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies