Document revision date: 19 July 1999
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

VAX MACRO and Instruction Set Reference Manual


Previous Contents Index


.NARG

Number of arguments directive

Format

.NARG symbol


Parameters

symbol

A symbol that is assigned a value equal to the number of arguments in the macro call.

Description

.NARG determines the number of arguments in the current macro call.

.NARG counts all the positional arguments specified in the macro call, including null arguments (specified by adjacent commas (,)). The value assigned to the specified symbol does not include either any keyword arguments or any formal arguments that have default values.

Note

If .NARG appears outside a macro, the assembler displays an error message.


Example

The macro definition is as follows:


.MACRO  CNT_ARG A1,A2,A3,A4,A5,A6,A7,A8,A9=DEF9,A10=DEF10 
.NARG   COUNTER         ; COUNTER is set to no. of ARGS 
.WORD   COUNTER         ; Store value of COUNTER 
.ENDM   CNT_ARG 
      

The macro calls and expansions of the macro defined previously are as follows:


CNT_ARG TEST,FIND,ANS   ; COUNTER will = 3 
.NARG   COUNTER         ; COUNTER is set to no. of ARGS 
.WORD   COUNTER         ; Store value of COUNTER 
 
CNT_ARG                 ; COUNTER will = 0 
.NARG   COUNTER         ; COUNTER is set to no. of ARGS 
.WORD   COUNTER         ; Store value of COUNTER 
 
CNT_ARG TEST,A2=SYMB2,A3=SY3      ; COUNTER will = 1 
.NARG   COUNTER         ; COUNTER is set to no. of ARGS 
.WORD   COUNTER         ; Store value of COUNTER 
                        ; Keyword arguments are not counted 
 
CNT_ARG ,SYMBL,,        ; COUNTER will = 3 
.NARG   COUNTER         ; COUNTER is set to no. of ARGS 
.WORD   COUNTER         ; Store value of COUNTER 
                        ; Null arguments are counted 
      


.NCHR

Number of characters directive

Format

.NCHR symbol,<string>


Parameters

symbol

A symbol that is assigned a value equal to the number of characters in the specified character string.

<string>

A sequence of printable characters. Delimit the character string with angle brackets (<>) (or a character preceded by a circumflex (^)) only if the specified character string contains a legal separator (comma (,), space, and/or tab) or a semicolon (;).

Description

.NCHR determines the number of characters in a specified character string. It can appear anywhere in a VAX MACRO program and is useful in calculating the length of macro arguments.

Example

The macro definition is as follows:


.MACRO   CHAR    MESS                    ; Define MACRO 
.NCHR    CHRCNT,<MESS>                   ; Assign value to CHRCNT 
.WORD    CHRCNT                          ; Store value 
.ASCII   /MESS/                          ; Store characters 
.ENDM    CHAR                            ; Finish 
      

The macro calls and expansions of the macro defined previously are as follows:


CHAR     <HELLO>                        ; CHRCNT will = 5 
.NCHR    CHRCNT,<HELLO>                 ; Assign value to CHRCNT 
.WORD    CHRCNT                          ; Store value 
.ASCII   /HELLO/                         ; Store characters 
 
CHAR     <14, 75.39  4>                 ; CHRCNT will = 12(dec) 
.NCHR    CHRCNT,<14, 75.39  4>          ; Assign value to CHRCNT 
.WORD    CHRCNT                          ; Store value 
.ASCII   /14, 75.39  4/                  ; Store characters 
      


.NLIST

Listing directive

Format

.NLIST [argument-list]


Parameter

argument-list

One or more of the symbolic arguments listed in Table 6-8. Use either the long form or the short form of the arguments. If you specify multiple arguments, separate them with commas (,), spaces, or tabs.

Description

.NLIST is equivalent to .NOSHOW. See the description of .SHOW for more information.

.NOCROSS

Cross-reference directive

Format

.NOCROSS [symbol-list]


Parameter

symbol-list

A list of legal symbol names separated by commas (,).

Description

VAX MACRO produces a cross-reference listing when the /CROSS_REFERENCE qualifier is specified in the MACRO command. The .CROSS and .NOCROSS directives control which symbols are included in the cross-reference listing. The description of .NOCROSS is included with the description of .CROSS.

