1*a9fa9459Szrj@c Copyright (C) 1991-2016 Free Software Foundation, Inc. 2*a9fa9459Szrj@c This is part of the GAS manual. 3*a9fa9459Szrj@c For copying conditions, see the file as.texinfo. 4*a9fa9459Szrj@ifset GENERIC 5*a9fa9459Szrj@page 6*a9fa9459Szrj@node M68K-Dependent 7*a9fa9459Szrj@chapter M680x0 Dependent Features 8*a9fa9459Szrj@end ifset 9*a9fa9459Szrj@ifclear GENERIC 10*a9fa9459Szrj@node Machine Dependencies 11*a9fa9459Szrj@chapter M680x0 Dependent Features 12*a9fa9459Szrj@end ifclear 13*a9fa9459Szrj 14*a9fa9459Szrj@cindex M680x0 support 15*a9fa9459Szrj@menu 16*a9fa9459Szrj* M68K-Opts:: M680x0 Options 17*a9fa9459Szrj* M68K-Syntax:: Syntax 18*a9fa9459Szrj* M68K-Moto-Syntax:: Motorola Syntax 19*a9fa9459Szrj* M68K-Float:: Floating Point 20*a9fa9459Szrj* M68K-Directives:: 680x0 Machine Directives 21*a9fa9459Szrj* M68K-opcodes:: Opcodes 22*a9fa9459Szrj@end menu 23*a9fa9459Szrj 24*a9fa9459Szrj@node M68K-Opts 25*a9fa9459Szrj@section M680x0 Options 26*a9fa9459Szrj 27*a9fa9459Szrj@cindex options, M680x0 28*a9fa9459Szrj@cindex M680x0 options 29*a9fa9459SzrjThe Motorola 680x0 version of @code{@value{AS}} has a few machine 30*a9fa9459Szrjdependent options: 31*a9fa9459Szrj 32*a9fa9459Szrj@table @samp 33*a9fa9459Szrj 34*a9fa9459Szrj@cindex @samp{-march=} command line option, M680x0 35*a9fa9459Szrj@item -march=@var{architecture} 36*a9fa9459SzrjThis option specifies a target architecture. The following 37*a9fa9459Szrjarchitectures are recognized: 38*a9fa9459Szrj@code{68000}, 39*a9fa9459Szrj@code{68010}, 40*a9fa9459Szrj@code{68020}, 41*a9fa9459Szrj@code{68030}, 42*a9fa9459Szrj@code{68040}, 43*a9fa9459Szrj@code{68060}, 44*a9fa9459Szrj@code{cpu32}, 45*a9fa9459Szrj@code{isaa}, 46*a9fa9459Szrj@code{isaaplus}, 47*a9fa9459Szrj@code{isab}, 48*a9fa9459Szrj@code{isac} and 49*a9fa9459Szrj@code{cfv4e}. 50*a9fa9459Szrj 51*a9fa9459Szrj 52*a9fa9459Szrj@cindex @samp{-mcpu=} command line option, M680x0 53*a9fa9459Szrj@item -mcpu=@var{cpu} 54*a9fa9459SzrjThis option specifies a target cpu. When used in conjunction with the 55*a9fa9459Szrj@option{-march} option, the cpu must be within the specified 56*a9fa9459Szrjarchitecture. Also, the generic features of the architecture are used 57*a9fa9459Szrjfor instruction generation, rather than those of the specific chip. 58*a9fa9459Szrj 59*a9fa9459Szrj@cindex @samp{-m[no-]68851} command line option, M680x0 60*a9fa9459Szrj@cindex @samp{-m[no-]68881} command line option, M680x0 61*a9fa9459Szrj@cindex @samp{-m[no-]div} command line option, M680x0 62*a9fa9459Szrj@cindex @samp{-m[no-]usp} command line option, M680x0 63*a9fa9459Szrj@cindex @samp{-m[no-]float} command line option, M680x0 64*a9fa9459Szrj@cindex @samp{-m[no-]mac} command line option, M680x0 65*a9fa9459Szrj@cindex @samp{-m[no-]emac} command line option, M680x0 66*a9fa9459Szrj@item -m[no-]68851 67*a9fa9459Szrj@itemx -m[no-]68881 68*a9fa9459Szrj@itemx -m[no-]div 69*a9fa9459Szrj@itemx -m[no-]usp 70*a9fa9459Szrj@itemx -m[no-]float 71*a9fa9459Szrj@itemx -m[no-]mac 72*a9fa9459Szrj@itemx -m[no-]emac 73*a9fa9459Szrj 74*a9fa9459SzrjEnable or disable various architecture specific features. If a chip 75*a9fa9459Szrjor architecture by default supports an option (for instance 76*a9fa9459Szrj@option{-march=isaaplus} includes the @option{-mdiv} option), 77*a9fa9459Szrjexplicitly disabling the option will override the default. 78*a9fa9459Szrj 79*a9fa9459Szrj@cindex @samp{-l} option, M680x0 80*a9fa9459Szrj@item -l 81*a9fa9459SzrjYou can use the @samp{-l} option to shorten the size of references to undefined 82*a9fa9459Szrjsymbols. If you do not use the @samp{-l} option, references to undefined 83*a9fa9459Szrjsymbols are wide enough for a full @code{long} (32 bits). (Since 84*a9fa9459Szrj@code{@value{AS}} cannot know where these symbols end up, @code{@value{AS}} can 85*a9fa9459Szrjonly allocate space for the linker to fill in later. Since @code{@value{AS}} 86*a9fa9459Szrjdoes not know how far away these symbols are, it allocates as much space as it 87*a9fa9459Szrjcan.) If you use this option, the references are only one word wide (16 bits). 88*a9fa9459SzrjThis may be useful if you want the object file to be as small as possible, and 89*a9fa9459Szrjyou know that the relevant symbols are always less than 17 bits away. 90*a9fa9459Szrj 91*a9fa9459Szrj@cindex @samp{--register-prefix-optional} option, M680x0 92*a9fa9459Szrj@item --register-prefix-optional 93*a9fa9459SzrjFor some configurations, especially those where the compiler normally 94*a9fa9459Szrjdoes not prepend an underscore to the names of user variables, the 95*a9fa9459Szrjassembler requires a @samp{%} before any use of a register name. This 96*a9fa9459Szrjis intended to let the assembler distinguish between C variables and 97*a9fa9459Szrjfunctions named @samp{a0} through @samp{a7}, and so on. The @samp{%} is 98*a9fa9459Szrjalways accepted, but is not required for certain configurations, notably 99*a9fa9459Szrj@samp{sun3}. The @samp{--register-prefix-optional} option may be used 100*a9fa9459Szrjto permit omitting the @samp{%} even for configurations for which it is 101*a9fa9459Szrjnormally required. If this is done, it will generally be impossible to 102*a9fa9459Szrjrefer to C variables and functions with the same names as register 103*a9fa9459Szrjnames. 104*a9fa9459Szrj 105*a9fa9459Szrj@cindex @samp{--bitwise-or} option, M680x0 106*a9fa9459Szrj@item --bitwise-or 107*a9fa9459SzrjNormally the character @samp{|} is treated as a comment character, which 108*a9fa9459Szrjmeans that it can not be used in expressions. The @samp{--bitwise-or} 109*a9fa9459Szrjoption turns @samp{|} into a normal character. In this mode, you must 110*a9fa9459Szrjeither use C style comments, or start comments with a @samp{#} character 111*a9fa9459Szrjat the beginning of a line. 112*a9fa9459Szrj 113*a9fa9459Szrj@cindex @samp{--base-size-default-16} 114*a9fa9459Szrj@cindex @samp{--base-size-default-32} 115*a9fa9459Szrj@item --base-size-default-16 --base-size-default-32 116*a9fa9459SzrjIf you use an addressing mode with a base register without specifying 117*a9fa9459Szrjthe size, @code{@value{AS}} will normally use the full 32 bit value. 118*a9fa9459SzrjFor example, the addressing mode @samp{%a0@@(%d0)} is equivalent to 119*a9fa9459Szrj@samp{%a0@@(%d0:l)}. You may use the @samp{--base-size-default-16} 120*a9fa9459Szrjoption to tell @code{@value{AS}} to default to using the 16 bit value. 121*a9fa9459SzrjIn this case, @samp{%a0@@(%d0)} is equivalent to @samp{%a0@@(%d0:w)}. 122*a9fa9459SzrjYou may use the @samp{--base-size-default-32} option to restore the 123*a9fa9459Szrjdefault behaviour. 124*a9fa9459Szrj 125*a9fa9459Szrj@cindex @samp{--disp-size-default-16} 126*a9fa9459Szrj@cindex @samp{--disp-size-default-32} 127*a9fa9459Szrj@item --disp-size-default-16 --disp-size-default-32 128*a9fa9459SzrjIf you use an addressing mode with a displacement, and the value of the 129*a9fa9459Szrjdisplacement is not known, @code{@value{AS}} will normally assume that 130*a9fa9459Szrjthe value is 32 bits. For example, if the symbol @samp{disp} has not 131*a9fa9459Szrjbeen defined, @code{@value{AS}} will assemble the addressing mode 132*a9fa9459Szrj@samp{%a0@@(disp,%d0)} as though @samp{disp} is a 32 bit value. You may 133*a9fa9459Szrjuse the @samp{--disp-size-default-16} option to tell @code{@value{AS}} 134*a9fa9459Szrjto instead assume that the displacement is 16 bits. In this case, 135*a9fa9459Szrj@code{@value{AS}} will assemble @samp{%a0@@(disp,%d0)} as though 136*a9fa9459Szrj@samp{disp} is a 16 bit value. You may use the 137*a9fa9459Szrj@samp{--disp-size-default-32} option to restore the default behaviour. 138*a9fa9459Szrj 139*a9fa9459Szrj@cindex @samp{--pcrel} 140*a9fa9459Szrj@item --pcrel 141*a9fa9459SzrjAlways keep branches PC-relative. In the M680x0 architecture all branches 142*a9fa9459Szrjare defined as PC-relative. However, on some processors they are limited 143*a9fa9459Szrjto word displacements maximum. When @code{@value{AS}} needs a long branch 144*a9fa9459Szrjthat is not available, it normally emits an absolute jump instead. This 145*a9fa9459Szrjoption disables this substitution. When this option is given and no long 146*a9fa9459Szrjbranches are available, only word branches will be emitted. An error 147*a9fa9459Szrjmessage will be generated if a word branch cannot reach its target. This 148*a9fa9459Szrjoption has no effect on 68020 and other processors that have long branches. 149*a9fa9459Szrj@pxref{M68K-Branch,,Branch Improvement}. 150*a9fa9459Szrj 151*a9fa9459Szrj@cindex @samp{-m68000} and related options 152*a9fa9459Szrj@cindex architecture options, M680x0 153*a9fa9459Szrj@cindex M680x0 architecture options 154*a9fa9459Szrj@item -m68000 155*a9fa9459Szrj@code{@value{AS}} can assemble code for several different members of the 156*a9fa9459SzrjMotorola 680x0 family. The default depends upon how @code{@value{AS}} 157*a9fa9459Szrjwas configured when it was built; normally, the default is to assemble 158*a9fa9459Szrjcode for the 68020 microprocessor. The following options may be used to 159*a9fa9459Szrjchange the default. These options control which instructions and 160*a9fa9459Szrjaddressing modes are permitted. The members of the 680x0 family are 161*a9fa9459Szrjvery similar. For detailed information about the differences, see the 162*a9fa9459SzrjMotorola manuals. 163*a9fa9459Szrj 164*a9fa9459Szrj@table @samp 165*a9fa9459Szrj@item -m68000 166*a9fa9459Szrj@itemx -m68ec000 167*a9fa9459Szrj@itemx -m68hc000 168*a9fa9459Szrj@itemx -m68hc001 169*a9fa9459Szrj@itemx -m68008 170*a9fa9459Szrj@itemx -m68302 171*a9fa9459Szrj@itemx -m68306 172*a9fa9459Szrj@itemx -m68307 173*a9fa9459Szrj@itemx -m68322 174*a9fa9459Szrj@itemx -m68356 175*a9fa9459SzrjAssemble for the 68000. @samp{-m68008}, @samp{-m68302}, and so on are synonyms 176*a9fa9459Szrjfor @samp{-m68000}, since the chips are the same from the point of view 177*a9fa9459Szrjof the assembler. 178*a9fa9459Szrj 179*a9fa9459Szrj@item -m68010 180*a9fa9459SzrjAssemble for the 68010. 181*a9fa9459Szrj 182*a9fa9459Szrj@item -m68020 183*a9fa9459Szrj@itemx -m68ec020 184*a9fa9459SzrjAssemble for the 68020. This is normally the default. 185*a9fa9459Szrj 186*a9fa9459Szrj@item -m68030 187*a9fa9459Szrj@itemx -m68ec030 188*a9fa9459SzrjAssemble for the 68030. 189*a9fa9459Szrj 190*a9fa9459Szrj@item -m68040 191*a9fa9459Szrj@itemx -m68ec040 192*a9fa9459SzrjAssemble for the 68040. 193*a9fa9459Szrj 194*a9fa9459Szrj@item -m68060 195*a9fa9459Szrj@itemx -m68ec060 196*a9fa9459SzrjAssemble for the 68060. 197*a9fa9459Szrj 198*a9fa9459Szrj@item -mcpu32 199*a9fa9459Szrj@itemx -m68330 200*a9fa9459Szrj@itemx -m68331 201*a9fa9459Szrj@itemx -m68332 202*a9fa9459Szrj@itemx -m68333 203*a9fa9459Szrj@itemx -m68334 204*a9fa9459Szrj@itemx -m68336 205*a9fa9459Szrj@itemx -m68340 206*a9fa9459Szrj@itemx -m68341 207*a9fa9459Szrj@itemx -m68349 208*a9fa9459Szrj@itemx -m68360 209*a9fa9459SzrjAssemble for the CPU32 family of chips. 210*a9fa9459Szrj 211*a9fa9459Szrj@item -m5200 212*a9fa9459Szrj@itemx -m5202 213*a9fa9459Szrj@itemx -m5204 214*a9fa9459Szrj@itemx -m5206 215*a9fa9459Szrj@itemx -m5206e 216*a9fa9459Szrj@itemx -m521x 217*a9fa9459Szrj@itemx -m5249 218*a9fa9459Szrj@itemx -m528x 219*a9fa9459Szrj@itemx -m5307 220*a9fa9459Szrj@itemx -m5407 221*a9fa9459Szrj@itemx -m547x 222*a9fa9459Szrj@itemx -m548x 223*a9fa9459Szrj@itemx -mcfv4 224*a9fa9459Szrj@itemx -mcfv4e 225*a9fa9459SzrjAssemble for the ColdFire family of chips. 226*a9fa9459Szrj 227*a9fa9459Szrj@item -m68881 228*a9fa9459Szrj@itemx -m68882 229*a9fa9459SzrjAssemble 68881 floating point instructions. This is the default for the 230*a9fa9459Szrj68020, 68030, and the CPU32. The 68040 and 68060 always support 231*a9fa9459Szrjfloating point instructions. 232*a9fa9459Szrj 233*a9fa9459Szrj@item -mno-68881 234*a9fa9459SzrjDo not assemble 68881 floating point instructions. This is the default 235*a9fa9459Szrjfor 68000 and the 68010. The 68040 and 68060 always support floating 236*a9fa9459Szrjpoint instructions, even if this option is used. 237*a9fa9459Szrj 238*a9fa9459Szrj@item -m68851 239*a9fa9459SzrjAssemble 68851 MMU instructions. This is the default for the 68020, 240*a9fa9459Szrj68030, and 68060. The 68040 accepts a somewhat different set of MMU 241*a9fa9459Szrjinstructions; @samp{-m68851} and @samp{-m68040} should not be used 242*a9fa9459Szrjtogether. 243*a9fa9459Szrj 244*a9fa9459Szrj@item -mno-68851 245*a9fa9459SzrjDo not assemble 68851 MMU instructions. This is the default for the 246*a9fa9459Szrj68000, 68010, and the CPU32. The 68040 accepts a somewhat different set 247*a9fa9459Szrjof MMU instructions. 248*a9fa9459Szrj@end table 249*a9fa9459Szrj@end table 250*a9fa9459Szrj 251*a9fa9459Szrj@node M68K-Syntax 252*a9fa9459Szrj@section Syntax 253*a9fa9459Szrj 254*a9fa9459Szrj@cindex @sc{mit} 255*a9fa9459SzrjThis syntax for the Motorola 680x0 was developed at @sc{mit}. 256*a9fa9459Szrj 257*a9fa9459Szrj@cindex M680x0 syntax 258*a9fa9459Szrj@cindex syntax, M680x0 259*a9fa9459Szrj@cindex M680x0 size modifiers 260*a9fa9459Szrj@cindex size modifiers, M680x0 261*a9fa9459SzrjThe 680x0 version of @code{@value{AS}} uses instructions names and 262*a9fa9459Szrjsyntax compatible with the Sun assembler. Intervening periods are 263*a9fa9459Szrjignored; for example, @samp{movl} is equivalent to @samp{mov.l}. 264*a9fa9459Szrj 265*a9fa9459SzrjIn the following table @var{apc} stands for any of the address registers 266*a9fa9459Szrj(@samp{%a0} through @samp{%a7}), the program counter (@samp{%pc}), the 267*a9fa9459Szrjzero-address relative to the program counter (@samp{%zpc}), a suppressed 268*a9fa9459Szrjaddress register (@samp{%za0} through @samp{%za7}), or it may be omitted 269*a9fa9459Szrjentirely. The use of @var{size} means one of @samp{w} or @samp{l}, and 270*a9fa9459Szrjit may be omitted, along with the leading colon, unless a scale is also 271*a9fa9459Szrjspecified. The use of @var{scale} means one of @samp{1}, @samp{2}, 272*a9fa9459Szrj@samp{4}, or @samp{8}, and it may always be omitted along with the 273*a9fa9459Szrjleading colon. 274*a9fa9459Szrj 275*a9fa9459Szrj@cindex M680x0 addressing modes 276*a9fa9459Szrj@cindex addressing modes, M680x0 277*a9fa9459SzrjThe following addressing modes are understood: 278*a9fa9459Szrj@table @dfn 279*a9fa9459Szrj@item Immediate 280*a9fa9459Szrj@samp{#@var{number}} 281*a9fa9459Szrj 282*a9fa9459Szrj@item Data Register 283*a9fa9459Szrj@samp{%d0} through @samp{%d7} 284*a9fa9459Szrj 285*a9fa9459Szrj@item Address Register 286*a9fa9459Szrj@samp{%a0} through @samp{%a7}@* 287*a9fa9459Szrj@samp{%a7} is also known as @samp{%sp}, i.e., the Stack Pointer. @code{%a6} 288*a9fa9459Szrjis also known as @samp{%fp}, the Frame Pointer. 289*a9fa9459Szrj 290*a9fa9459Szrj@item Address Register Indirect 291*a9fa9459Szrj@samp{%a0@@} through @samp{%a7@@} 292*a9fa9459Szrj 293*a9fa9459Szrj@item Address Register Postincrement 294*a9fa9459Szrj@samp{%a0@@+} through @samp{%a7@@+} 295*a9fa9459Szrj 296*a9fa9459Szrj@item Address Register Predecrement 297*a9fa9459Szrj@samp{%a0@@-} through @samp{%a7@@-} 298*a9fa9459Szrj 299*a9fa9459Szrj@item Indirect Plus Offset 300*a9fa9459Szrj@samp{@var{apc}@@(@var{number})} 301*a9fa9459Szrj 302*a9fa9459Szrj@item Index 303*a9fa9459Szrj@samp{@var{apc}@@(@var{number},@var{register}:@var{size}:@var{scale})} 304*a9fa9459Szrj 305*a9fa9459SzrjThe @var{number} may be omitted. 306*a9fa9459Szrj 307*a9fa9459Szrj@item Postindex 308*a9fa9459Szrj@samp{@var{apc}@@(@var{number})@@(@var{onumber},@var{register}:@var{size}:@var{scale})} 309*a9fa9459Szrj 310*a9fa9459SzrjThe @var{onumber} or the @var{register}, but not both, may be omitted. 311*a9fa9459Szrj 312*a9fa9459Szrj@item Preindex 313*a9fa9459Szrj@samp{@var{apc}@@(@var{number},@var{register}:@var{size}:@var{scale})@@(@var{onumber})} 314*a9fa9459Szrj 315*a9fa9459SzrjThe @var{number} may be omitted. Omitting the @var{register} produces 316*a9fa9459Szrjthe Postindex addressing mode. 317*a9fa9459Szrj 318*a9fa9459Szrj@item Absolute 319*a9fa9459Szrj@samp{@var{symbol}}, or @samp{@var{digits}}, optionally followed by 320*a9fa9459Szrj@samp{:b}, @samp{:w}, or @samp{:l}. 321*a9fa9459Szrj@end table 322*a9fa9459Szrj 323*a9fa9459Szrj@node M68K-Moto-Syntax 324*a9fa9459Szrj@section Motorola Syntax 325*a9fa9459Szrj 326*a9fa9459Szrj@cindex Motorola syntax for the 680x0 327*a9fa9459Szrj@cindex alternate syntax for the 680x0 328*a9fa9459Szrj 329*a9fa9459SzrjThe standard Motorola syntax for this chip differs from the syntax 330*a9fa9459Szrjalready discussed (@pxref{M68K-Syntax,,Syntax}). @code{@value{AS}} can 331*a9fa9459Szrjaccept Motorola syntax for operands, even if @sc{mit} syntax is used for 332*a9fa9459Szrjother operands in the same instruction. The two kinds of syntax are 333*a9fa9459Szrjfully compatible. 334*a9fa9459Szrj 335*a9fa9459SzrjIn the following table @var{apc} stands for any of the address registers 336*a9fa9459Szrj(@samp{%a0} through @samp{%a7}), the program counter (@samp{%pc}), the 337*a9fa9459Szrjzero-address relative to the program counter (@samp{%zpc}), or a 338*a9fa9459Szrjsuppressed address register (@samp{%za0} through @samp{%za7}). The use 339*a9fa9459Szrjof @var{size} means one of @samp{w} or @samp{l}, and it may always be 340*a9fa9459Szrjomitted along with the leading dot. The use of @var{scale} means one of 341*a9fa9459Szrj@samp{1}, @samp{2}, @samp{4}, or @samp{8}, and it may always be omitted 342*a9fa9459Szrjalong with the leading asterisk. 343*a9fa9459Szrj 344*a9fa9459SzrjThe following additional addressing modes are understood: 345*a9fa9459Szrj 346*a9fa9459Szrj@table @dfn 347*a9fa9459Szrj@item Address Register Indirect 348*a9fa9459Szrj@samp{(%a0)} through @samp{(%a7)}@* 349*a9fa9459Szrj@samp{%a7} is also known as @samp{%sp}, i.e., the Stack Pointer. @code{%a6} 350*a9fa9459Szrjis also known as @samp{%fp}, the Frame Pointer. 351*a9fa9459Szrj 352*a9fa9459Szrj@item Address Register Postincrement 353*a9fa9459Szrj@samp{(%a0)+} through @samp{(%a7)+} 354*a9fa9459Szrj 355*a9fa9459Szrj@item Address Register Predecrement 356*a9fa9459Szrj@samp{-(%a0)} through @samp{-(%a7)} 357*a9fa9459Szrj 358*a9fa9459Szrj@item Indirect Plus Offset 359*a9fa9459Szrj@samp{@var{number}(@var{%a0})} through @samp{@var{number}(@var{%a7})}, 360*a9fa9459Szrjor @samp{@var{number}(@var{%pc})}. 361*a9fa9459Szrj 362*a9fa9459SzrjThe @var{number} may also appear within the parentheses, as in 363*a9fa9459Szrj@samp{(@var{number},@var{%a0})}. When used with the @var{pc}, the 364*a9fa9459Szrj@var{number} may be omitted (with an address register, omitting the 365*a9fa9459Szrj@var{number} produces Address Register Indirect mode). 366*a9fa9459Szrj 367*a9fa9459Szrj@item Index 368*a9fa9459Szrj@samp{@var{number}(@var{apc},@var{register}.@var{size}*@var{scale})} 369*a9fa9459Szrj 370*a9fa9459SzrjThe @var{number} may be omitted, or it may appear within the 371*a9fa9459Szrjparentheses. The @var{apc} may be omitted. The @var{register} and the 372*a9fa9459Szrj@var{apc} may appear in either order. If both @var{apc} and 373*a9fa9459Szrj@var{register} are address registers, and the @var{size} and @var{scale} 374*a9fa9459Szrjare omitted, then the first register is taken as the base register, and 375*a9fa9459Szrjthe second as the index register. 376*a9fa9459Szrj 377*a9fa9459Szrj@item Postindex 378*a9fa9459Szrj@samp{([@var{number},@var{apc}],@var{register}.@var{size}*@var{scale},@var{onumber})} 379*a9fa9459Szrj 380*a9fa9459SzrjThe @var{onumber}, or the @var{register}, or both, may be omitted. 381*a9fa9459SzrjEither the @var{number} or the @var{apc} may be omitted, but not both. 382*a9fa9459Szrj 383*a9fa9459Szrj@item Preindex 384*a9fa9459Szrj@samp{([@var{number},@var{apc},@var{register}.@var{size}*@var{scale}],@var{onumber})} 385*a9fa9459Szrj 386*a9fa9459SzrjThe @var{number}, or the @var{apc}, or the @var{register}, or any two of 387*a9fa9459Szrjthem, may be omitted. The @var{onumber} may be omitted. The 388*a9fa9459Szrj@var{register} and the @var{apc} may appear in either order. If both 389*a9fa9459Szrj@var{apc} and @var{register} are address registers, and the @var{size} 390*a9fa9459Szrjand @var{scale} are omitted, then the first register is taken as the 391*a9fa9459Szrjbase register, and the second as the index register. 392*a9fa9459Szrj@end table 393*a9fa9459Szrj 394*a9fa9459Szrj@node M68K-Float 395*a9fa9459Szrj@section Floating Point 396*a9fa9459Szrj 397*a9fa9459Szrj@cindex floating point, M680x0 398*a9fa9459Szrj@cindex M680x0 floating point 399*a9fa9459SzrjPacked decimal (P) format floating literals are not supported. 400*a9fa9459SzrjFeel free to add the code! 401*a9fa9459Szrj 402*a9fa9459SzrjThe floating point formats generated by directives are these. 403*a9fa9459Szrj 404*a9fa9459Szrj@table @code 405*a9fa9459Szrj@cindex @code{float} directive, M680x0 406*a9fa9459Szrj@item .float 407*a9fa9459Szrj@code{Single} precision floating point constants. 408*a9fa9459Szrj 409*a9fa9459Szrj@cindex @code{double} directive, M680x0 410*a9fa9459Szrj@item .double 411*a9fa9459Szrj@code{Double} precision floating point constants. 412*a9fa9459Szrj 413*a9fa9459Szrj@cindex @code{extend} directive M680x0 414*a9fa9459Szrj@cindex @code{ldouble} directive M680x0 415*a9fa9459Szrj@item .extend 416*a9fa9459Szrj@itemx .ldouble 417*a9fa9459Szrj@code{Extended} precision (@code{long double}) floating point constants. 418*a9fa9459Szrj@end table 419*a9fa9459Szrj 420*a9fa9459Szrj@node M68K-Directives 421*a9fa9459Szrj@section 680x0 Machine Directives 422*a9fa9459Szrj 423*a9fa9459Szrj@cindex M680x0 directives 424*a9fa9459Szrj@cindex directives, M680x0 425*a9fa9459SzrjIn order to be compatible with the Sun assembler the 680x0 assembler 426*a9fa9459Szrjunderstands the following directives. 427*a9fa9459Szrj 428*a9fa9459Szrj@table @code 429*a9fa9459Szrj@cindex @code{data1} directive, M680x0 430*a9fa9459Szrj@item .data1 431*a9fa9459SzrjThis directive is identical to a @code{.data 1} directive. 432*a9fa9459Szrj 433*a9fa9459Szrj@cindex @code{data2} directive, M680x0 434*a9fa9459Szrj@item .data2 435*a9fa9459SzrjThis directive is identical to a @code{.data 2} directive. 436*a9fa9459Szrj 437*a9fa9459Szrj@cindex @code{even} directive, M680x0 438*a9fa9459Szrj@item .even 439*a9fa9459SzrjThis directive is a special case of the @code{.align} directive; it 440*a9fa9459Szrjaligns the output to an even byte boundary. 441*a9fa9459Szrj 442*a9fa9459Szrj@cindex @code{skip} directive, M680x0 443*a9fa9459Szrj@item .skip 444*a9fa9459SzrjThis directive is identical to a @code{.space} directive. 445*a9fa9459Szrj 446*a9fa9459Szrj@cindex @code{arch} directive, M680x0 447*a9fa9459Szrj@item .arch @var{name} 448*a9fa9459SzrjSelect the target architecture and extension features. Valid values 449*a9fa9459Szrjfor @var{name} are the same as for the @option{-march} command line 450*a9fa9459Szrjoption. This directive cannot be specified after 451*a9fa9459Szrjany instructions have been assembled. If it is given multiple times, 452*a9fa9459Szrjor in conjunction with the @option{-march} option, all uses must be for 453*a9fa9459Szrjthe same architecture and extension set. 454*a9fa9459Szrj 455*a9fa9459Szrj@cindex @code{cpu} directive, M680x0 456*a9fa9459Szrj@item .cpu @var{name} 457*a9fa9459SzrjSelect the target cpu. Valid valuse 458*a9fa9459Szrjfor @var{name} are the same as for the @option{-mcpu} command line 459*a9fa9459Szrjoption. This directive cannot be specified after 460*a9fa9459Szrjany instructions have been assembled. If it is given multiple times, 461*a9fa9459Szrjor in conjunction with the @option{-mopt} option, all uses must be for 462*a9fa9459Szrjthe same cpu. 463*a9fa9459Szrj 464*a9fa9459Szrj@end table 465*a9fa9459Szrj 466*a9fa9459Szrj@need 2000 467*a9fa9459Szrj@node M68K-opcodes 468*a9fa9459Szrj@section Opcodes 469*a9fa9459Szrj 470*a9fa9459Szrj@cindex M680x0 opcodes 471*a9fa9459Szrj@cindex opcodes, M680x0 472*a9fa9459Szrj@cindex instruction set, M680x0 473*a9fa9459Szrj@c doc@cygnus.com: I don't see any point in the following 474*a9fa9459Szrj@c paragraph. Bugs are bugs; how does saying this 475*a9fa9459Szrj@c help anyone? 476*a9fa9459Szrj@ignore 477*a9fa9459SzrjDanger: Several bugs have been found in the opcode table (and 478*a9fa9459Szrjfixed). More bugs may exist. Be careful when using obscure 479*a9fa9459Szrjinstructions. 480*a9fa9459Szrj@end ignore 481*a9fa9459Szrj 482*a9fa9459Szrj@menu 483*a9fa9459Szrj* M68K-Branch:: Branch Improvement 484*a9fa9459Szrj* M68K-Chars:: Special Characters 485*a9fa9459Szrj@end menu 486*a9fa9459Szrj 487*a9fa9459Szrj@node M68K-Branch 488*a9fa9459Szrj@subsection Branch Improvement 489*a9fa9459Szrj 490*a9fa9459Szrj@cindex pseudo-opcodes, M680x0 491*a9fa9459Szrj@cindex M680x0 pseudo-opcodes 492*a9fa9459Szrj@cindex branch improvement, M680x0 493*a9fa9459Szrj@cindex M680x0 branch improvement 494*a9fa9459SzrjCertain pseudo opcodes are permitted for branch instructions. 495*a9fa9459SzrjThey expand to the shortest branch instruction that reach the 496*a9fa9459Szrjtarget. Generally these mnemonics are made by substituting @samp{j} for 497*a9fa9459Szrj@samp{b} at the start of a Motorola mnemonic. 498*a9fa9459Szrj 499*a9fa9459SzrjThe following table summarizes the pseudo-operations. A @code{*} flags 500*a9fa9459Szrjcases that are more fully described after the table: 501*a9fa9459Szrj 502*a9fa9459Szrj@smallexample 503*a9fa9459Szrj Displacement 504*a9fa9459Szrj +------------------------------------------------------------ 505*a9fa9459Szrj | 68020 68000/10, not PC-relative OK 506*a9fa9459SzrjPseudo-Op |BYTE WORD LONG ABSOLUTE LONG JUMP ** 507*a9fa9459Szrj +------------------------------------------------------------ 508*a9fa9459Szrj jbsr |bsrs bsrw bsrl jsr 509*a9fa9459Szrj jra |bras braw bral jmp 510*a9fa9459Szrj* jXX |bXXs bXXw bXXl bNXs;jmp 511*a9fa9459Szrj* dbXX | N/A dbXXw dbXX;bras;bral dbXX;bras;jmp 512*a9fa9459Szrj fjXX | N/A fbXXw fbXXl N/A 513*a9fa9459Szrj 514*a9fa9459SzrjXX: condition 515*a9fa9459SzrjNX: negative of condition XX 516*a9fa9459Szrj 517*a9fa9459Szrj@end smallexample 518*a9fa9459Szrj@center @code{*}---see full description below 519*a9fa9459Szrj@center @code{**}---this expansion mode is disallowed by @samp{--pcrel} 520*a9fa9459Szrj 521*a9fa9459Szrj@table @code 522*a9fa9459Szrj@item jbsr 523*a9fa9459Szrj@itemx jra 524*a9fa9459SzrjThese are the simplest jump pseudo-operations; they always map to one 525*a9fa9459Szrjparticular machine instruction, depending on the displacement to the 526*a9fa9459Szrjbranch target. This instruction will be a byte or word branch is that 527*a9fa9459Szrjis sufficient. Otherwise, a long branch will be emitted if available. 528*a9fa9459SzrjIf no long branches are available and the @samp{--pcrel} option is not 529*a9fa9459Szrjgiven, an absolute long jump will be emitted instead. If no long 530*a9fa9459Szrjbranches are available, the @samp{--pcrel} option is given, and a word 531*a9fa9459Szrjbranch cannot reach the target, an error message is generated. 532*a9fa9459Szrj 533*a9fa9459SzrjIn addition to standard branch operands, @code{@value{AS}} allows these 534*a9fa9459Szrjpseudo-operations to have all operands that are allowed for jsr and jmp, 535*a9fa9459Szrjsubstituting these instructions if the operand given is not valid for a 536*a9fa9459Szrjbranch instruction. 537*a9fa9459Szrj 538*a9fa9459Szrj@item j@var{XX} 539*a9fa9459SzrjHere, @samp{j@var{XX}} stands for an entire family of pseudo-operations, 540*a9fa9459Szrjwhere @var{XX} is a conditional branch or condition-code test. The full 541*a9fa9459Szrjlist of pseudo-ops in this family is: 542*a9fa9459Szrj@smallexample 543*a9fa9459Szrj jhi jls jcc jcs jne jeq jvc 544*a9fa9459Szrj jvs jpl jmi jge jlt jgt jle 545*a9fa9459Szrj@end smallexample 546*a9fa9459Szrj 547*a9fa9459SzrjUsually, each of these pseudo-operations expands to a single branch 548*a9fa9459Szrjinstruction. However, if a word branch is not sufficient, no long branches 549*a9fa9459Szrjare available, and the @samp{--pcrel} option is not given, @code{@value{AS}} 550*a9fa9459Szrjissues a longer code fragment in terms of @var{NX}, the opposite condition 551*a9fa9459Szrjto @var{XX}. For example, under these conditions: 552*a9fa9459Szrj@smallexample 553*a9fa9459Szrj j@var{XX} foo 554*a9fa9459Szrj@end smallexample 555*a9fa9459Szrjgives 556*a9fa9459Szrj@smallexample 557*a9fa9459Szrj b@var{NX}s oof 558*a9fa9459Szrj jmp foo 559*a9fa9459Szrj oof: 560*a9fa9459Szrj@end smallexample 561*a9fa9459Szrj 562*a9fa9459Szrj@item db@var{XX} 563*a9fa9459SzrjThe full family of pseudo-operations covered here is 564*a9fa9459Szrj@smallexample 565*a9fa9459Szrj dbhi dbls dbcc dbcs dbne dbeq dbvc 566*a9fa9459Szrj dbvs dbpl dbmi dbge dblt dbgt dble 567*a9fa9459Szrj dbf dbra dbt 568*a9fa9459Szrj@end smallexample 569*a9fa9459Szrj 570*a9fa9459SzrjMotorola @samp{db@var{XX}} instructions allow word displacements only. When 571*a9fa9459Szrja word displacement is sufficient, each of these pseudo-operations expands 572*a9fa9459Szrjto the corresponding Motorola instruction. When a word displacement is not 573*a9fa9459Szrjsufficient and long branches are available, when the source reads 574*a9fa9459Szrj@samp{db@var{XX} foo}, @code{@value{AS}} emits 575*a9fa9459Szrj@smallexample 576*a9fa9459Szrj db@var{XX} oo1 577*a9fa9459Szrj bras oo2 578*a9fa9459Szrj oo1:bral foo 579*a9fa9459Szrj oo2: 580*a9fa9459Szrj@end smallexample 581*a9fa9459Szrj 582*a9fa9459SzrjIf, however, long branches are not available and the @samp{--pcrel} option is 583*a9fa9459Szrjnot given, @code{@value{AS}} emits 584*a9fa9459Szrj@smallexample 585*a9fa9459Szrj db@var{XX} oo1 586*a9fa9459Szrj bras oo2 587*a9fa9459Szrj oo1:jmp foo 588*a9fa9459Szrj oo2: 589*a9fa9459Szrj@end smallexample 590*a9fa9459Szrj 591*a9fa9459Szrj@item fj@var{XX} 592*a9fa9459SzrjThis family includes 593*a9fa9459Szrj@smallexample 594*a9fa9459Szrj fjne fjeq fjge fjlt fjgt fjle fjf 595*a9fa9459Szrj fjt fjgl fjgle fjnge fjngl fjngle fjngt 596*a9fa9459Szrj fjnle fjnlt fjoge fjogl fjogt fjole fjolt 597*a9fa9459Szrj fjor fjseq fjsf fjsne fjst fjueq fjuge 598*a9fa9459Szrj fjugt fjule fjult fjun 599*a9fa9459Szrj@end smallexample 600*a9fa9459Szrj 601*a9fa9459SzrjEach of these pseudo-operations always expands to a single Motorola 602*a9fa9459Szrjcoprocessor branch instruction, word or long. All Motorola coprocessor 603*a9fa9459Szrjbranch instructions allow both word and long displacements. 604*a9fa9459Szrj 605*a9fa9459Szrj@end table 606*a9fa9459Szrj 607*a9fa9459Szrj@node M68K-Chars 608*a9fa9459Szrj@subsection Special Characters 609*a9fa9459Szrj 610*a9fa9459Szrj@cindex special characters, M680x0 611*a9fa9459Szrj 612*a9fa9459Szrj@cindex M680x0 line comment character 613*a9fa9459Szrj@cindex line comment character, M680x0 614*a9fa9459Szrj@cindex comments, M680x0 615*a9fa9459SzrjLine comments are introduced by the @samp{|} character appearing 616*a9fa9459Szrjanywhere on a line, unless the @option{--bitwise-or} command line option 617*a9fa9459Szrjhas been specified. 618*a9fa9459Szrj 619*a9fa9459SzrjAn asterisk (@samp{*}) as the first character on a line marks the 620*a9fa9459Szrjstart of a line comment as well. 621*a9fa9459Szrj 622*a9fa9459Szrj@cindex M680x0 immediate character 623*a9fa9459Szrj@cindex immediate character, M680x0 624*a9fa9459Szrj 625*a9fa9459SzrjA hash character (@samp{#}) as the first character on a line also 626*a9fa9459Szrjmarks the start of a line comment, but in this case it could also be a 627*a9fa9459Szrjlogical line number directive (@pxref{Comments}) or a preprocessor 628*a9fa9459Szrjcontrol command (@pxref{Preprocessing}). If the hash character 629*a9fa9459Szrjappears elsewhere on a line it is used to introduce an immediate 630*a9fa9459Szrjvalue. (This is for compatibility with Sun's assembler). 631*a9fa9459Szrj 632*a9fa9459Szrj@cindex M680x0 line separator 633*a9fa9459Szrj@cindex line separator, M680x0 634*a9fa9459Szrj 635*a9fa9459SzrjMultiple statements on the same line can appear if they are separated 636*a9fa9459Szrjby the @samp{;} character. 637