@c Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
@c This is part of the GAS manual.
@c For copying conditions, see the file as.texinfo.
@ifset GENERIC
@node Vax-Dependent
@chapter VAX Dependent Features
@cindex VAX support

@end ifset
@ifclear GENERIC
@node Machine Dependencies
@chapter VAX Dependent Features
@cindex VAX support

@end ifclear

@menu
* VAX-Opts::                    VAX Command-Line Options
* VAX-float::                   VAX Floating Point
* VAX-directives::              Vax Machine Directives
* VAX-opcodes::                 VAX Opcodes
* VAX-branch::                  VAX Branch Improvement
* VAX-operands::                VAX Operands
* VAX-no::                      Not Supported on VAX
@end menu


@node VAX-Opts
@section VAX Command-Line Options

@cindex command-line options ignored, VAX
@cindex VAX command-line options ignored
The Vax version of @code{@value{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.

@table @code
@cindex @code{-D}, ignored on VAX
@cindex @code{-S}, ignored on VAX
@cindex @code{-T}, ignored on VAX
@item @code{-D} (Debug)
@itemx @code{-S} (Symbol Table)
@itemx @code{-T} (Token Trace)
These are obsolete options used to debug old assemblers.

@cindex @code{-d}, VAX option
@item @code{-d} (Displacement size for JUMPs)
This option expects a number following the @samp{-d}.  Like options
that expect filenames, the number may immediately follow the
@samp{-d} (old standard) or constitute the whole of the command line
argument that follows @samp{-d} (@sc{gnu} standard).

@cindex @code{-V}, redundant on VAX
@item @code{-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.  @code{@value{AS}} always does this, so this
option is redundant.

@cindex @code{-J}, ignored on VAX
@item @code{-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.

@cindex @code{-t}, ignored on VAX
@item @code{-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 @code{@value{AS}} does not use a temporary disk file, this
option makes no difference.  @samp{-t} needs exactly one
filename.
@end table

@cindex VMS (VAX) options
@cindex options for VAX/VMS
@cindex VAX/VMS options
@cindex @code{-h} option, VAX/VMS
@cindex @code{-+} option, VAX/VMS
@cindex Vax-11 C compatibility
@cindex symbols with lowercase, VAX/VMS
@c FIXME!  look into "I think" below, correct if needed, delete.
The Vax version of the assembler accepts two options when
compiled for VMS.  They are @samp{-h}, and @samp{-+}.  The
@samp{-h} option prevents @code{@value{AS}} from modifying the
symbol-table entries for symbols that contain lowercase
characters (I think).  The @samp{-+} option causes @code{@value{AS}} to
print warning messages if the FILENAME part of the object file,
or any symbol name is larger than 31 characters.  The @samp{-+}
option also inserts some code following the @samp{_main}
symbol so that the object file is compatible with Vax-11
"C".

@node VAX-float
@section VAX Floating Point

@cindex VAX floating point
@cindex floating point, VAX
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.

@code{D}, @code{F}, @code{G} and @code{H} floating point formats
are understood.

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

@cindex @code{float} directive, VAX
@cindex @code{double} directive, VAX
The @code{.float} directive produces @code{f} format numbers.
The @code{.double} directive produces @code{d} format numbers.

@node VAX-directives
@section Vax Machine Directives

@cindex machine directives, VAX
@cindex 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.

@cindex wide floating point directives, VAX
@table @code
@cindex @code{dfloat} directive, VAX
@item .dfloat
This expects zero or more flonums, separated by commas, and
assembles Vax @code{d} format 64-bit floating point constants.

@cindex @code{ffloat} directive, VAX
@item .ffloat
This expects zero or more flonums, separated by commas, and
assembles Vax @code{f} format 32-bit floating point constants.

@cindex @code{gfloat} directive, VAX
@item .gfloat
This expects zero or more flonums, separated by commas, and
assembles Vax @code{g} format 64-bit floating point constants.

@cindex @code{hfloat} directive, VAX
@item .hfloat
This expects zero or more flonums, separated by commas, and
assembles Vax @code{h} format 128-bit floating point constants.

@end table

@node VAX-opcodes
@section VAX Opcodes

@cindex VAX opcode mnemonics
@cindex opcode mnemonics, VAX
@cindex mnemonics for opcodes, VAX
All DEC mnemonics are supported.  Beware that @code{case@dots{}}
instructions have exactly 3 operands.  The dispatch table that
follows the @code{case@dots{}} instruction should be made with
@code{.word} statements.  This is compatible with all unix
assemblers we know of.

@node VAX-branch
@section VAX Branch Improvement

@cindex VAX branch improvement
@cindex branch improvement, VAX
@cindex pseudo-ops for branch, VAX
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 @samp{j} for @samp{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.

@table @code
@item jbsb
@samp{Jsb} is already an instruction mnemonic, so we chose @samp{jbsb}.
@table @asis
@item (byte displacement)
@kbd{bsbb @dots{}}
@item (word displacement)
@kbd{bsbw @dots{}}
@item (long displacement)
@kbd{jsb @dots{}}
@end table
@item jbr
@itemx jr
Unconditional branch.
@table @asis
@item (byte displacement)
@kbd{brb @dots{}}
@item (word displacement)
@kbd{brw @dots{}}
@item (long displacement)
@kbd{jmp @dots{}}
@end table
@item j@var{COND}
@var{COND} may be any one of the conditional branches
@code{neq}, @code{nequ}, @code{eql}, @code{eqlu}, @code{gtr},
@code{geq}, @code{lss}, @code{gtru}, @code{lequ}, @code{vc}, @code{vs},
@code{gequ}, @code{cc}, @code{lssu}, @code{cs}.
@var{COND} may also be one of the bit tests
@code{bs}, @code{bc}, @code{bss}, @code{bcs}, @code{bsc}, @code{bcc},
@code{bssi}, @code{bcci}, @code{lbs}, @code{lbc}.
@var{NOTCOND} is the opposite condition to @var{COND}.
@table @asis
@item (byte displacement)
@kbd{b@var{COND} @dots{}}
@item (word displacement)
@kbd{b@var{NOTCOND} foo ; brw @dots{} ; foo:}
@item (long displacement)
@kbd{b@var{NOTCOND} foo ; jmp @dots{} ; foo:}
@end table
@item jacb@var{X}
@var{X} may be one of @code{b d f g h l w}.
@table @asis
@item (word displacement)
@kbd{@var{OPCODE} @dots{}}
@item (long displacement)
@example
@var{OPCODE} @dots{}, foo ;
brb bar ;
foo: jmp @dots{} ;
bar:
@end example
@end table
@item jaob@var{YYY}
@var{YYY} may be one of @code{lss leq}.
@item jsob@var{ZZZ}
@var{ZZZ} may be one of @code{geq gtr}.
@table @asis
@item (byte displacement)
@kbd{@var{OPCODE} @dots{}}
@item (word displacement)
@example
@var{OPCODE} @dots{}, foo ;
brb bar ;
foo: brw @var{destination} ;
bar:
@end example
@item (long displacement)
@example
@var{OPCODE} @dots{}, foo ;
brb bar ;
foo: jmp @var{destination} ;
bar:
@end example
@end table
@item aobleq
@itemx aoblss
@itemx sobgeq
@itemx sobgtr
@table @asis
@item (byte displacement)
@kbd{@var{OPCODE} @dots{}}
@item (word displacement)
@example
@var{OPCODE} @dots{}, foo ;
brb bar ;
foo: brw @var{destination} ;
bar:
@end example
@item (long displacement)
@example
@var{OPCODE} @dots{}, foo ;
brb bar ;
foo: jmp @var{destination} ;
bar:
@end example
@end table
@end table

@node VAX-operands
@section VAX Operands

@cindex VAX operand notation
@cindex operand notation, VAX
@cindex immediate character, VAX
@cindex VAX immediate character
The immediate character is @samp{$} for Unix compatibility, not
@samp{#} as DEC writes it.

@cindex indirect character, VAX
@cindex VAX indirect character
The indirect character is @samp{*} for Unix compatibility, not
@samp{@@} as DEC writes it.

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

@cindex register names, VAX
@cindex VAX register names
Register names understood are @code{r0 r1 r2 @dots{} r15 ap fp sp
pc}.  Upper and lower case letters are equivalent.

For instance
@smallexample
tstb *w`$4(r5)
@end smallexample

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

@c There is some bug to do with recognizing expressions
@c in operands, but I forget what it is.  It is
@c a syntax clash because () is used as an address mode
@c and to encapsulate sub-expressions.

@node VAX-no
@section Not Supported on VAX

@cindex VAX bitfields not supported
@cindex bitfields, not supported on VAX
Vax bit fields can not be assembled with @code{@value{AS}}.  Someone
can add the required code if they really need it.