.NOSHOW

Listing directive

Format

.NOSHOW [argument-list]


Parameter

argument-list

One or more of the symbolic arguments listed in Table 6-8 in the description of .SHOW. Use either the long form or the short form of the arguments. If you specify multiple arguments, separate them with commas (,), spaces, or tabs.

Description

.NOSHOW specifies listing control options. See the description of .SHOW for more information.

.NTYPE

Operand type directive

Format

.NTYPE symbol,operand


Parameters

symbol

Any legal VAX 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 you use it with an opcode. If no argument is specified, zero is assumed.

Description

.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 (1-byte) value is returned. Bits 0 to 3 specify the register associated with the mode, and bits 4 to 7 specify the addressing mode. To provide concise addressing information, the mode bits 4 to 7 are not exactly the same as the numeric value of the addressing mode described in Table C-6. Literal mode is indicated by a zero in bits 4 to 7, instead of the values 0 to 3. 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 Chapter 5 of this volume for more information on addressing modes.


Example


; The following macro is used to push an address on the stack.  It checks 
; the operand type (by using .NTYPE) to determine if the operand is an 
; address and, if not, the macro simply pushes the argument on the stack 
; and generates a warning message. 
; 
        .MACRO  PUSHADR #ADDR 
        .NTYPE  A,ADDR                  ; Assign operand type to 'A' 
A = A@-4&^XF                            ; Isolate addressing mode 
        .IF IDENTICAL 0,<ADDR>          ; Is argument exactly 0? 
        PUSHL   #0                      ; Stack zero 
        .MEXIT                          ; Exit from macro 
        .ENDC 
ERR = 0                                 ; ERR tells if mode is address 
                                        ; ERR = 0 if address, 1 if not 
        .IIF LESS_EQUAL A-1,   ERR=1    ; Is mode not literal or immediate? 
        .IIF EQUAL A-5,   ERR=1         ; Is mode not register? 
        .IF EQUAL  ERR                  ; Is mode address? 
        PUSHAL  ADDR                    ; Yes, stack address 
        .IFF                            ; No 
        PUSHL   ADDR                    ; Then stack operand & warn 
        .WARN   ; ADDR is not an address; 
        .ENDC 
        .ENDM   PUSHADR 
      

The macro calls and expansions of the macro defined previously are as follows:


        PUSHADR (R0)                    ; Valid argument 
        PUSHAL  (R0)                    ; Yes, stack address 
 
        PUSHADR (R1)[R4]                ; Valid argument 
        PUSHAL  (R1)[R4]                ; Yes, stack address 
 
        PUSHADR 0                       ; Is zero 
        PUSHL   #0                      ; Stack zero 
 
        PUSHADR #1                      ; Not an address 
        PUSHL   #1                      ; Then stack operand & warn 
%MACRO-W-GENWRN, Generated WARNING: #1 is not an address 
 
        PUSHADR R0                      ; Not an address 
        PUSHL   R0                      ; Then stack operand & warn 
%MACRO-W-GENWRN, Generated WARNING: R0 is not an address 
 
      

Note that to save space, this example is listed as it would appear if .SHOW BINARY, not .SHOW EXPANSIONS, were specified in the source program.


.OCTA

Octaword storage directive

Format

.OCTA literal

.OCTA symbol


Parameters

literal

Any constant value. This value can be preceded by ^O, ^B, ^X, or ^D to specify the radix as octal, binary, hexadecimal, or decimal, respectively; or it can be preceded by ^A to specify ASCII text. Decimal is the default radix.

symbol

A symbol defined elsewhere in the program. This symbol results in a sign-extended, 32-bit value being stored in an octaword.

Description

.OCTA generates 128 bits (16 bytes) of binary data.

Note

.OCTA is like .QUAD and unlike other data storage directives (.BYTE, .WORD, and .LONG), in that it does not evaluate expressions and that it accepts only one value. It does not accept a list.


Example


.OCTA  ^A"FEDCBA987654321"       ; Each ASCII character 
                                 ;   is stored in a byte 
.OCTA  0                         ; OCTA 0 
.OCTA  ^X01234ABCD5678F9         ; OCTA hex value specified 
.OCTA  VINTERVAL                 ; VINTERVAL has 32-bit value, 
                                 ;   sign-extended 
      


