1*e992f068Schristos@c Copyright (C) 1991-2022 Free Software Foundation, Inc. 216dce513Schristos@c This is part of the GAS manual. 316dce513Schristos@c For copying conditions, see the file as.texinfo. 416dce513Schristos@c VAX/VMS description enhanced and corrected by Klaus K"aempf, kkaempf@progis.de 516dce513Schristos@ifset GENERIC 616dce513Schristos@node Vax-Dependent 716dce513Schristos@chapter VAX Dependent Features 816dce513Schristos@cindex VAX support 916dce513Schristos 1016dce513Schristos@end ifset 1116dce513Schristos@ifclear GENERIC 1216dce513Schristos@node Machine Dependencies 1316dce513Schristos@chapter VAX Dependent Features 1416dce513Schristos@cindex VAX support 1516dce513Schristos 1616dce513Schristos@end ifclear 1716dce513Schristos 1816dce513Schristos@menu 1916dce513Schristos* VAX-Opts:: VAX Command-Line Options 2016dce513Schristos* VAX-float:: VAX Floating Point 2116dce513Schristos* VAX-directives:: Vax Machine Directives 2216dce513Schristos* VAX-opcodes:: VAX Opcodes 2316dce513Schristos* VAX-branch:: VAX Branch Improvement 2416dce513Schristos* VAX-operands:: VAX Operands 2516dce513Schristos* VAX-no:: Not Supported on VAX 2616dce513Schristos* VAX-Syntax:: VAX Syntax 2716dce513Schristos@end menu 2816dce513Schristos 2916dce513Schristos 3016dce513Schristos@node VAX-Opts 3116dce513Schristos@section VAX Command-Line Options 3216dce513Schristos 3316dce513Schristos@cindex command-line options ignored, VAX 3416dce513Schristos@cindex VAX command-line options ignored 3516dce513SchristosThe Vax version of @code{@value{AS}} accepts any of the following options, 3616dce513Schristosgives a warning message that the option was ignored and proceeds. 3716dce513SchristosThese options are for compatibility with scripts designed for other 3816dce513Schristospeople's assemblers. 3916dce513Schristos 4016dce513Schristos@table @code 4116dce513Schristos@cindex @code{-D}, ignored on VAX 4216dce513Schristos@cindex @code{-S}, ignored on VAX 4316dce513Schristos@cindex @code{-T}, ignored on VAX 4416dce513Schristos@item @code{-D} (Debug) 4516dce513Schristos@itemx @code{-S} (Symbol Table) 4616dce513Schristos@itemx @code{-T} (Token Trace) 4716dce513SchristosThese are obsolete options used to debug old assemblers. 4816dce513Schristos 4916dce513Schristos@cindex @code{-d}, VAX option 5016dce513Schristos@item @code{-d} (Displacement size for JUMPs) 5116dce513SchristosThis option expects a number following the @samp{-d}. Like options 5216dce513Schristosthat expect filenames, the number may immediately follow the 53012573ebSchristos@samp{-d} (old standard) or constitute the whole of the command-line 5416dce513Schristosargument that follows @samp{-d} (@sc{gnu} standard). 5516dce513Schristos 5616dce513Schristos@cindex @code{-V}, redundant on VAX 5716dce513Schristos@item @code{-V} (Virtualize Interpass Temporary File) 5816dce513SchristosSome other assemblers use a temporary file. This option 5916dce513Schristoscommanded them to keep the information in active memory rather 6016dce513Schristosthan in a disk file. @code{@value{AS}} always does this, so this 6116dce513Schristosoption is redundant. 6216dce513Schristos 6316dce513Schristos@cindex @code{-J}, ignored on VAX 6416dce513Schristos@item @code{-J} (JUMPify Longer Branches) 6516dce513SchristosMany 32-bit computers permit a variety of branch instructions 6616dce513Schristosto do the same job. Some of these instructions are short (and 6716dce513Schristosfast) but have a limited range; others are long (and slow) but 6816dce513Schristoscan branch anywhere in virtual memory. Often there are 3 6916dce513Schristosflavors of branch: short, medium and long. Some other 7016dce513Schristosassemblers would emit short and medium branches, unless told by 7116dce513Schristosthis option to emit short and long branches. 7216dce513Schristos 7316dce513Schristos@cindex @code{-t}, ignored on VAX 7416dce513Schristos@item @code{-t} (Temporary File Directory) 7516dce513SchristosSome other assemblers may use a temporary file, and this option 7616dce513Schristostakes a filename being the directory to site the temporary 7716dce513Schristosfile. Since @code{@value{AS}} does not use a temporary disk file, this 7816dce513Schristosoption makes no difference. @samp{-t} needs exactly one 7916dce513Schristosfilename. 8016dce513Schristos@end table 8116dce513Schristos 8216dce513Schristos@cindex VMS (VAX) options 8316dce513Schristos@cindex options for VAX/VMS 8416dce513Schristos@cindex VAX/VMS options 8516dce513Schristos@cindex Vax-11 C compatibility 8616dce513Schristos@cindex symbols with uppercase, VAX/VMS 8716dce513SchristosThe Vax version of the assembler accepts additional options when 8816dce513Schristoscompiled for VMS: 8916dce513Schristos 9016dce513Schristos@table @samp 9116dce513Schristos@cindex @samp{-h} option, VAX/VMS 9216dce513Schristos@item -h @var{n} 9316dce513SchristosExternal symbol or section (used for global variables) names are not 9416dce513Schristoscase sensitive on VAX/VMS and always mapped to upper case. This is 9516dce513Schristoscontrary to the C language definition which explicitly distinguishes 9616dce513Schristosupper and lower case. To implement a standard conforming C compiler, 9716dce513Schristosnames must be changed (mapped) to preserve the case information. The 9816dce513Schristosdefault mapping is to convert all lower case characters to uppercase and 9916dce513Schristosadding an underscore followed by a 6 digit hex value, representing a 24 10016dce513Schristosdigit binary value. The one digits in the binary value represent which 10116dce513Schristoscharacters are uppercase in the original symbol name. 10216dce513Schristos 10316dce513SchristosThe @samp{-h @var{n}} option determines how we map names. This takes 10416dce513Schristosseveral values. No @samp{-h} switch at all allows case hacking as 10516dce513Schristosdescribed above. A value of zero (@samp{-h0}) implies names should be 10616dce513Schristosupper case, and inhibits the case hack. A value of 2 (@samp{-h2}) 10716dce513Schristosimplies names should be all lower case, with no case hack. A value of 3 10816dce513Schristos(@samp{-h3}) implies that case should be preserved. The value 1 is 10916dce513Schristosunused. The @code{-H} option directs @code{@value{AS}} to display 11016dce513Schristosevery mapped symbol during assembly. 11116dce513Schristos 11216dce513SchristosSymbols whose names include a dollar sign @samp{$} are exceptions to the 11316dce513Schristosgeneral name mapping. These symbols are normally only used to reference 11416dce513SchristosVMS library names. Such symbols are always mapped to upper case. 11516dce513Schristos 11616dce513Schristos@cindex @samp{-+} option, VAX/VMS 11716dce513Schristos@item -+ 11816dce513SchristosThe @samp{-+} option causes @code{@value{AS}} to truncate any symbol 11916dce513Schristosname larger than 31 characters. The @samp{-+} option also prevents some 12016dce513Schristoscode following the @samp{_main} symbol normally added to make the object 12116dce513Schristosfile compatible with Vax-11 "C". 12216dce513Schristos 12316dce513Schristos@cindex @samp{-1} option, VAX/VMS 12416dce513Schristos@item -1 12516dce513SchristosThis option is ignored for backward compatibility with @code{@value{AS}} 12616dce513Schristosversion 1.x. 12716dce513Schristos 12816dce513Schristos@cindex @samp{-H} option, VAX/VMS 12916dce513Schristos@item -H 13016dce513SchristosThe @samp{-H} option causes @code{@value{AS}} to print every symbol 13116dce513Schristoswhich was changed by case mapping. 13216dce513Schristos@end table 13316dce513Schristos 13416dce513Schristos@node VAX-float 13516dce513Schristos@section VAX Floating Point 13616dce513Schristos 13716dce513Schristos@cindex VAX floating point 13816dce513Schristos@cindex floating point, VAX 13916dce513SchristosConversion of flonums to floating point is correct, and 14016dce513Schristoscompatible with previous assemblers. Rounding is 14116dce513Schristostowards zero if the remainder is exactly half the least significant bit. 14216dce513Schristos 14316dce513Schristos@code{D}, @code{F}, @code{G} and @code{H} floating point formats 14416dce513Schristosare understood. 14516dce513Schristos 14616dce513SchristosImmediate floating literals (@emph{e.g.} @samp{S`$6.9}) 14716dce513Schristosare rendered correctly. Again, rounding is towards zero in the 14816dce513Schristosboundary case. 14916dce513Schristos 15016dce513Schristos@cindex @code{float} directive, VAX 15116dce513Schristos@cindex @code{double} directive, VAX 15216dce513SchristosThe @code{.float} directive produces @code{f} format numbers. 15316dce513SchristosThe @code{.double} directive produces @code{d} format numbers. 15416dce513Schristos 15516dce513Schristos@node VAX-directives 15616dce513Schristos@section Vax Machine Directives 15716dce513Schristos 15816dce513Schristos@cindex machine directives, VAX 15916dce513Schristos@cindex VAX machine directives 16016dce513SchristosThe Vax version of the assembler supports four directives for 16116dce513Schristosgenerating Vax floating point constants. They are described in the 16216dce513Schristostable below. 16316dce513Schristos 16416dce513Schristos@cindex wide floating point directives, VAX 16516dce513Schristos@table @code 16616dce513Schristos@cindex @code{dfloat} directive, VAX 16716dce513Schristos@item .dfloat 16816dce513SchristosThis expects zero or more flonums, separated by commas, and 16916dce513Schristosassembles Vax @code{d} format 64-bit floating point constants. 17016dce513Schristos 17116dce513Schristos@cindex @code{ffloat} directive, VAX 17216dce513Schristos@item .ffloat 17316dce513SchristosThis expects zero or more flonums, separated by commas, and 17416dce513Schristosassembles Vax @code{f} format 32-bit floating point constants. 17516dce513Schristos 17616dce513Schristos@cindex @code{gfloat} directive, VAX 17716dce513Schristos@item .gfloat 17816dce513SchristosThis expects zero or more flonums, separated by commas, and 17916dce513Schristosassembles Vax @code{g} format 64-bit floating point constants. 18016dce513Schristos 18116dce513Schristos@cindex @code{hfloat} directive, VAX 18216dce513Schristos@item .hfloat 18316dce513SchristosThis expects zero or more flonums, separated by commas, and 18416dce513Schristosassembles Vax @code{h} format 128-bit floating point constants. 18516dce513Schristos 18616dce513Schristos@end table 18716dce513Schristos 18816dce513Schristos@node VAX-opcodes 18916dce513Schristos@section VAX Opcodes 19016dce513Schristos 19116dce513Schristos@cindex VAX opcode mnemonics 19216dce513Schristos@cindex opcode mnemonics, VAX 19316dce513Schristos@cindex mnemonics for opcodes, VAX 19416dce513SchristosAll DEC mnemonics are supported. Beware that @code{case@dots{}} 19516dce513Schristosinstructions have exactly 3 operands. The dispatch table that 19616dce513Schristosfollows the @code{case@dots{}} instruction should be made with 19716dce513Schristos@code{.word} statements. This is compatible with all unix 19816dce513Schristosassemblers we know of. 19916dce513Schristos 20016dce513Schristos@node VAX-branch 20116dce513Schristos@section VAX Branch Improvement 20216dce513Schristos 20316dce513Schristos@cindex VAX branch improvement 20416dce513Schristos@cindex branch improvement, VAX 20516dce513Schristos@cindex pseudo-ops for branch, VAX 20616dce513SchristosCertain pseudo opcodes are permitted. They are for branch 20716dce513Schristosinstructions. They expand to the shortest branch instruction that 20816dce513Schristosreaches the target. Generally these mnemonics are made by 20916dce513Schristossubstituting @samp{j} for @samp{b} at the start of a DEC mnemonic. 21016dce513SchristosThis feature is included both for compatibility and to help 21116dce513Schristoscompilers. If you do not need this feature, avoid these 21216dce513Schristosopcodes. Here are the mnemonics, and the code they can expand into. 21316dce513Schristos 21416dce513Schristos@table @code 21516dce513Schristos@item jbsb 21616dce513Schristos@samp{Jsb} is already an instruction mnemonic, so we chose @samp{jbsb}. 21716dce513Schristos@table @asis 21816dce513Schristos@item (byte displacement) 21916dce513Schristos@kbd{bsbb @dots{}} 22016dce513Schristos@item (word displacement) 22116dce513Schristos@kbd{bsbw @dots{}} 22216dce513Schristos@item (long displacement) 22316dce513Schristos@kbd{jsb @dots{}} 22416dce513Schristos@end table 22516dce513Schristos@item jbr 22616dce513Schristos@itemx jr 22716dce513SchristosUnconditional branch. 22816dce513Schristos@table @asis 22916dce513Schristos@item (byte displacement) 23016dce513Schristos@kbd{brb @dots{}} 23116dce513Schristos@item (word displacement) 23216dce513Schristos@kbd{brw @dots{}} 23316dce513Schristos@item (long displacement) 23416dce513Schristos@kbd{jmp @dots{}} 23516dce513Schristos@end table 23616dce513Schristos@item j@var{COND} 23716dce513Schristos@var{COND} may be any one of the conditional branches 23816dce513Schristos@code{neq}, @code{nequ}, @code{eql}, @code{eqlu}, @code{gtr}, 23916dce513Schristos@code{geq}, @code{lss}, @code{gtru}, @code{lequ}, @code{vc}, @code{vs}, 24016dce513Schristos@code{gequ}, @code{cc}, @code{lssu}, @code{cs}. 24116dce513Schristos@var{COND} may also be one of the bit tests 24216dce513Schristos@code{bs}, @code{bc}, @code{bss}, @code{bcs}, @code{bsc}, @code{bcc}, 24316dce513Schristos@code{bssi}, @code{bcci}, @code{lbs}, @code{lbc}. 24416dce513Schristos@var{NOTCOND} is the opposite condition to @var{COND}. 24516dce513Schristos@table @asis 24616dce513Schristos@item (byte displacement) 24716dce513Schristos@kbd{b@var{COND} @dots{}} 24816dce513Schristos@item (word displacement) 24916dce513Schristos@kbd{b@var{NOTCOND} foo ; brw @dots{} ; foo:} 25016dce513Schristos@item (long displacement) 25116dce513Schristos@kbd{b@var{NOTCOND} foo ; jmp @dots{} ; foo:} 25216dce513Schristos@end table 25316dce513Schristos@item jacb@var{X} 25416dce513Schristos@var{X} may be one of @code{b d f g h l w}. 25516dce513Schristos@table @asis 25616dce513Schristos@item (word displacement) 25716dce513Schristos@kbd{@var{OPCODE} @dots{}} 25816dce513Schristos@item (long displacement) 25916dce513Schristos@example 26016dce513Schristos@var{OPCODE} @dots{}, foo ; 26116dce513Schristosbrb bar ; 26216dce513Schristosfoo: jmp @dots{} ; 26316dce513Schristosbar: 26416dce513Schristos@end example 26516dce513Schristos@end table 26616dce513Schristos@item jaob@var{YYY} 26716dce513Schristos@var{YYY} may be one of @code{lss leq}. 26816dce513Schristos@item jsob@var{ZZZ} 26916dce513Schristos@var{ZZZ} may be one of @code{geq gtr}. 27016dce513Schristos@table @asis 27116dce513Schristos@item (byte displacement) 27216dce513Schristos@kbd{@var{OPCODE} @dots{}} 27316dce513Schristos@item (word displacement) 27416dce513Schristos@example 27516dce513Schristos@var{OPCODE} @dots{}, foo ; 27616dce513Schristosbrb bar ; 27716dce513Schristosfoo: brw @var{destination} ; 27816dce513Schristosbar: 27916dce513Schristos@end example 28016dce513Schristos@item (long displacement) 28116dce513Schristos@example 28216dce513Schristos@var{OPCODE} @dots{}, foo ; 28316dce513Schristosbrb bar ; 28416dce513Schristosfoo: jmp @var{destination} ; 28516dce513Schristosbar: 28616dce513Schristos@end example 28716dce513Schristos@end table 28816dce513Schristos@item aobleq 28916dce513Schristos@itemx aoblss 29016dce513Schristos@itemx sobgeq 29116dce513Schristos@itemx sobgtr 29216dce513Schristos@table @asis 29316dce513Schristos@item (byte displacement) 29416dce513Schristos@kbd{@var{OPCODE} @dots{}} 29516dce513Schristos@item (word displacement) 29616dce513Schristos@example 29716dce513Schristos@var{OPCODE} @dots{}, foo ; 29816dce513Schristosbrb bar ; 29916dce513Schristosfoo: brw @var{destination} ; 30016dce513Schristosbar: 30116dce513Schristos@end example 30216dce513Schristos@item (long displacement) 30316dce513Schristos@example 30416dce513Schristos@var{OPCODE} @dots{}, foo ; 30516dce513Schristosbrb bar ; 30616dce513Schristosfoo: jmp @var{destination} ; 30716dce513Schristosbar: 30816dce513Schristos@end example 30916dce513Schristos@end table 31016dce513Schristos@end table 31116dce513Schristos 31216dce513Schristos@node VAX-operands 31316dce513Schristos@section VAX Operands 31416dce513Schristos 31516dce513Schristos@cindex VAX operand notation 31616dce513Schristos@cindex operand notation, VAX 31716dce513Schristos@cindex immediate character, VAX 31816dce513Schristos@cindex VAX immediate character 31916dce513SchristosThe immediate character is @samp{$} for Unix compatibility, not 32016dce513Schristos@samp{#} as DEC writes it. 32116dce513Schristos 32216dce513Schristos@cindex indirect character, VAX 32316dce513Schristos@cindex VAX indirect character 32416dce513SchristosThe indirect character is @samp{*} for Unix compatibility, not 32516dce513Schristos@samp{@@} as DEC writes it. 32616dce513Schristos 32716dce513Schristos@cindex displacement sizing character, VAX 32816dce513Schristos@cindex VAX displacement sizing character 32916dce513SchristosThe displacement sizing character is @samp{`} (an accent grave) for 33016dce513SchristosUnix compatibility, not @samp{^} as DEC writes it. The letter 33116dce513Schristospreceding @samp{`} may have either case. @samp{G} is not 33216dce513Schristosunderstood, but all other letters (@code{b i l s w}) are understood. 33316dce513Schristos 33416dce513Schristos@cindex register names, VAX 33516dce513Schristos@cindex VAX register names 33616dce513SchristosRegister names understood are @code{r0 r1 r2 @dots{} r15 ap fp sp 33716dce513Schristospc}. Upper and lower case letters are equivalent. 33816dce513Schristos 33916dce513SchristosFor instance 34016dce513Schristos@smallexample 34116dce513Schristoststb *w`$4(r5) 34216dce513Schristos@end smallexample 34316dce513Schristos 34416dce513SchristosAny expression is permitted in an operand. Operands are comma 34516dce513Schristosseparated. 34616dce513Schristos 34716dce513Schristos@c There is some bug to do with recognizing expressions 34816dce513Schristos@c in operands, but I forget what it is. It is 34916dce513Schristos@c a syntax clash because () is used as an address mode 35016dce513Schristos@c and to encapsulate sub-expressions. 35116dce513Schristos 35216dce513Schristos@node VAX-no 35316dce513Schristos@section Not Supported on VAX 35416dce513Schristos 35516dce513Schristos@cindex VAX bitfields not supported 35616dce513Schristos@cindex bitfields, not supported on VAX 35716dce513SchristosVax bit fields can not be assembled with @code{@value{AS}}. Someone 35816dce513Schristoscan add the required code if they really need it. 35916dce513Schristos 36016dce513Schristos@node VAX-Syntax 36116dce513Schristos@section VAX Syntax 36216dce513Schristos@menu 36316dce513Schristos* VAX-Chars:: Special Characters 36416dce513Schristos@end menu 36516dce513Schristos 36616dce513Schristos@node VAX-Chars 36716dce513Schristos@subsection Special Characters 36816dce513Schristos 36916dce513Schristos@cindex line comment character, VAX 37016dce513Schristos@cindex VAX line comment character 37116dce513SchristosThe presence of a @samp{#} appearing anywhere on a line indicates the 37216dce513Schristosstart of a comment that extends to the end of that line. 37316dce513Schristos 37416dce513SchristosIf a @samp{#} appears as the first character of a line then the whole 37516dce513Schristosline is treated as a comment, but in this case the line can also be a 37616dce513Schristoslogical line number directive (@pxref{Comments}) or a preprocessor 37716dce513Schristoscontrol command (@pxref{Preprocessing}). 37816dce513Schristos 37916dce513Schristos@cindex line separator, VAX 38016dce513Schristos@cindex statement separator, VAX 38116dce513Schristos@cindex VAX line separator 38216dce513SchristosThe @samp{;} character can be used to separate statements on the same 38316dce513Schristosline. 384