VAX Dependent Features
**********************

VAX Command-Line Options
========================

The Vax version of AS accepts any of the following options, gives a warning message that the option was ignored and proceeds. These options are for compatibility with scripts designed for other people's assemblers.

-D (Debug)
-S (Symbol Table)
-T (Token Trace)
     These are obsolete options used to debug old assemblers.

-d (Displacement size for JUMPs)
     This option expects a number following the -d.  Like options that expect filenames, the number may immediately follow the -d (old standard) or constitute the whole of the command-line argument that follows -d (GNU standard).

-V (Virtualize Interpass Temporary File)
     Some other assemblers use a temporary file.  This option commanded them to keep the information in active memory rather than in a disk file.  AS always does this, so this option is redundant.

-J (JUMPify Longer Branches)
     Many 32-bit computers permit a variety of branch instructions to do the same job.  Some of these instructions are short (and fast) but have a limited range; others are long (and slow) but can branch anywhere in virtual memory.  Often there are 3 flavors of branch: short, medium and long.  Some other assemblers would emit short and medium branches, unless told by this option to emit short and long branches.

-t (Temporary File Directory)
     Some other assemblers may use a temporary file, and this option takes a filename being the directory to site the temporary file.  Since AS does not use a temporary disk file, this option makes no difference.  -t needs exactly one filename.

The Vax version of the assembler accepts additional options when compiled for VMS:

-h N
     External symbol or section (used for global variables) names are not case sensitive on VAX/VMS and always mapped to upper case.  This is contrary to the C language definition which explicitly distinguishes upper and lower case.  To implement a standard conforming C compiler, names must be changed (mapped) to preserve the case information.  The default mapping is to convert all lower case characters to uppercase and adding an underscore followed by a 6 digit hex value, representing a 24 digit binary value.  The one digits in the binary value represent which characters are uppercase in the original symbol name.

     The -h N option determines how we map names.  This takes several values.  No -h switch at all allows case hacking as described above.  A value of zero (-h0) implies names should be upper case, and inhibits the case hack.  A value of 2 (-h2) implies names should be all lower case, with no case hack.  A value of 3 (-h3) implies that case should be preserved.  The value 1 is unused.  The -H option directs AS to display every mapped symbol during assembly.

     Symbols whose names include a dollar sign $ are exceptions to the general name mapping.  These symbols are normally only used to reference VMS library names.  Such symbols are always mapped to upper case.

-+
     The -+ option causes AS to truncate any symbol name larger than 31 characters.  The -+ option also prevents some code following the _main symbol normally added to make the object file compatible with Vax-11 "C".

-1
     This option is ignored for backward compatibility with AS version 1.x.

-H
     The -H option causes AS to print every symbol which was changed by case mapping.

VAX Floating Point
==================

Conversion of flonums to floating point is correct, and compatible with previous assemblers.  Rounding is towards zero if the remainder is exactly half the least significant bit.

D, F, G and H floating point formats are understood.

Immediate floating literals (e.g. S`$6.9) are rendered correctly.  Again, rounding is towards zero in the boundary case.

The .float directive produces f format numbers. The .double directive produces d format numbers.

Vax Machine Directives
======================

The Vax version of the assembler supports four directives for generating Vax floating point constants.  They are described in the table below.

.dfloat
     This expects zero or more flonums, separated by commas, and assembles Vax d format 64-bit floating point constants.

.ffloat
     This expects zero or more flonums, separated by commas, and assembles Vax f format 32-bit floating point constants.

.gfloat
     This expects zero or more flonums, separated by commas, and assembles Vax g format 64-bit floating point constants.

.hfloat
     This expects zero or more flonums, separated by commas, and assembles Vax h format 128-bit floating point constants.

VAX Opcodes
===========

All DEC mnemonics are supported.  Beware that case... instructions have exactly 3 operands.  The dispatch table that follows the case... instruction should be made with .word statements.  This is compatible with all unix assemblers we know of.

VAX Branch Improvement
======================

Certain pseudo opcodes are permitted.  They are for branch instructions.  They expand to the shortest branch instruction that reaches the target.  Generally these mnemonics are made by substituting j for b at the start of a DEC mnemonic. This feature is included both for compatibility and to help compilers.  If you do not need this feature, avoid these opcodes.  Here are the mnemonics, and the code they can expand into.

jbsb
     Jsb is already an instruction mnemonic, so we chose jbsb.

     (byte displacement)
          bsbb ...

     (word displacement)
          bsbw ...

     (long displacement)
          jsb ...

jbr
jr
     Unconditional branch.

     (byte displacement)
          brb ...

     (word displacement)
          brw ...

     (long displacement)
          jmp ...

jCOND
     COND may be any one of the conditional branches neq, nequ, eql, eqlu, gtr, geq, lss, gtru, lequ, vc, vs, gequ, cc, lssu, cs. COND may also be one of the bit tests bs, bc, bss, bcs, bsc, bcc, bssi, bcci, lbs, lbc. NOTCOND is the opposite condition to COND.

     (byte displacement)
          bCOND ...

     (word displacement)
          bNOTCOND foo ; brw ... ; foo:

     (long displacement)
          bNOTCOND foo ; jmp ... ; foo:

jacbX
     X may be one of b d f g h l w.

     (word displacement)
          OPCODE ...

     (long displacement)

               OPCODE ..., foo ;
               brb bar ;
               foo: jmp ... ;
               bar:

jaobYYY
     YYY may be one of lss leq.

jsobZZZ
     ZZZ may be one of geq gtr.

     (byte displacement)
          OPCODE ...

     (word displacement)

               OPCODE ..., foo ;
               brb bar ;
               foo: brw DESTINATION ;
               bar:

     (long displacement)

               OPCODE ..., foo ;
               brb bar ;
               foo: jmp DESTINATION ;
               bar:

aobleq
aoblss
sobgeq
sobgtr

     (byte displacement)
          OPCODE ...

     (word displacement)

               OPCODE ..., foo ;
               brb bar ;
               foo: brw DESTINATION ;
               bar:

     (long displacement)

               OPCODE ..., foo ;
               brb bar ;
               foo: jmp DESTINATION ;
               bar:

VAX Operands
============

The immediate character is $ for Unix compatibility, not # as DEC writes it.

The indirect character is * for Unix compatibility, not @ as DEC writes it.

The displacement sizing character is ` (an accent grave) for Unix compatibility, not ^ as DEC writes it.  The letter preceding ` may have either case.  G is not understood, but all other letters (b i l s w) are understood.

Register names understood are r0 r1 r2 ... r15 ap fp sp pc.  Upper and lower case letters are equivalent.

For instance

     tstb *w`$4(r5)

Any expression is permitted in an operand.  Operands are comma separated.

Not Supported on VAX
====================

Vax bit fields can not be assembled with AS.  Someone can add the required code if they really need it.

VAX Syntax
==========

Special Characters
------------------

The presence of a # appearing anywhere on a line indicates the start of a comment that extends to the end of that line.

If a # appears as the first character of a line then the whole line is treated as a comment, but in this case the line can also be a logical line number directive (see Comments) or a preprocessor control command (see Preprocessing).

The ; character can be used to separate statements on the same line.