c-vax.texi 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. @c Copyright (C) 1991-2022 Free Software Foundation, Inc.
  2. @c This is part of the GAS manual.
  3. @c For copying conditions, see the file as.texinfo.
  4. @c VAX/VMS description enhanced and corrected by Klaus K"aempf, kkaempf@progis.de
  5. @ifset GENERIC
  6. @node Vax-Dependent
  7. @chapter VAX Dependent Features
  8. @cindex VAX support
  9. @end ifset
  10. @ifclear GENERIC
  11. @node Machine Dependencies
  12. @chapter VAX Dependent Features
  13. @cindex VAX support
  14. @end ifclear
  15. @menu
  16. * VAX-Opts:: VAX Command-Line Options
  17. * VAX-float:: VAX Floating Point
  18. * VAX-directives:: Vax Machine Directives
  19. * VAX-opcodes:: VAX Opcodes
  20. * VAX-branch:: VAX Branch Improvement
  21. * VAX-operands:: VAX Operands
  22. * VAX-no:: Not Supported on VAX
  23. * VAX-Syntax:: VAX Syntax
  24. @end menu
  25. @node VAX-Opts
  26. @section VAX Command-Line Options
  27. @cindex command-line options ignored, VAX
  28. @cindex VAX command-line options ignored
  29. The Vax version of @code{@value{AS}} accepts any of the following options,
  30. gives a warning message that the option was ignored and proceeds.
  31. These options are for compatibility with scripts designed for other
  32. people's assemblers.
  33. @table @code
  34. @cindex @code{-D}, ignored on VAX
  35. @cindex @code{-S}, ignored on VAX
  36. @cindex @code{-T}, ignored on VAX
  37. @item @code{-D} (Debug)
  38. @itemx @code{-S} (Symbol Table)
  39. @itemx @code{-T} (Token Trace)
  40. These are obsolete options used to debug old assemblers.
  41. @cindex @code{-d}, VAX option
  42. @item @code{-d} (Displacement size for JUMPs)
  43. This option expects a number following the @samp{-d}. Like options
  44. that expect filenames, the number may immediately follow the
  45. @samp{-d} (old standard) or constitute the whole of the command-line
  46. argument that follows @samp{-d} (@sc{gnu} standard).
  47. @cindex @code{-V}, redundant on VAX
  48. @item @code{-V} (Virtualize Interpass Temporary File)
  49. Some other assemblers use a temporary file. This option
  50. commanded them to keep the information in active memory rather
  51. than in a disk file. @code{@value{AS}} always does this, so this
  52. option is redundant.
  53. @cindex @code{-J}, ignored on VAX
  54. @item @code{-J} (JUMPify Longer Branches)
  55. Many 32-bit computers permit a variety of branch instructions
  56. to do the same job. Some of these instructions are short (and
  57. fast) but have a limited range; others are long (and slow) but
  58. can branch anywhere in virtual memory. Often there are 3
  59. flavors of branch: short, medium and long. Some other
  60. assemblers would emit short and medium branches, unless told by
  61. this option to emit short and long branches.
  62. @cindex @code{-t}, ignored on VAX
  63. @item @code{-t} (Temporary File Directory)
  64. Some other assemblers may use a temporary file, and this option
  65. takes a filename being the directory to site the temporary
  66. file. Since @code{@value{AS}} does not use a temporary disk file, this
  67. option makes no difference. @samp{-t} needs exactly one
  68. filename.
  69. @end table
  70. @cindex VMS (VAX) options
  71. @cindex options for VAX/VMS
  72. @cindex VAX/VMS options
  73. @cindex Vax-11 C compatibility
  74. @cindex symbols with uppercase, VAX/VMS
  75. The Vax version of the assembler accepts additional options when
  76. compiled for VMS:
  77. @table @samp
  78. @cindex @samp{-h} option, VAX/VMS
  79. @item -h @var{n}
  80. External symbol or section (used for global variables) names are not
  81. case sensitive on VAX/VMS and always mapped to upper case. This is
  82. contrary to the C language definition which explicitly distinguishes
  83. upper and lower case. To implement a standard conforming C compiler,
  84. names must be changed (mapped) to preserve the case information. The
  85. default mapping is to convert all lower case characters to uppercase and
  86. adding an underscore followed by a 6 digit hex value, representing a 24
  87. digit binary value. The one digits in the binary value represent which
  88. characters are uppercase in the original symbol name.
  89. The @samp{-h @var{n}} option determines how we map names. This takes
  90. several values. No @samp{-h} switch at all allows case hacking as
  91. described above. A value of zero (@samp{-h0}) implies names should be
  92. upper case, and inhibits the case hack. A value of 2 (@samp{-h2})
  93. implies names should be all lower case, with no case hack. A value of 3
  94. (@samp{-h3}) implies that case should be preserved. The value 1 is
  95. unused. The @code{-H} option directs @code{@value{AS}} to display
  96. every mapped symbol during assembly.
  97. Symbols whose names include a dollar sign @samp{$} are exceptions to the
  98. general name mapping. These symbols are normally only used to reference
  99. VMS library names. Such symbols are always mapped to upper case.
  100. @cindex @samp{-+} option, VAX/VMS
  101. @item -+
  102. The @samp{-+} option causes @code{@value{AS}} to truncate any symbol
  103. name larger than 31 characters. The @samp{-+} option also prevents some
  104. code following the @samp{_main} symbol normally added to make the object
  105. file compatible with Vax-11 "C".
  106. @cindex @samp{-1} option, VAX/VMS
  107. @item -1
  108. This option is ignored for backward compatibility with @code{@value{AS}}
  109. version 1.x.
  110. @cindex @samp{-H} option, VAX/VMS
  111. @item -H
  112. The @samp{-H} option causes @code{@value{AS}} to print every symbol
  113. which was changed by case mapping.
  114. @end table
  115. @node VAX-float
  116. @section VAX Floating Point
  117. @cindex VAX floating point
  118. @cindex floating point, VAX
  119. Conversion of flonums to floating point is correct, and
  120. compatible with previous assemblers. Rounding is
  121. towards zero if the remainder is exactly half the least significant bit.
  122. @code{D}, @code{F}, @code{G} and @code{H} floating point formats
  123. are understood.
  124. Immediate floating literals (@emph{e.g.} @samp{S`$6.9})
  125. are rendered correctly. Again, rounding is towards zero in the
  126. boundary case.
  127. @cindex @code{float} directive, VAX
  128. @cindex @code{double} directive, VAX
  129. The @code{.float} directive produces @code{f} format numbers.
  130. The @code{.double} directive produces @code{d} format numbers.
  131. @node VAX-directives
  132. @section Vax Machine Directives
  133. @cindex machine directives, VAX
  134. @cindex VAX machine directives
  135. The Vax version of the assembler supports four directives for
  136. generating Vax floating point constants. They are described in the
  137. table below.
  138. @cindex wide floating point directives, VAX
  139. @table @code
  140. @cindex @code{dfloat} directive, VAX
  141. @item .dfloat
  142. This expects zero or more flonums, separated by commas, and
  143. assembles Vax @code{d} format 64-bit floating point constants.
  144. @cindex @code{ffloat} directive, VAX
  145. @item .ffloat
  146. This expects zero or more flonums, separated by commas, and
  147. assembles Vax @code{f} format 32-bit floating point constants.
  148. @cindex @code{gfloat} directive, VAX
  149. @item .gfloat
  150. This expects zero or more flonums, separated by commas, and
  151. assembles Vax @code{g} format 64-bit floating point constants.
  152. @cindex @code{hfloat} directive, VAX
  153. @item .hfloat
  154. This expects zero or more flonums, separated by commas, and
  155. assembles Vax @code{h} format 128-bit floating point constants.
  156. @end table
  157. @node VAX-opcodes
  158. @section VAX Opcodes
  159. @cindex VAX opcode mnemonics
  160. @cindex opcode mnemonics, VAX
  161. @cindex mnemonics for opcodes, VAX
  162. All DEC mnemonics are supported. Beware that @code{case@dots{}}
  163. instructions have exactly 3 operands. The dispatch table that
  164. follows the @code{case@dots{}} instruction should be made with
  165. @code{.word} statements. This is compatible with all unix
  166. assemblers we know of.
  167. @node VAX-branch
  168. @section VAX Branch Improvement
  169. @cindex VAX branch improvement
  170. @cindex branch improvement, VAX
  171. @cindex pseudo-ops for branch, VAX
  172. Certain pseudo opcodes are permitted. They are for branch
  173. instructions. They expand to the shortest branch instruction that
  174. reaches the target. Generally these mnemonics are made by
  175. substituting @samp{j} for @samp{b} at the start of a DEC mnemonic.
  176. This feature is included both for compatibility and to help
  177. compilers. If you do not need this feature, avoid these
  178. opcodes. Here are the mnemonics, and the code they can expand into.
  179. @table @code
  180. @item jbsb
  181. @samp{Jsb} is already an instruction mnemonic, so we chose @samp{jbsb}.
  182. @table @asis
  183. @item (byte displacement)
  184. @kbd{bsbb @dots{}}
  185. @item (word displacement)
  186. @kbd{bsbw @dots{}}
  187. @item (long displacement)
  188. @kbd{jsb @dots{}}
  189. @end table
  190. @item jbr
  191. @itemx jr
  192. Unconditional branch.
  193. @table @asis
  194. @item (byte displacement)
  195. @kbd{brb @dots{}}
  196. @item (word displacement)
  197. @kbd{brw @dots{}}
  198. @item (long displacement)
  199. @kbd{jmp @dots{}}
  200. @end table
  201. @item j@var{COND}
  202. @var{COND} may be any one of the conditional branches
  203. @code{neq}, @code{nequ}, @code{eql}, @code{eqlu}, @code{gtr},
  204. @code{geq}, @code{lss}, @code{gtru}, @code{lequ}, @code{vc}, @code{vs},
  205. @code{gequ}, @code{cc}, @code{lssu}, @code{cs}.
  206. @var{COND} may also be one of the bit tests
  207. @code{bs}, @code{bc}, @code{bss}, @code{bcs}, @code{bsc}, @code{bcc},
  208. @code{bssi}, @code{bcci}, @code{lbs}, @code{lbc}.
  209. @var{NOTCOND} is the opposite condition to @var{COND}.
  210. @table @asis
  211. @item (byte displacement)
  212. @kbd{b@var{COND} @dots{}}
  213. @item (word displacement)
  214. @kbd{b@var{NOTCOND} foo ; brw @dots{} ; foo:}
  215. @item (long displacement)
  216. @kbd{b@var{NOTCOND} foo ; jmp @dots{} ; foo:}
  217. @end table
  218. @item jacb@var{X}
  219. @var{X} may be one of @code{b d f g h l w}.
  220. @table @asis
  221. @item (word displacement)
  222. @kbd{@var{OPCODE} @dots{}}
  223. @item (long displacement)
  224. @example
  225. @var{OPCODE} @dots{}, foo ;
  226. brb bar ;
  227. foo: jmp @dots{} ;
  228. bar:
  229. @end example
  230. @end table
  231. @item jaob@var{YYY}
  232. @var{YYY} may be one of @code{lss leq}.
  233. @item jsob@var{ZZZ}
  234. @var{ZZZ} may be one of @code{geq gtr}.
  235. @table @asis
  236. @item (byte displacement)
  237. @kbd{@var{OPCODE} @dots{}}
  238. @item (word displacement)
  239. @example
  240. @var{OPCODE} @dots{}, foo ;
  241. brb bar ;
  242. foo: brw @var{destination} ;
  243. bar:
  244. @end example
  245. @item (long displacement)
  246. @example
  247. @var{OPCODE} @dots{}, foo ;
  248. brb bar ;
  249. foo: jmp @var{destination} ;
  250. bar:
  251. @end example
  252. @end table
  253. @item aobleq
  254. @itemx aoblss
  255. @itemx sobgeq
  256. @itemx sobgtr
  257. @table @asis
  258. @item (byte displacement)
  259. @kbd{@var{OPCODE} @dots{}}
  260. @item (word displacement)
  261. @example
  262. @var{OPCODE} @dots{}, foo ;
  263. brb bar ;
  264. foo: brw @var{destination} ;
  265. bar:
  266. @end example
  267. @item (long displacement)
  268. @example
  269. @var{OPCODE} @dots{}, foo ;
  270. brb bar ;
  271. foo: jmp @var{destination} ;
  272. bar:
  273. @end example
  274. @end table
  275. @end table
  276. @node VAX-operands
  277. @section VAX Operands
  278. @cindex VAX operand notation
  279. @cindex operand notation, VAX
  280. @cindex immediate character, VAX
  281. @cindex VAX immediate character
  282. The immediate character is @samp{$} for Unix compatibility, not
  283. @samp{#} as DEC writes it.
  284. @cindex indirect character, VAX
  285. @cindex VAX indirect character
  286. The indirect character is @samp{*} for Unix compatibility, not
  287. @samp{@@} as DEC writes it.
  288. @cindex displacement sizing character, VAX
  289. @cindex VAX displacement sizing character
  290. The displacement sizing character is @samp{`} (an accent grave) for
  291. Unix compatibility, not @samp{^} as DEC writes it. The letter
  292. preceding @samp{`} may have either case. @samp{G} is not
  293. understood, but all other letters (@code{b i l s w}) are understood.
  294. @cindex register names, VAX
  295. @cindex VAX register names
  296. Register names understood are @code{r0 r1 r2 @dots{} r15 ap fp sp
  297. pc}. Upper and lower case letters are equivalent.
  298. For instance
  299. @smallexample
  300. tstb *w`$4(r5)
  301. @end smallexample
  302. Any expression is permitted in an operand. Operands are comma
  303. separated.
  304. @c There is some bug to do with recognizing expressions
  305. @c in operands, but I forget what it is. It is
  306. @c a syntax clash because () is used as an address mode
  307. @c and to encapsulate sub-expressions.
  308. @node VAX-no
  309. @section Not Supported on VAX
  310. @cindex VAX bitfields not supported
  311. @cindex bitfields, not supported on VAX
  312. Vax bit fields can not be assembled with @code{@value{AS}}. Someone
  313. can add the required code if they really need it.
  314. @node VAX-Syntax
  315. @section VAX Syntax
  316. @menu
  317. * VAX-Chars:: Special Characters
  318. @end menu
  319. @node VAX-Chars
  320. @subsection Special Characters
  321. @cindex line comment character, VAX
  322. @cindex VAX line comment character
  323. The presence of a @samp{#} appearing anywhere on a line indicates the
  324. start of a comment that extends to the end of that line.
  325. If a @samp{#} appears as the first character of a line then the whole
  326. line is treated as a comment, but in this case the line can also be a
  327. logical line number directive (@pxref{Comments}) or a preprocessor
  328. control command (@pxref{Preprocessing}).
  329. @cindex line separator, VAX
  330. @cindex statement separator, VAX
  331. @cindex VAX line separator
  332. The @samp{;} character can be used to separate statements on the same
  333. line.