.ODD

Odd location counter alignment directive

Format

.ODD


Description

.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.

.OPDEF

Opcode definition directive

Format

.OPDEF opcode value,operand-descriptor-list


Parameters

opcode

An ASCII string specifying the name of the opcode. The string can be up to 31 characters long and can contain the letters A to Z, the digits 0 to 9, and the special characters underscore (_), dollar sign ($), and period (.). The string should not start with a digit and should not be surrounded by delimiters.

value

An expression that specifies the value of the opcode. The expression must be absolute and must not contain any undefined values (see Section 3.5). The value of the expression must be in the range 0 to 65,535_10 (hexadecimal FFFF), but you cannot use the values 252 to 255 because the architecture specifies these as the start of a 2-byte opcode. The expression is represented as follows:
If 0 < expression < 251 Expression is a 1-byte opcode.
If expression > 255 Expression bits 7:0 are the first byte of the opcode and expression bits 15:8 are the second byte of the opcode.

operand-descriptor-list

A list of operand descriptors that specifies the number of operands and the type of each. Up to 16 operand descriptors are allowed in the list. Table 6-5 lists the operand descriptors.

Table 6-5 Operand Descriptors
Access Type Data Type
  Byte Word Long-
word
Float-
ing
Point
Double
Float-
ing
Point
G_
Floating
Point
H_
Floating
Point
Quad-
word
Octa-
word
Address AB AW AL AF AD AG AH AQ AO
Read-
only
RB RW RL RF RD RG RH RQ RO
Modify MB MW ML MF MD MG MH MQ MO
Write-
only
WB WW WL WF WD WG WH WQ WO
Field VB VW VL VF VD VG VH VQ VO
Branch BB BW --- --- --- --- --- --- ---


Description

.OPDEF defines an opcode, which is inserted into a user-defined opcode table. The assembler searches this table before it searches the permanent symbol table. This directive can redefine an existing opcode name or create a new one.

Notes

  1. You can also use a macro to redefine an opcode (see the description of .MACRO in this section). Note that the macro name table is searched before the user-defined opcode table.
  2. .OPDEF is useful in creating "custom" instructions that execute user-written microcode. This directive is supplied to allow you to execute your microcode in a MACRO program.
  3. The operand descriptors are specified in a format similar to the operand specifier notation described in Chapter 8. The first character specifies the operand access type, and the second character specifies the operand data type.

Example


.OPDEF  MOVL3   ^XA9FF,RL,ML,WL         ; Defines an instruction 
                                        ;   MOVL3, which uses 
                                        ;   the reserved opcode FF 
.OPDEF  DIVF2   ^X46,RF,MF              ; Redefines the DIVF2 and 
.OPDEF  MOVC5   ^X2C,RW,AB,AB,RW,AB     ;   MOVC5 instructions 
 
.OPDEF  CALL    ^X10,BB                 ; Equivalent to a BSBB 
      


.PACKED

Packed decimal string storage directive

Format

.PACKED decimal-string[,symbol]


Parameters

decimal-string

A decimal number from 0 to 31 digits long with an optional sign. Digits can be in the range 0 to 9 (see Section 8.3.14).

symbol

An optional symbol that is assigned a value equivalent to the number of decimal digits in the string. The sign is not counted as a digit.

Description

.PACKED generates packed decimal data, two digits per byte. Packed decimal data is useful in calculations requiring exact accuracy. Packed decimal data is operated on by the decimal string instructions. See Section 8.3.14 for more information on the format of packed decimal data.

Example


.PACKED -12,PACK_SIZE         ; PACK_SIZE gets value of 2 
.PACKED +500 
.PACKED 0 
.PACKED -0,SUM_SIZE           ; SUM_SIZE gets value of 1 
      


.PAGE

Page ejection directive

Format

.PAGE


Description

.PAGE forces a new page in the listing. The directive itself is not printed in the listing.

VAX MACRO ignores .PAGE in a macro definition. The paging operation is performed only during macro expansion.


.PRINT

Assembly message directive

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 .PRINT is encountered during assembly. The comment must be preceded by a semicolon (;).

