1 @c Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
2 @c This is part of the GAS manual.
3 @c For copying conditions, see the file as.texinfo.
7 @chapter M680x0 Dependent Features
10 @node Machine Dependencies
11 @chapter M680x0 Dependent Features
14 @cindex M680x0 support
16 * M68K-Opts:: M680x0 Options
17 * M68K-Syntax:: Syntax
18 * M68K-Moto-Syntax:: Motorola Syntax
19 * M68K-Float:: Floating Point
20 * M68K-Directives:: 680x0 Machine Directives
21 * M68K-opcodes:: Opcodes
25 @section M680x0 Options
27 @cindex options, M680x0
28 @cindex M680x0 options
29 The Motorola 680x0 version of @code{@value{AS}} has a few machine
32 @cindex @samp{-l} option, M680x0
33 You can use the @samp{-l} option to shorten the size of references to undefined
34 symbols. If you do not use the @samp{-l} option, references to undefined
35 symbols are wide enough for a full @code{long} (32 bits). (Since
36 @code{@value{AS}} cannot know where these symbols end up, @code{@value{AS}} can
37 only allocate space for the linker to fill in later. Since @code{@value{AS}}
38 does not know how far away these symbols are, it allocates as much space as it
39 can.) If you use this option, the references are only one word wide (16 bits).
40 This may be useful if you want the object file to be as small as possible, and
41 you know that the relevant symbols are always less than 17 bits away.
43 @cindex @samp{--register-prefix-optional} option, M680x0
44 For some configurations, especially those where the compiler normally
45 does not prepend an underscore to the names of user variables, the
46 assembler requires a @samp{%} before any use of a register name. This
47 is intended to let the assembler distinguish between C variables and
48 functions named @samp{a0} through @samp{a7}, and so on. The @samp{%} is
49 always accepted, but is not required for certain configurations, notably
50 @samp{sun3}. The @samp{--register-prefix-optional} option may be used
51 to permit omitting the @samp{%} even for configurations for which it is
52 normally required. If this is done, it will generally be impossible to
53 refer to C variables and functions with the same names as register
56 @cindex @samp{--bitwise-or} option, M680x0
57 Normally the character @samp{|} is treated as a comment character, which
58 means that it can not be used in expressions. The @samp{--bitwise-or}
59 option turns @samp{|} into a normal character. In this mode, you must
60 either use C style comments, or start comments with a @samp{#} character
61 at the beginning of a line.
63 @cindex @samp{--base-size-default-16}
64 @cindex @samp{--base-size-default-32}
65 If you use an addressing mode with a base register without specifying
66 the size, @code{@value{AS}} will normally use the full 32 bit value.
67 For example, the addressing mode @samp{%a0@@(%d0)} is equivalent to
68 @samp{%a0@@(%d0:l)}. You may use the @samp{--base-size-default-16}
69 option to tell @code{@value{AS}} to default to using the 16 bit value.
70 In this case, @samp{%a0@@(%d0)} is equivalent to @samp{%a0@@(%d0:w)}.
71 You may use the @samp{--base-size-default-32} option to restore the
74 @cindex @samp{-m68000} and related options
75 @cindex architecture options, M680x0
76 @cindex M680x0 architecture options
77 @code{@value{AS}} can assemble code for several different members of the
78 Motorola 680x0 family. The default depends upon how @code{@value{AS}}
79 was configured when it was built; normally, the default is to assemble
80 code for the 68020 microprocessor. The following options may be used to
81 change the default. These options control which instructions and
82 addressing modes are permitted. The members of the 680x0 family are
83 very similar. For detailed information about the differences, see the
90 Assemble for the 68000. @samp{-m68008} and @samp{-m68302} are synonyms
91 for @samp{-m68000}, since the chips are the same from the point of view
95 Assemble for the 68010.
98 Assemble for the 68020. This is normally the default.
101 Assemble for the 68030.
104 Assemble for the 68040.
107 Assemble for the 68060.
115 Assemble for the CPU32 family of chips.
118 Assemble for the ColdFire family of chips.
122 Assemble 68881 floating point instructions. This is the default for the
123 68020, 68030, and the CPU32. The 68040 and 68060 always support
124 floating point instructions.
127 Do not assemble 68881 floating point instructions. This is the default
128 for 68000 and the 68010. The 68040 and 68060 always support floating
129 point instructions, even if this option is used.
132 Assemble 68851 MMU instructions. This is the default for the 68020,
133 68030, and 68060. The 68040 accepts a somewhat different set of MMU
134 instructions; @samp{-m68851} and @samp{-m68040} should not be used
138 Do not assemble 68851 MMU instructions. This is the default for the
139 68000, 68010, and the CPU32. The 68040 accepts a somewhat different set
147 This syntax for the Motorola 680x0 was developed at @sc{mit}.
149 @cindex M680x0 syntax
150 @cindex syntax, M680x0
151 @cindex M680x0 size modifiers
152 @cindex size modifiers, M680x0
153 The 680x0 version of @code{@value{AS}} uses instructions names and
154 syntax compatible with the Sun assembler. Intervening periods are
155 ignored; for example, @samp{movl} is equivalent to @samp{mov.l}.
157 In the following table @var{apc} stands for any of the address registers
158 (@samp{%a0} through @samp{%a7}), the program counter (@samp{%pc}), the
159 zero-address relative to the program counter (@samp{%zpc}), a suppressed
160 address register (@samp{%za0} through @samp{%za7}), or it may be omitted
161 entirely. The use of @var{size} means one of @samp{w} or @samp{l}, and
162 it may be omitted, along with the leading colon, unless a scale is also
163 specified. The use of @var{scale} means one of @samp{1}, @samp{2},
164 @samp{4}, or @samp{8}, and it may always be omitted along with the
167 @cindex M680x0 addressing modes
168 @cindex addressing modes, M680x0
169 The following addressing modes are understood:
175 @samp{%d0} through @samp{%d7}
177 @item Address Register
178 @samp{%a0} through @samp{%a7}@*
179 @samp{%a7} is also known as @samp{%sp}, i.e. the Stack Pointer. @code{%a6}
180 is also known as @samp{%fp}, the Frame Pointer.
182 @item Address Register Indirect
183 @samp{%a0@@} through @samp{%a7@@}
185 @item Address Register Postincrement
186 @samp{%a0@@+} through @samp{%a7@@+}
188 @item Address Register Predecrement
189 @samp{%a0@@-} through @samp{%a7@@-}
191 @item Indirect Plus Offset
192 @samp{@var{apc}@@(@var{number})}
195 @samp{@var{apc}@@(@var{number},@var{register}:@var{size}:@var{scale})}
197 The @var{number} may be omitted.
200 @samp{@var{apc}@@(@var{number})@@(@var{onumber},@var{register}:@var{size}:@var{scale})}
202 The @var{onumber} or the @var{register}, but not both, may be omitted.
205 @samp{@var{apc}@@(@var{number},@var{register}:@var{size}:@var{scale})@@(@var{onumber})}
207 The @var{number} may be omitted. Omitting the @var{register} produces
208 the Postindex addressing mode.
211 @samp{@var{symbol}}, or @samp{@var{digits}}, optionally followed by
212 @samp{:b}, @samp{:w}, or @samp{:l}.
215 @node M68K-Moto-Syntax
216 @section Motorola Syntax
218 @cindex Motorola syntax for the 680x0
219 @cindex alternate syntax for the 680x0
221 The standard Motorola syntax for this chip differs from the syntax
222 already discussed (@pxref{M68K-Syntax,,Syntax}). @code{@value{AS}} can
223 accept Motorola syntax for operands, even if @sc{mit} syntax is used for
224 other operands in the same instruction. The two kinds of syntax are
227 In the following table @var{apc} stands for any of the address registers
228 (@samp{%a0} through @samp{%a7}), the program counter (@samp{%pc}), the
229 zero-address relative to the program counter (@samp{%zpc}), or a
230 suppressed address register (@samp{%za0} through @samp{%za7}). The use
231 of @var{size} means one of @samp{w} or @samp{l}, and it may always be
232 omitted along with the leading dot. The use of @var{scale} means one of
233 @samp{1}, @samp{2}, @samp{4}, or @samp{8}, and it may always be omitted
234 along with the leading asterisk.
236 The following additional addressing modes are understood:
239 @item Address Register Indirect
240 @samp{(%a0)} through @samp{(%a7)}@*
241 @samp{%a7} is also known as @samp{%sp}, i.e. the Stack Pointer. @code{%a6}
242 is also known as @samp{%fp}, the Frame Pointer.
244 @item Address Register Postincrement
245 @samp{(%a0)+} through @samp{(%a7)+}
247 @item Address Register Predecrement
248 @samp{-(%a0)} through @samp{-(%a7)}
250 @item Indirect Plus Offset
251 @samp{@var{number}(@var{%a0})} through @samp{@var{number}(@var{%a7})},
252 or @samp{@var{number}(@var{%pc})}.
254 The @var{number} may also appear within the parentheses, as in
255 @samp{(@var{number},@var{%a0})}. When used with the @var{pc}, the
256 @var{number} may be omitted (with an address register, omitting the
257 @var{number} produces Address Register Indirect mode).
260 @samp{@var{number}(@var{apc},@var{register}.@var{size}*@var{scale})}
262 The @var{number} may be omitted, or it may appear within the
263 parentheses. The @var{apc} may be omitted. The @var{register} and the
264 @var{apc} may appear in either order. If both @var{apc} and
265 @var{register} are address registers, and the @var{size} and @var{scale}
266 are omitted, then the first register is taken as the base register, and
267 the second as the index register.
270 @samp{([@var{number},@var{apc}],@var{register}.@var{size}*@var{scale},@var{onumber})}
272 The @var{onumber}, or the @var{register}, or both, may be omitted.
273 Either the @var{number} or the @var{apc} may be omitted, but not both.
276 @samp{([@var{number},@var{apc},@var{register}.@var{size}*@var{scale}],@var{onumber})}
278 The @var{number}, or the @var{apc}, or the @var{register}, or any two of
279 them, may be omitted. The @var{onumber} may be omitted. The
280 @var{register} and the @var{apc} may appear in either order. If both
281 @var{apc} and @var{register} are address registers, and the @var{size}
282 and @var{scale} are omitted, then the first register is taken as the
283 base register, and the second as the index register.
287 @section Floating Point
289 @cindex floating point, M680x0
290 @cindex M680x0 floating point
291 Packed decimal (P) format floating literals are not supported.
292 Feel free to add the code!
294 The floating point formats generated by directives are these.
297 @cindex @code{float} directive, M680x0
299 @code{Single} precision floating point constants.
301 @cindex @code{double} directive, M680x0
303 @code{Double} precision floating point constants.
305 @cindex @code{extend} directive M680x0
306 @cindex @code{ldouble} directive M680x0
309 @code{Extended} precision (@code{long double}) floating point constants.
312 @node M68K-Directives
313 @section 680x0 Machine Directives
315 @cindex M680x0 directives
316 @cindex directives, M680x0
317 In order to be compatible with the Sun assembler the 680x0 assembler
318 understands the following directives.
321 @cindex @code{data1} directive, M680x0
323 This directive is identical to a @code{.data 1} directive.
325 @cindex @code{data2} directive, M680x0
327 This directive is identical to a @code{.data 2} directive.
329 @cindex @code{even} directive, M680x0
331 This directive is a special case of the @code{.align} directive; it
332 aligns the output to an even byte boundary.
334 @cindex @code{skip} directive, M680x0
336 This directive is identical to a @code{.space} directive.
343 @cindex M680x0 opcodes
344 @cindex opcodes, M680x0
345 @cindex instruction set, M680x0
346 @c doc@cygnus.com: I don't see any point in the following
347 @c paragraph. Bugs are bugs; how does saying this
350 Danger: Several bugs have been found in the opcode table (and
351 fixed). More bugs may exist. Be careful when using obscure
356 * M68K-Branch:: Branch Improvement
357 * M68K-Chars:: Special Characters
361 @subsection Branch Improvement
363 @cindex pseudo-opcodes, M680x0
364 @cindex M680x0 pseudo-opcodes
365 @cindex branch improvement, M680x0
366 @cindex M680x0 branch improvement
367 Certain pseudo opcodes are permitted for branch instructions.
368 They expand to the shortest branch instruction that reach the
369 target. Generally these mnemonics are made by substituting @samp{j} for
370 @samp{b} at the start of a Motorola mnemonic.
372 The following table summarizes the pseudo-operations. A @code{*} flags
373 cases that are more fully described after the table:
377 +-------------------------------------------------
379 Pseudo-Op |BYTE WORD LONG LONG non-PC relative
380 +-------------------------------------------------
381 jbsr |bsrs bsr bsrl jsr jsr
382 jra |bras bra bral jmp jmp
383 * jXX |bXXs bXX bXXl bNXs;jmpl bNXs;jmp
384 * dbXX |dbXX dbXX dbXX; bra; jmpl
385 * fjXX |fbXXw fbXXw fbXXl fbNXw;jmp
388 NX: negative of condition XX
391 @center @code{*}---see full description below
396 These are the simplest jump pseudo-operations; they always map to one
397 particular machine instruction, depending on the displacement to the
401 Here, @samp{j@var{XX}} stands for an entire family of pseudo-operations,
402 where @var{XX} is a conditional branch or condition-code test. The full
403 list of pseudo-ops in this family is:
405 jhi jls jcc jcs jne jeq jvc
406 jvs jpl jmi jge jlt jgt jle
409 For the cases of non-PC relative displacements and long displacements on
410 the 68000 or 68010, @code{@value{AS}} issues a longer code fragment in terms of
411 @var{NX}, the opposite condition to @var{XX}. For example, for the
412 non-PC relative case:
424 The full family of pseudo-operations covered here is
426 dbhi dbls dbcc dbcs dbne dbeq dbvc
427 dbvs dbpl dbmi dbge dblt dbgt dble
431 Other than for word and byte displacements, when the source reads
432 @samp{db@var{XX} foo}, @code{@value{AS}} emits
443 fjne fjeq fjge fjlt fjgt fjle fjf
444 fjt fjgl fjgle fjnge fjngl fjngle fjngt
445 fjnle fjnlt fjoge fjogl fjogt fjole fjolt
446 fjor fjseq fjsf fjsne fjst fjueq fjuge
447 fjugt fjule fjult fjun
450 For branch targets that are not PC relative, @code{@value{AS}} emits
456 when it encounters @samp{fj@var{XX} foo}.
461 @subsection Special Characters
463 @cindex special characters, M680x0
464 @cindex M680x0 immediate character
465 @cindex immediate character, M680x0
466 @cindex M680x0 line comment character
467 @cindex line comment character, M680x0
468 @cindex comments, M680x0
469 The immediate character is @samp{#} for Sun compatibility. The
470 line-comment character is @samp{|} (unless the @samp{--bitwise-or}
471 option is used). If a @samp{#} appears at the beginning of a line, it
472 is treated as a comment unless it looks like @samp{# line file}, in
473 which case it is treated normally.