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


Appendix B
Hexadecimal/Decimal Conversion

The following table lists the decimal value for each possible hexadecimal value in each byte of a longword. The following sections contain instructions to use the table to convert hexadecimal numbers to decimal and decimal numbers to hexadecimal.


B.1 Hexadecimal to Decimal

For each integer position of the hexadecimal value, locate the corresponding column integer and record its decimal equivalent in the conversion table. Add the decimal equivalent to obtain the decimal value.

For example:


D0500AD0 (hex)  =        ?(dec) 
 
D0000000        = 3,489,660,928 
  500000        =     5,242,880 
     A00        =         2,560 
      D0        =           208 
 
D0500AD0        = 3,494,906,576 

B.2 Decimal to Hexadecimal

To determine the hexadecimal equivalent of a given decimal value, perform the following steps:

  1. In the conversion table, locate the largest decimal value that does not exceed the decimal number to be converted.
  2. Record the hexadecimal equivalent, followed by the number of zeros that corresponds to the integer column minus 1.
  3. Subtract the table decimal value from the decimal number to be converted.
  4. Repeat steps 1 to 3 until the subtraction balance equals zero. Add the hexadecimal equivalents to obtain the hexadecimal value.

For example:


22,466 (dec)   = ?(hex) 
 
20,480         = 5000        22,466 
 1,792         =  700       -20,480 
   192         =   C0 
     2         =    2         1,986 
                            - 1,792 
22,466         = 57C2 
                                194 
                            -   192 
                                  2 
                            -     2 
                                  0 

B.3 Powers of 2 and 16

This section lists the decimal values of powers of 2 and 16. These values are useful in converting decimal numbers to hexadecimal.


  Powers of 2               Powers of 16 
 
    2**n     n                  16**n     n 
 
     256     8                      1     0 
     512     9                     16     1 
    1024    10                    256     2 
    2048    11                   4096     3 
    4096    12                  65536     4 
    8192    13                1048576     5 
   16384    14               16777216     6 
   32768    15              268435456     7 
   65536    16             4294967296     8 
  131072    17            68719476736     9 
  262144    18          1099511627776    10 
  524288    19         17592186044416    11 
 1048576    20        281474976710656    12 
 2097152    21       4503599627370496    13 
 4194304    22      72057594037927936    14 
 8388608    23    1152921504606846976    15 
16777216    24 


Appendix C
VAX MACRO Assembler Directives and Language Summary

This appendix summarizes the general assembler and macro directives (in alphabetical order), special characters, unary operators, binary operators, and addressing modes.

C.1 Assembler Directives

Table C-1 summarizes the VAX MACRO assembler directives.