Description

.PRINT causes the assembler to display an informational message. The message consists of the value of the expression and the comment specified in the .PRINT directive. The message is displayed on the terminal for interactive jobs and in the log file for batch jobs. The message produced by .PRINT is not considered an error or warning message.

Notes

  1. .PRINT, .ERROR, and .WARN are called the message display directives. You can use these to display information indicating that a macro call contains an error or an illegal set of conditions.
  2. If .PRINT is included in a macro library, end the comment with an additional semicolon. If you omit the semicolon, the comment will be stripped from the directive and will not be displayed when the macro is called.
  3. If the expression has a value of zero, it is not displayed with the message.

Example


.PRINT  2      ; The sine routine has been changed 
      


.PSECT

Program sectioning directive

Format

.PSECT [program-section-name[,argument-list]]


Parameters

program-section-name

The name of the program section. This name can be up to 31 characters long and can contain any alphanumeric character and the special characters underscore (_), dollar sign ($), and period (.). The first character must not be a digit.

argument-list

A list containing the program section attributes and the program section alignment. Table 6-6 lists the attributes and their functions. Table 6-7 lists the default attributes and their opposites. Program sections are aligned when you specify an integer in the range 0 to 9 or one of the five keywords listed in the following table. If you specify an integer, the program section is linked to begin at the next virtual address, which is a multiple of 2 raised to the power of the integer. If you specify a keyword, the program section is linked to begin at the next virtual address (a multiple of the values listed in the following table):
Keyword Size (in Bytes)
BYTE 2^0 = 1
WORD 2^1 = 2
LONG 2^2 = 4
QUAD 2^3 = 8
PAGE 2^9 = 512

BYTE is the default.

Table 6-6 Program Section Attributes
Attribute Function
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). No data allocations can be made. An absolute program section contributes no binary code to the image, so its byte allocation request to the linker is zero. The size of the data structure being defined is the size of the absolute program section printed in the "program section synopsis" at the end of the listing. Compare this attribute with its opposite, REL.
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 in 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 in 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 and attributes, including GBL and OVR, will have the same relocatable address in memory even when the program sections are in different clusters (see the OpenVMS Linker Utility Manual for more information on clusters). This attribute is specified for FORTRAN COMMON block program sections (see the VAX FORTRAN User's Guide). Compare this attribute with its opposite, LCL.
LCL Local---The program section is restricted to its cluster. Compare this attribute with its opposite, GBL.
LIB Library Segment---Reserved for future use.
NOEXE Not Executable---The program section contains data only; it does not contain instructions.
NOPIC Non-Position-Independent Content---The program section is assigned to a fixed location in virtual memory (when it is in a shareable image).
NORD Nonreadable---Reserved for future use.
NOSHR No Share---The program section is reserved for private use at execution time by the initiating process.
NOWRT Nonwritable---The contents of the program section cannot be altered (written into) at execution time.
OVR Overlay---Program sections with the same name and attributes, including OVR, have the same relocatable base address in memory. The allocated virtual address space is the requested allocation of the largest overlaying program section. Compare this attribute with its opposite, CON.
PIC Position-Independent Content---The program section can be relocated; that is, it can be assigned to any memory area (when it is in a shareable image).
RD Readable---Reserved for future use.
REL Relocatable---The linker assigns the program section a relocatable base address. The contents of the program section can be code or data. Compare this attribute with its opposite, ABS.
SHR Share---The program section can be shared at execution time by multiple processes. This attribute is assigned to a program section that can be linked into a shareable image.
USR User Segment---Reserved for future use.
VEC Vector-Containing---The program section contains a change mode vector indicating a privileged shareable image. You must use the SHR attribute with VEC.
WRT Write---The contents of the program section can be altered (written into) at execution time.

Table 6-7 Default Program Section Attributes
Default Attribute Opposite Attribute
CON OVR
EXE NOEXE
LCL GBL
NOPIC PIC
NOSHR SHR
RD NORD
REL ABS
WRT NOWRT
NOVEC VEC


Description

.PSECT defines a program section and its attributes and refers to a program section once it is defined. Use program sections to do the following:


Previous Next Contents Index

  [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]  
  privacy and legal statement  
4515PRO_010.HTML