xref: /openbsd/gnu/usr.bin/binutils/gas/doc/c-m68k.texi (revision 007c2a45)
1*007c2a45Smiod@c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2003
2b55d4692Sfgsch@c Free Software Foundation, Inc.
32159047fSniklas@c This is part of the GAS manual.
42159047fSniklas@c For copying conditions, see the file as.texinfo.
52159047fSniklas@ifset GENERIC
62159047fSniklas@page
72159047fSniklas@node M68K-Dependent
82159047fSniklas@chapter M680x0 Dependent Features
92159047fSniklas@end ifset
102159047fSniklas@ifclear GENERIC
112159047fSniklas@node Machine Dependencies
122159047fSniklas@chapter M680x0 Dependent Features
132159047fSniklas@end ifclear
142159047fSniklas
152159047fSniklas@cindex M680x0 support
162159047fSniklas@menu
172159047fSniklas* M68K-Opts::                   M680x0 Options
182159047fSniklas* M68K-Syntax::                 Syntax
192159047fSniklas* M68K-Moto-Syntax::            Motorola Syntax
202159047fSniklas* M68K-Float::                  Floating Point
212159047fSniklas* M68K-Directives::             680x0 Machine Directives
222159047fSniklas* M68K-opcodes::                Opcodes
232159047fSniklas@end menu
242159047fSniklas
252159047fSniklas@node M68K-Opts
262159047fSniklas@section M680x0 Options
272159047fSniklas
282159047fSniklas@cindex options, M680x0
292159047fSniklas@cindex M680x0 options
302159047fSniklasThe Motorola 680x0 version of @code{@value{AS}} has a few machine
31b55d4692Sfgschdependent options:
32b55d4692Sfgsch
33b55d4692Sfgsch@table @samp
342159047fSniklas
352159047fSniklas@cindex @samp{-l} option, M680x0
36b55d4692Sfgsch@item -l
372159047fSniklasYou can use the @samp{-l} option to shorten the size of references to undefined
382159047fSniklassymbols.  If you do not use the @samp{-l} option, references to undefined
392159047fSniklassymbols are wide enough for a full @code{long} (32 bits).  (Since
402159047fSniklas@code{@value{AS}} cannot know where these symbols end up, @code{@value{AS}} can
412159047fSniklasonly allocate space for the linker to fill in later.  Since @code{@value{AS}}
422159047fSniklasdoes not know how far away these symbols are, it allocates as much space as it
432159047fSniklascan.)  If you use this option, the references are only one word wide (16 bits).
442159047fSniklasThis may be useful if you want the object file to be as small as possible, and
452159047fSniklasyou know that the relevant symbols are always less than 17 bits away.
462159047fSniklas
472159047fSniklas@cindex @samp{--register-prefix-optional} option, M680x0
48b55d4692Sfgsch@item --register-prefix-optional
492159047fSniklasFor some configurations, especially those where the compiler normally
502159047fSniklasdoes not prepend an underscore to the names of user variables, the
512159047fSniklasassembler requires a @samp{%} before any use of a register name.  This
522159047fSniklasis intended to let the assembler distinguish between C variables and
532159047fSniklasfunctions named @samp{a0} through @samp{a7}, and so on.  The @samp{%} is
542159047fSniklasalways accepted, but is not required for certain configurations, notably
552159047fSniklas@samp{sun3}.  The @samp{--register-prefix-optional} option may be used
562159047fSniklasto permit omitting the @samp{%} even for configurations for which it is
572159047fSniklasnormally required.  If this is done, it will generally be impossible to
582159047fSniklasrefer to C variables and functions with the same names as register
592159047fSniklasnames.
602159047fSniklas
61191aa565Sniklas@cindex @samp{--bitwise-or} option, M680x0
62b55d4692Sfgsch@item --bitwise-or
63191aa565SniklasNormally the character @samp{|} is treated as a comment character, which
64191aa565Sniklasmeans that it can not be used in expressions.  The @samp{--bitwise-or}
65191aa565Sniklasoption turns @samp{|} into a normal character.  In this mode, you must
66191aa565Sniklaseither use C style comments, or start comments with a @samp{#} character
67191aa565Sniklasat the beginning of a line.
68191aa565Sniklas
696a4c786fSespie@cindex @samp{--base-size-default-16}
706a4c786fSespie@cindex @samp{--base-size-default-32}
71b55d4692Sfgsch@item --base-size-default-16  --base-size-default-32
726a4c786fSespieIf you use an addressing mode with a base register without specifying
736a4c786fSespiethe size, @code{@value{AS}} will normally use the full 32 bit value.
746a4c786fSespieFor example, the addressing mode @samp{%a0@@(%d0)} is equivalent to
756a4c786fSespie@samp{%a0@@(%d0:l)}.  You may use the @samp{--base-size-default-16}
766a4c786fSespieoption to tell @code{@value{AS}} to default to using the 16 bit value.
776a4c786fSespieIn this case, @samp{%a0@@(%d0)} is equivalent to @samp{%a0@@(%d0:w)}.
786a4c786fSespieYou may use the @samp{--base-size-default-32} option to restore the
796a4c786fSespiedefault behaviour.
806a4c786fSespie
816a4c786fSespie@cindex @samp{--disp-size-default-16}
826a4c786fSespie@cindex @samp{--disp-size-default-32}
83b55d4692Sfgsch@item --disp-size-default-16  --disp-size-default-32
846a4c786fSespieIf you use an addressing mode with a displacement, and the value of the
856a4c786fSespiedisplacement is not known, @code{@value{AS}} will normally assume that
866a4c786fSespiethe value is 32 bits.  For example, if the symbol @samp{disp} has not
876a4c786fSespiebeen defined, @code{@value{AS}} will assemble the addressing mode
886a4c786fSespie@samp{%a0@@(disp,%d0)} as though @samp{disp} is a 32 bit value.  You may
896a4c786fSespieuse the @samp{--disp-size-default-16} option to tell @code{@value{AS}}
906a4c786fSespieto instead assume that the displacement is 16 bits.  In this case,
916a4c786fSespie@code{@value{AS}} will assemble @samp{%a0@@(disp,%d0)} as though
926a4c786fSespie@samp{disp} is a 16 bit value.  You may use the
936a4c786fSespie@samp{--disp-size-default-32} option to restore the default behaviour.
946a4c786fSespie
95b55d4692Sfgsch@cindex @samp{--pcrel}
96b55d4692Sfgsch@item --pcrel
97b55d4692SfgschAlways keep branches PC-relative.  In the M680x0 architecture all branches
98b55d4692Sfgschare defined as PC-relative.  However, on some processors they are limited
99b55d4692Sfgschto word displacements maximum.  When @code{@value{AS}} needs a long branch
100b55d4692Sfgschthat is not available, it normally emits an absolute jump instead.  This
101b55d4692Sfgschoption disables this substitution.  When this option is given and no long
102b55d4692Sfgschbranches are available, only word branches will be emitted.  An error
103b55d4692Sfgschmessage will be generated if a word branch cannot reach its target.  This
104b55d4692Sfgschoption has no effect on 68020 and other processors that have long branches.
105b55d4692Sfgsch@pxref{M68K-Branch,,Branch Improvement}.
106b55d4692Sfgsch
1072159047fSniklas@cindex @samp{-m68000} and related options
1082159047fSniklas@cindex architecture options, M680x0
1092159047fSniklas@cindex M680x0 architecture options
110b55d4692Sfgsch@item -m68000
1112159047fSniklas@code{@value{AS}} can assemble code for several different members of the
1122159047fSniklasMotorola 680x0 family.  The default depends upon how @code{@value{AS}}
1132159047fSniklaswas configured when it was built; normally, the default is to assemble
1142159047fSniklascode for the 68020 microprocessor.  The following options may be used to
1152159047fSniklaschange the default.  These options control which instructions and
1162159047fSniklasaddressing modes are permitted.  The members of the 680x0 family are
1172159047fSniklasvery similar.  For detailed information about the differences, see the
1182159047fSniklasMotorola manuals.
1192159047fSniklas
1202159047fSniklas@table @samp
1212159047fSniklas@item -m68000
122b305b0f1Sespie@itemx -m68ec000
123b305b0f1Sespie@itemx -m68hc000
124b305b0f1Sespie@itemx -m68hc001
1252159047fSniklas@itemx -m68008
1262159047fSniklas@itemx -m68302
127b305b0f1Sespie@itemx -m68306
128b305b0f1Sespie@itemx -m68307
129b305b0f1Sespie@itemx -m68322
130b305b0f1Sespie@itemx -m68356
131b305b0f1SespieAssemble for the 68000. @samp{-m68008}, @samp{-m68302}, and so on are synonyms
1322159047fSniklasfor @samp{-m68000}, since the chips are the same from the point of view
1332159047fSniklasof the assembler.
1342159047fSniklas
1352159047fSniklas@item -m68010
1362159047fSniklasAssemble for the 68010.
1372159047fSniklas
1382159047fSniklas@item -m68020
139b305b0f1Sespie@itemx -m68ec020
1402159047fSniklasAssemble for the 68020.  This is normally the default.
1412159047fSniklas
1422159047fSniklas@item -m68030
143b305b0f1Sespie@itemx -m68ec030
1442159047fSniklasAssemble for the 68030.
1452159047fSniklas
1462159047fSniklas@item -m68040
147b305b0f1Sespie@itemx -m68ec040
1482159047fSniklasAssemble for the 68040.
1492159047fSniklas
1502159047fSniklas@item -m68060
151b305b0f1Sespie@itemx -m68ec060
1522159047fSniklasAssemble for the 68060.
1532159047fSniklas
1542159047fSniklas@item -mcpu32
155b305b0f1Sespie@itemx -m68330
1562159047fSniklas@itemx -m68331
1572159047fSniklas@itemx -m68332
1582159047fSniklas@itemx -m68333
159b305b0f1Sespie@itemx -m68334
160b305b0f1Sespie@itemx -m68336
1612159047fSniklas@itemx -m68340
162b305b0f1Sespie@itemx -m68341
163b305b0f1Sespie@itemx -m68349
1642159047fSniklas@itemx -m68360
1652159047fSniklasAssemble for the CPU32 family of chips.
1662159047fSniklas
1670c6d0228Sniklas@item -m5200
168*007c2a45Smiod@item -m5202
169*007c2a45Smiod@item -m5204
170*007c2a45Smiod@item -m5206
171*007c2a45Smiod@item -m5206e
172*007c2a45Smiod@item -m528x
173*007c2a45Smiod@item -m5307
174*007c2a45Smiod@item -m5407
175*007c2a45Smiod@item -mcfv4
176*007c2a45Smiod@item -mcfv4e
1770c6d0228SniklasAssemble for the ColdFire family of chips.
1780c6d0228Sniklas
1792159047fSniklas@item -m68881
1802159047fSniklas@itemx -m68882
1812159047fSniklasAssemble 68881 floating point instructions.  This is the default for the
1822159047fSniklas68020, 68030, and the CPU32.  The 68040 and 68060 always support
1832159047fSniklasfloating point instructions.
1842159047fSniklas
1852159047fSniklas@item -mno-68881
1862159047fSniklasDo not assemble 68881 floating point instructions.  This is the default
1872159047fSniklasfor 68000 and the 68010.  The 68040 and 68060 always support floating
1882159047fSniklaspoint instructions, even if this option is used.
1892159047fSniklas
1902159047fSniklas@item -m68851
1912159047fSniklasAssemble 68851 MMU instructions.  This is the default for the 68020,
1922159047fSniklas68030, and 68060.  The 68040 accepts a somewhat different set of MMU
1932159047fSniklasinstructions; @samp{-m68851} and @samp{-m68040} should not be used
1942159047fSniklastogether.
1952159047fSniklas
1962159047fSniklas@item -mno-68851
1972159047fSniklasDo not assemble 68851 MMU instructions.  This is the default for the
1982159047fSniklas68000, 68010, and the CPU32.  The 68040 accepts a somewhat different set
1992159047fSniklasof MMU instructions.
2002159047fSniklas@end table
201b55d4692Sfgsch@end table
2022159047fSniklas
2032159047fSniklas@node M68K-Syntax
2042159047fSniklas@section Syntax
2052159047fSniklas
2062159047fSniklas@cindex @sc{mit}
2072159047fSniklasThis syntax for the Motorola 680x0 was developed at @sc{mit}.
2082159047fSniklas
2092159047fSniklas@cindex M680x0 syntax
2102159047fSniklas@cindex syntax, M680x0
2112159047fSniklas@cindex M680x0 size modifiers
2122159047fSniklas@cindex size modifiers, M680x0
2132159047fSniklasThe 680x0 version of @code{@value{AS}} uses instructions names and
2142159047fSniklassyntax compatible with the Sun assembler.  Intervening periods are
2152159047fSniklasignored; for example, @samp{movl} is equivalent to @samp{mov.l}.
2162159047fSniklas
2172159047fSniklasIn the following table @var{apc} stands for any of the address registers
2182159047fSniklas(@samp{%a0} through @samp{%a7}), the program counter (@samp{%pc}), the
2192159047fSniklaszero-address relative to the program counter (@samp{%zpc}), a suppressed
2202159047fSniklasaddress register (@samp{%za0} through @samp{%za7}), or it may be omitted
2212159047fSniklasentirely.  The use of @var{size} means one of @samp{w} or @samp{l}, and
2222159047fSniklasit may be omitted, along with the leading colon, unless a scale is also
2232159047fSniklasspecified.  The use of @var{scale} means one of @samp{1}, @samp{2},
2242159047fSniklas@samp{4}, or @samp{8}, and it may always be omitted along with the
2252159047fSniklasleading colon.
2262159047fSniklas
2272159047fSniklas@cindex M680x0 addressing modes
2282159047fSniklas@cindex addressing modes, M680x0
2292159047fSniklasThe following addressing modes are understood:
2302159047fSniklas@table @dfn
2312159047fSniklas@item Immediate
2322159047fSniklas@samp{#@var{number}}
2332159047fSniklas
2342159047fSniklas@item Data Register
2352159047fSniklas@samp{%d0} through @samp{%d7}
2362159047fSniklas
2372159047fSniklas@item Address Register
2382159047fSniklas@samp{%a0} through @samp{%a7}@*
2392159047fSniklas@samp{%a7} is also known as @samp{%sp}, i.e. the Stack Pointer.  @code{%a6}
2402159047fSniklasis also known as @samp{%fp}, the Frame Pointer.
2412159047fSniklas
2422159047fSniklas@item Address Register Indirect
2432159047fSniklas@samp{%a0@@} through @samp{%a7@@}
2442159047fSniklas
2452159047fSniklas@item Address Register Postincrement
2462159047fSniklas@samp{%a0@@+} through @samp{%a7@@+}
2472159047fSniklas
2482159047fSniklas@item Address Register Predecrement
2492159047fSniklas@samp{%a0@@-} through @samp{%a7@@-}
2502159047fSniklas
2512159047fSniklas@item Indirect Plus Offset
2522159047fSniklas@samp{@var{apc}@@(@var{number})}
2532159047fSniklas
2542159047fSniklas@item Index
2552159047fSniklas@samp{@var{apc}@@(@var{number},@var{register}:@var{size}:@var{scale})}
2562159047fSniklas
2572159047fSniklasThe @var{number} may be omitted.
2582159047fSniklas
2592159047fSniklas@item Postindex
2602159047fSniklas@samp{@var{apc}@@(@var{number})@@(@var{onumber},@var{register}:@var{size}:@var{scale})}
2612159047fSniklas
2622159047fSniklasThe @var{onumber} or the @var{register}, but not both, may be omitted.
2632159047fSniklas
2642159047fSniklas@item Preindex
2652159047fSniklas@samp{@var{apc}@@(@var{number},@var{register}:@var{size}:@var{scale})@@(@var{onumber})}
2662159047fSniklas
2672159047fSniklasThe @var{number} may be omitted.  Omitting the @var{register} produces
2682159047fSniklasthe Postindex addressing mode.
2692159047fSniklas
2702159047fSniklas@item Absolute
2712159047fSniklas@samp{@var{symbol}}, or @samp{@var{digits}}, optionally followed by
2722159047fSniklas@samp{:b}, @samp{:w}, or @samp{:l}.
2732159047fSniklas@end table
2742159047fSniklas
2752159047fSniklas@node M68K-Moto-Syntax
2762159047fSniklas@section Motorola Syntax
2772159047fSniklas
2782159047fSniklas@cindex Motorola syntax for the 680x0
2792159047fSniklas@cindex alternate syntax for the 680x0
2802159047fSniklas
2812159047fSniklasThe standard Motorola syntax for this chip differs from the syntax
2822159047fSniklasalready discussed (@pxref{M68K-Syntax,,Syntax}).  @code{@value{AS}} can
2832159047fSniklasaccept Motorola syntax for operands, even if @sc{mit} syntax is used for
2842159047fSniklasother operands in the same instruction.  The two kinds of syntax are
2852159047fSniklasfully compatible.
2862159047fSniklas
2872159047fSniklasIn the following table @var{apc} stands for any of the address registers
2882159047fSniklas(@samp{%a0} through @samp{%a7}), the program counter (@samp{%pc}), the
2892159047fSniklaszero-address relative to the program counter (@samp{%zpc}), or a
2902159047fSniklassuppressed address register (@samp{%za0} through @samp{%za7}).  The use
2912159047fSniklasof @var{size} means one of @samp{w} or @samp{l}, and it may always be
2922159047fSniklasomitted along with the leading dot.  The use of @var{scale} means one of
2932159047fSniklas@samp{1}, @samp{2}, @samp{4}, or @samp{8}, and it may always be omitted
2942159047fSniklasalong with the leading asterisk.
2952159047fSniklas
2962159047fSniklasThe following additional addressing modes are understood:
2972159047fSniklas
2982159047fSniklas@table @dfn
2992159047fSniklas@item Address Register Indirect
3002159047fSniklas@samp{(%a0)} through @samp{(%a7)}@*
3012159047fSniklas@samp{%a7} is also known as @samp{%sp}, i.e. the Stack Pointer.  @code{%a6}
3022159047fSniklasis also known as @samp{%fp}, the Frame Pointer.
3032159047fSniklas
3042159047fSniklas@item Address Register Postincrement
3052159047fSniklas@samp{(%a0)+} through @samp{(%a7)+}
3062159047fSniklas
3072159047fSniklas@item Address Register Predecrement
3082159047fSniklas@samp{-(%a0)} through @samp{-(%a7)}
3092159047fSniklas
3102159047fSniklas@item Indirect Plus Offset
3112159047fSniklas@samp{@var{number}(@var{%a0})} through @samp{@var{number}(@var{%a7})},
3122159047fSniklasor @samp{@var{number}(@var{%pc})}.
3132159047fSniklas
3142159047fSniklasThe @var{number} may also appear within the parentheses, as in
3152159047fSniklas@samp{(@var{number},@var{%a0})}.  When used with the @var{pc}, the
3162159047fSniklas@var{number} may be omitted (with an address register, omitting the
3172159047fSniklas@var{number} produces Address Register Indirect mode).
3182159047fSniklas
3192159047fSniklas@item Index
3202159047fSniklas@samp{@var{number}(@var{apc},@var{register}.@var{size}*@var{scale})}
3212159047fSniklas
3222159047fSniklasThe @var{number} may be omitted, or it may appear within the
3232159047fSniklasparentheses.  The @var{apc} may be omitted.  The @var{register} and the
3242159047fSniklas@var{apc} may appear in either order.  If both @var{apc} and
3252159047fSniklas@var{register} are address registers, and the @var{size} and @var{scale}
3262159047fSniklasare omitted, then the first register is taken as the base register, and
3272159047fSniklasthe second as the index register.
3282159047fSniklas
3292159047fSniklas@item Postindex
3302159047fSniklas@samp{([@var{number},@var{apc}],@var{register}.@var{size}*@var{scale},@var{onumber})}
3312159047fSniklas
3322159047fSniklasThe @var{onumber}, or the @var{register}, or both, may be omitted.
3332159047fSniklasEither the @var{number} or the @var{apc} may be omitted, but not both.
3342159047fSniklas
3352159047fSniklas@item Preindex
3362159047fSniklas@samp{([@var{number},@var{apc},@var{register}.@var{size}*@var{scale}],@var{onumber})}
3372159047fSniklas
3382159047fSniklasThe @var{number}, or the @var{apc}, or the @var{register}, or any two of
3392159047fSniklasthem, may be omitted.  The @var{onumber} may be omitted.  The
3402159047fSniklas@var{register} and the @var{apc} may appear in either order.  If both
3412159047fSniklas@var{apc} and @var{register} are address registers, and the @var{size}
3422159047fSniklasand @var{scale} are omitted, then the first register is taken as the
3432159047fSniklasbase register, and the second as the index register.
3442159047fSniklas@end table
3452159047fSniklas
3462159047fSniklas@node M68K-Float
3472159047fSniklas@section Floating Point
3482159047fSniklas
3492159047fSniklas@cindex floating point, M680x0
3502159047fSniklas@cindex M680x0 floating point
3512159047fSniklasPacked decimal (P) format floating literals are not supported.
3522159047fSniklasFeel free to add the code!
3532159047fSniklas
3542159047fSniklasThe floating point formats generated by directives are these.
3552159047fSniklas
3562159047fSniklas@table @code
3572159047fSniklas@cindex @code{float} directive, M680x0
3582159047fSniklas@item .float
3592159047fSniklas@code{Single} precision floating point constants.
3602159047fSniklas
3612159047fSniklas@cindex @code{double} directive, M680x0
3622159047fSniklas@item .double
3632159047fSniklas@code{Double} precision floating point constants.
3642159047fSniklas
365191aa565Sniklas@cindex @code{extend} directive M680x0
366191aa565Sniklas@cindex @code{ldouble} directive M680x0
367191aa565Sniklas@item .extend
368191aa565Sniklas@itemx .ldouble
369191aa565Sniklas@code{Extended} precision (@code{long double}) floating point constants.
370191aa565Sniklas@end table
3712159047fSniklas
3722159047fSniklas@node M68K-Directives
3732159047fSniklas@section 680x0 Machine Directives
3742159047fSniklas
3752159047fSniklas@cindex M680x0 directives
3762159047fSniklas@cindex directives, M680x0
3772159047fSniklasIn order to be compatible with the Sun assembler the 680x0 assembler
3782159047fSniklasunderstands the following directives.
3792159047fSniklas
3802159047fSniklas@table @code
3812159047fSniklas@cindex @code{data1} directive, M680x0
3822159047fSniklas@item .data1
3832159047fSniklasThis directive is identical to a @code{.data 1} directive.
3842159047fSniklas
3852159047fSniklas@cindex @code{data2} directive, M680x0
3862159047fSniklas@item .data2
3872159047fSniklasThis directive is identical to a @code{.data 2} directive.
3882159047fSniklas
3892159047fSniklas@cindex @code{even} directive, M680x0
3902159047fSniklas@item .even
3912159047fSniklasThis directive is a special case of the @code{.align} directive; it
3922159047fSniklasaligns the output to an even byte boundary.
3932159047fSniklas
3942159047fSniklas@cindex @code{skip} directive, M680x0
3952159047fSniklas@item .skip
3962159047fSniklasThis directive is identical to a @code{.space} directive.
3972159047fSniklas@end table
3982159047fSniklas
3992159047fSniklas@need 2000
4002159047fSniklas@node M68K-opcodes
4012159047fSniklas@section Opcodes
4022159047fSniklas
4032159047fSniklas@cindex M680x0 opcodes
4042159047fSniklas@cindex opcodes, M680x0
4052159047fSniklas@cindex instruction set, M680x0
4062159047fSniklas@c doc@cygnus.com: I don't see any point in the following
4072159047fSniklas@c                   paragraph.  Bugs are bugs; how does saying this
4082159047fSniklas@c                   help anyone?
4092159047fSniklas@ignore
4102159047fSniklasDanger:  Several bugs have been found in the opcode table (and
4112159047fSniklasfixed).  More bugs may exist.  Be careful when using obscure
4122159047fSniklasinstructions.
4132159047fSniklas@end ignore
4142159047fSniklas
4152159047fSniklas@menu
4162159047fSniklas* M68K-Branch::                 Branch Improvement
4172159047fSniklas* M68K-Chars::                  Special Characters
4182159047fSniklas@end menu
4192159047fSniklas
4202159047fSniklas@node M68K-Branch
4212159047fSniklas@subsection Branch Improvement
4222159047fSniklas
4232159047fSniklas@cindex pseudo-opcodes, M680x0
4242159047fSniklas@cindex M680x0 pseudo-opcodes
4252159047fSniklas@cindex branch improvement, M680x0
4262159047fSniklas@cindex M680x0 branch improvement
4272159047fSniklasCertain pseudo opcodes are permitted for branch instructions.
4282159047fSniklasThey expand to the shortest branch instruction that reach the
4292159047fSniklastarget.  Generally these mnemonics are made by substituting @samp{j} for
4302159047fSniklas@samp{b} at the start of a Motorola mnemonic.
4312159047fSniklas
4322159047fSniklasThe following table summarizes the pseudo-operations.  A @code{*} flags
4332159047fSniklascases that are more fully described after the table:
4342159047fSniklas
4352159047fSniklas@smallexample
4362159047fSniklas          Displacement
437b55d4692Sfgsch          +------------------------------------------------------------
438b55d4692Sfgsch          |                68020           68000/10, not PC-relative OK
439b55d4692SfgschPseudo-Op |BYTE    WORD    LONG            ABSOLUTE LONG JUMP    **
440b55d4692Sfgsch          +------------------------------------------------------------
441b55d4692Sfgsch     jbsr |bsrs    bsrw    bsrl            jsr
442b55d4692Sfgsch      jra |bras    braw    bral            jmp
443b55d4692Sfgsch*     jXX |bXXs    bXXw    bXXl            bNXs;jmp
444b55d4692Sfgsch*    dbXX | N/A    dbXXw   dbXX;bras;bral  dbXX;bras;jmp
445b55d4692Sfgsch     fjXX | N/A    fbXXw   fbXXl            N/A
4462159047fSniklas
4472159047fSniklasXX: condition
4482159047fSniklasNX: negative of condition XX
4492159047fSniklas
4502159047fSniklas@end smallexample
4512159047fSniklas@center @code{*}---see full description below
452b55d4692Sfgsch@center @code{**}---this expansion mode is disallowed by @samp{--pcrel}
4532159047fSniklas
4542159047fSniklas@table @code
4552159047fSniklas@item jbsr
4562159047fSniklas@itemx jra
4572159047fSniklasThese are the simplest jump pseudo-operations; they always map to one
4582159047fSniklasparticular machine instruction, depending on the displacement to the
459b55d4692Sfgschbranch target.  This instruction will be a byte or word branch is that
460b55d4692Sfgschis sufficient.  Otherwise, a long branch will be emitted if available.
461b55d4692SfgschIf no long branches are available and the @samp{--pcrel} option is not
462b55d4692Sfgschgiven, an absolute long jump will be emitted instead.  If no long
463b55d4692Sfgschbranches are available, the @samp{--pcrel} option is given, and a word
464b55d4692Sfgschbranch cannot reach the target, an error message is generated.
465b55d4692Sfgsch
466b55d4692SfgschIn addition to standard branch operands, @code{@value{AS}} allows these
467b55d4692Sfgschpseudo-operations to have all operands that are allowed for jsr and jmp,
468b55d4692Sfgschsubstituting these instructions if the operand given is not valid for a
469b55d4692Sfgschbranch instruction.
4702159047fSniklas
4712159047fSniklas@item j@var{XX}
4722159047fSniklasHere, @samp{j@var{XX}} stands for an entire family of pseudo-operations,
4732159047fSniklaswhere @var{XX} is a conditional branch or condition-code test.  The full
4742159047fSniklaslist of pseudo-ops in this family is:
4752159047fSniklas@smallexample
4762159047fSniklas jhi   jls   jcc   jcs   jne   jeq   jvc
4772159047fSniklas jvs   jpl   jmi   jge   jlt   jgt   jle
4782159047fSniklas@end smallexample
4792159047fSniklas
480b55d4692SfgschUsually, each of these pseudo-operations expands to a single branch
481b55d4692Sfgschinstruction.  However, if a word branch is not sufficient, no long branches
482b55d4692Sfgschare available, and the @samp{--pcrel} option is not given, @code{@value{AS}}
483b55d4692Sfgschissues a longer code fragment in terms of @var{NX}, the opposite condition
484b55d4692Sfgschto @var{XX}.  For example, under these conditions:
4852159047fSniklas@smallexample
4862159047fSniklas    j@var{XX} foo
4872159047fSniklas@end smallexample
4882159047fSniklasgives
4892159047fSniklas@smallexample
4902159047fSniklas     b@var{NX}s oof
4912159047fSniklas     jmp foo
4922159047fSniklas oof:
4932159047fSniklas@end smallexample
4942159047fSniklas
4952159047fSniklas@item db@var{XX}
4962159047fSniklasThe full family of pseudo-operations covered here is
4972159047fSniklas@smallexample
4982159047fSniklas dbhi   dbls   dbcc   dbcs   dbne   dbeq   dbvc
4992159047fSniklas dbvs   dbpl   dbmi   dbge   dblt   dbgt   dble
5002159047fSniklas dbf    dbra   dbt
5012159047fSniklas@end smallexample
5022159047fSniklas
503b55d4692SfgschMotorola @samp{db@var{XX}} instructions allow word displacements only.  When
504b55d4692Sfgscha word displacement is sufficient, each of these pseudo-operations expands
505b55d4692Sfgschto the corresponding Motorola instruction.  When a word displacement is not
506b55d4692Sfgschsufficient and long branches are available, when the source reads
5072159047fSniklas@samp{db@var{XX} foo}, @code{@value{AS}} emits
5082159047fSniklas@smallexample
5092159047fSniklas     db@var{XX} oo1
510b55d4692Sfgsch     bras oo2
511b55d4692Sfgsch oo1:bral foo
512b55d4692Sfgsch oo2:
513b55d4692Sfgsch@end smallexample
514b55d4692Sfgsch
515b55d4692SfgschIf, however, long branches are not available and the @samp{--pcrel} option is
516b55d4692Sfgschnot given, @code{@value{AS}} emits
517b55d4692Sfgsch@smallexample
518b55d4692Sfgsch     db@var{XX} oo1
519b55d4692Sfgsch     bras oo2
520b55d4692Sfgsch oo1:jmp foo
5212159047fSniklas oo2:
5222159047fSniklas@end smallexample
5232159047fSniklas
5242159047fSniklas@item fj@var{XX}
5252159047fSniklasThis family includes
5262159047fSniklas@smallexample
5272159047fSniklas fjne   fjeq   fjge   fjlt   fjgt   fjle   fjf
5282159047fSniklas fjt    fjgl   fjgle  fjnge  fjngl  fjngle fjngt
5292159047fSniklas fjnle  fjnlt  fjoge  fjogl  fjogt  fjole  fjolt
5302159047fSniklas fjor   fjseq  fjsf   fjsne  fjst   fjueq  fjuge
5312159047fSniklas fjugt  fjule  fjult  fjun
5322159047fSniklas@end smallexample
5332159047fSniklas
534b55d4692SfgschEach of these pseudo-operations always expands to a single Motorola
535b55d4692Sfgschcoprocessor branch instruction, word or long.  All Motorola coprocessor
536b55d4692Sfgschbranch instructions allow both word and long displacements.
5372159047fSniklas
5382159047fSniklas@end table
5392159047fSniklas
5402159047fSniklas@node M68K-Chars
5412159047fSniklas@subsection Special Characters
5422159047fSniklas
5432159047fSniklas@cindex special characters, M680x0
5442159047fSniklas@cindex M680x0 immediate character
5452159047fSniklas@cindex immediate character, M680x0
5462159047fSniklas@cindex M680x0 line comment character
5472159047fSniklas@cindex line comment character, M680x0
5482159047fSniklas@cindex comments, M680x0
5492159047fSniklasThe immediate character is @samp{#} for Sun compatibility.  The
550191aa565Sniklasline-comment character is @samp{|} (unless the @samp{--bitwise-or}
551191aa565Sniklasoption is used).  If a @samp{#} appears at the beginning of a line, it
552191aa565Sniklasis treated as a comment unless it looks like @samp{# line file}, in
553191aa565Sniklaswhich case it is treated normally.
5542159047fSniklas
555