Table C-1 Assembler Directives
Format Operation
.ADDRESS address-list Stores successive longwords of address data
.ALIGN keyword[,expression] Aligns the location counter to the boundary specified by the keyword
.ALIGN integer[,expression] Aligns location counter to the boundary specified by (2^integer)
.ASCIC string Stores the ASCII string (enclosed in delimiters), preceded by a count byte
.ASCID string Stores the ASCII string (enclosed in delimiters), preceded by a string descriptor
.ASCII string Stores the ASCII string (enclosed in delimiters)
.ASCIZ string Stores the ASCII string (enclosed in delimiters) followed by a 0 byte
.BLKA expression Reserves longwords of address data
.BLKB expression Reserves bytes for data
.BLKD expression Reserves quadwords for double-precision floating-point data
.BLKF expression Reserves longwords for single-precision floating-point data
.BLKG expression Reserves quadwords for floating-point data
.BLKH expression Reserves octawords for extended-precision floating-point data
.BLKL expression Reserves longwords for data
.BLKO expression Reserves octawords for data
.BLKQ expression Reserves quadwords for data
.BLKW expression Reserves words for data
.BYTE expression-list Generates successive bytes of data; each byte contains the value of the specified expression
.CROSS Enables cross-referencing of all symbols
.CROSS symbol-list Cross-references specified symbols
.DEBUG symbol-list Makes symbol names known to the debugger
.DEFAULT DISPLACEMENT, keyword Specifies the default displacement length for the relative addressing modes
.D_FLOATING literal-list Generates 8-byte double-precision floating-point data
.DISABLE argument-list Disables functions specified in argument-list
.DOUBLE literal-list Equivalent to .D_FLOATING
.DSABL argument-list Equivalent to .DISABLE
.ENABL argument-list Equivalent to .ENABLE
.ENABLE argument-list Enables functions specified in argument-list
.END [symbol] Indicates logical end of source program; optional symbol specifies transfer address
.ENDC Indicates end of conditional assembly block
.ENDM [macro-name] Indicates end of macro definition
.ENDR Indicates end of repeat block
.ENTRY symbol [,expression] Procedure entry directive
.ERROR [expression] ;comment Displays specified error message
.EVEN Ensures that the current location counter has an even value (adds 1 if it is odd)
.EXTERNAL symbol-list Indicates specified symbols are externally defined
.EXTRN symbol-list Equivalent to .EXTERNAL
.F_FLOATING literal-list Generates 4-byte single-precision floating-point data
.FLOAT literal-list Equivalent to .F_FLOATING
.G_FLOATING literal-list Generates 8-byte G_floating-point data
.GLOBAL symbol-list Indicates specified symbols are global symbols
.GLOBL Equivalent to .GLOBAL
.H_FLOATING literal-list Generates 16-byte extended-precision H_floating-point data
.IDENT string Provides means of labeling object module with additional data
.IF condition [,] argument(s) 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 arguments specified
.IFF Equivalent to .IF_FALSE
.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 only 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
.IIF condition argument(s), statement Acts as a 1-line conditional assembly block where the condition is tested for the argument specified; the 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,<BIT_STRING> Replaces a formal argument with successive single characters specified in string
.LIBRARY macro-library-name Specifies a macro library
.LINK "file-spec" [/qualifier[=(module-name[,...])],...] Includes linker option records in object module
.LIST [argument-list] Equivalent to .SHOW
.LONG expression-list Generates successive longwords of data; each longword contains the value of the specified expression
.MACRO macro-name [formal-argument-list] Begins a macro definition
.MASK symbol [,expression] Reserves a word for and copies a register save mask
.MCALL macro-name-list Specifies the system or user-defined macros, or both, in libraries that are required to assemble the source program
.MDELETE macro-name-list Deletes from memory the macro definitions of the macros in the list
.MEXIT Exits from the expansion of a macro before the end of the macro is encountered
.NARG symbol Determines the number of arguments in the current macro call
.NCHR symbol,<BIT_STRING> Determines the number of characters in a specified character string
.NLIST [argument-list] Equivalent to .NOSHOW
.NOCROSS Disables cross-referencing of all symbols
.NOCROSS symbol-list Disables cross-referencing of specified symbols
.NOSHOW Decrements listing level count
.NOSHOW argument-list Controls listing of macros and conditional assembly blocks
.NTYPE symbol,operand Can appear only within a macro definition; equates the symbol to the addressing mode of the specified operand
.OCTA literal Stores 16 bytes of data
.OCTA symbol Stores 16 bytes of data
.ODD Ensures that the current location counter has an odd value (adds 1 if it is even)
.OPDEF opcode value, operand-descriptor-list Defines an opcode and its operand list
.PACKED decimal-string [,symbol] Generates packed decimal data, 2 digits per byte
.PAGE 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 longword operand
.REF8 operand Generates quadword operand
.REF16 operand Generates octaword operand
.REPEAT expression Begins a repeat block; the section of code up to the next .ENDR directive is repeated the number of times specified by the expression
.REPT Equivalent to .REPEAT
.RESTORE Equivalent to .RESTORE_PSECT
.RESTORE_PSECT Restores program section context from the program section context stack
.SAVE [LOCAL_BLOCK] Equivalent to .SAVE_PSECT
.SAVE_PSECT [LOCAL_BLOCK] Saves current program section context on the program section context stack
.SBTTL comment-string Equivalent to .SUBTITLE
.SHOW Increments listing level count
.SHOW argument-list Controls listing of macros and conditional assembly blocks
.SIGNED_BYTE expression-list Stores successive bytes of signed data
.SIGNED_WORD expression-list Stores successive words of signed data
.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 comment-string Assigns the first 15 characters in the string as an object module name and causes the string to appear on each page of the assembly listing
.TRANSFER symbol Directs the linker to redefine the value of the global symbol for use in a shareable image
.WARN [expression] ;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

C.2 Special Characters

Table C-2 summarizes the VAX MACRO special characters.

Table C-2 Special Characters Used in VAX MACRO Statements
Character Character Name Functions
_ Underscore Character in symbol names
$ Dollar sign Character in symbol names
. Period Character in symbol names, current location counter, and decimal point
: Colon Label terminator
= Equal sign Direct assignment operator and macro keyword argument terminator
  Tab Field terminator
  Space Field terminator
# Number sign Immediate addressing mode indicator
@ At sign Deferred addressing mode indicator and arithmetic shift operator
, Comma Field, operand, and item separator
; Semicolon Comment field indicator
+ Plus sign Autoincrement addressing mode indicator, unary plus operator, and arithmetic addition operator
-- Minus sign 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 OR operator
\ Backslash Logical exclusive OR and numeric conversion indicator in macro arguments
^ Circumflex Unary operator indicator and macro argument delimiter
[ ] Square brackets Index addressing mode and repeat count indicators
( ) Parentheses Register deferred addressing mode indicators
<> Angle brackets Argument or expression grouping delimiters
? Question mark Created label indicator in macro arguments
' Apostrophe Macro argument concatenation indicator
% Percent sign Macro string operators


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