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 M68HC11-Dependent 7*a9fa9459Szrj@chapter M68HC11 and M68HC12 Dependent Features 8*a9fa9459Szrj@end ifset 9*a9fa9459Szrj@ifclear GENERIC 10*a9fa9459Szrj@node Machine Dependencies 11*a9fa9459Szrj@chapter M68HC11 and M68HC12 Dependent Features 12*a9fa9459Szrj@end ifclear 13*a9fa9459Szrj 14*a9fa9459Szrj@cindex M68HC11 and M68HC12 support 15*a9fa9459Szrj@menu 16*a9fa9459Szrj* M68HC11-Opts:: M68HC11 and M68HC12 Options 17*a9fa9459Szrj* M68HC11-Syntax:: Syntax 18*a9fa9459Szrj* M68HC11-Modifiers:: Symbolic Operand Modifiers 19*a9fa9459Szrj* M68HC11-Directives:: Assembler Directives 20*a9fa9459Szrj* M68HC11-Float:: Floating Point 21*a9fa9459Szrj* M68HC11-opcodes:: Opcodes 22*a9fa9459Szrj@end menu 23*a9fa9459Szrj 24*a9fa9459Szrj@node M68HC11-Opts 25*a9fa9459Szrj@section M68HC11 and M68HC12 Options 26*a9fa9459Szrj 27*a9fa9459Szrj@cindex options, M68HC11 28*a9fa9459Szrj@cindex M68HC11 options 29*a9fa9459SzrjThe Motorola 68HC11 and 68HC12 version of @code{@value{AS}} have a few machine 30*a9fa9459Szrjdependent options. 31*a9fa9459Szrj 32*a9fa9459Szrj@table @code 33*a9fa9459Szrj 34*a9fa9459Szrj@cindex @samp{-m68hc11} 35*a9fa9459Szrj@item -m68hc11 36*a9fa9459SzrjThis option switches the assembler into the M68HC11 mode. In this mode, 37*a9fa9459Szrjthe assembler only accepts 68HC11 operands and mnemonics. It produces 38*a9fa9459Szrjcode for the 68HC11. 39*a9fa9459Szrj 40*a9fa9459Szrj@cindex @samp{-m68hc12} 41*a9fa9459Szrj@item -m68hc12 42*a9fa9459SzrjThis option switches the assembler into the M68HC12 mode. In this mode, 43*a9fa9459Szrjthe assembler also accepts 68HC12 operands and mnemonics. It produces 44*a9fa9459Szrjcode for the 68HC12. A few 68HC11 instructions are replaced by 45*a9fa9459Szrjsome 68HC12 instructions as recommended by Motorola specifications. 46*a9fa9459Szrj 47*a9fa9459Szrj@cindex @samp{-m68hcs12} 48*a9fa9459Szrj@item -m68hcs12 49*a9fa9459SzrjThis option switches the assembler into the M68HCS12 mode. This mode is 50*a9fa9459Szrjsimilar to @samp{-m68hc12} but specifies to assemble for the 68HCS12 51*a9fa9459Szrjseries. The only difference is on the assembling of the @samp{movb} 52*a9fa9459Szrjand @samp{movw} instruction when a PC-relative operand is used. 53*a9fa9459Szrj 54*a9fa9459Szrj@cindex @samp{-mm9s12x} 55*a9fa9459Szrj@item -mm9s12x 56*a9fa9459SzrjThis option switches the assembler into the M9S12X mode. This mode is 57*a9fa9459Szrjsimilar to @samp{-m68hc12} but specifies to assemble for the S12X 58*a9fa9459Szrjseries which is a superset of the HCS12. 59*a9fa9459Szrj 60*a9fa9459Szrj@cindex @samp{-mm9s12xg} 61*a9fa9459Szrj@item -mm9s12xg 62*a9fa9459SzrjThis option switches the assembler into the XGATE mode for the RISC 63*a9fa9459Szrjco-processor featured on some S12X-family chips. 64*a9fa9459Szrj 65*a9fa9459Szrj@cindex @samp{--xgate-ramoffset} 66*a9fa9459Szrj@item --xgate-ramoffset 67*a9fa9459SzrjThis option instructs the linker to offset RAM addresses from S12X address 68*a9fa9459Szrjspace into XGATE address space. 69*a9fa9459Szrj 70*a9fa9459Szrj@cindex @samp{-mshort} 71*a9fa9459Szrj@item -mshort 72*a9fa9459SzrjThis option controls the ABI and indicates to use a 16-bit integer ABI. 73*a9fa9459SzrjIt has no effect on the assembled instructions. 74*a9fa9459SzrjThis is the default. 75*a9fa9459Szrj 76*a9fa9459Szrj@cindex @samp{-mlong} 77*a9fa9459Szrj@item -mlong 78*a9fa9459SzrjThis option controls the ABI and indicates to use a 32-bit integer ABI. 79*a9fa9459Szrj 80*a9fa9459Szrj@cindex @samp{-mshort-double} 81*a9fa9459Szrj@item -mshort-double 82*a9fa9459SzrjThis option controls the ABI and indicates to use a 32-bit float ABI. 83*a9fa9459SzrjThis is the default. 84*a9fa9459Szrj 85*a9fa9459Szrj@cindex @samp{-mlong-double} 86*a9fa9459Szrj@item -mlong-double 87*a9fa9459SzrjThis option controls the ABI and indicates to use a 64-bit float ABI. 88*a9fa9459Szrj 89*a9fa9459Szrj@cindex @samp{--strict-direct-mode} 90*a9fa9459Szrj@item --strict-direct-mode 91*a9fa9459SzrjYou can use the @samp{--strict-direct-mode} option to disable 92*a9fa9459Szrjthe automatic translation of direct page mode addressing into 93*a9fa9459Szrjextended mode when the instruction does not support direct mode. 94*a9fa9459SzrjFor example, the @samp{clr} instruction does not support direct page 95*a9fa9459Szrjmode addressing. When it is used with the direct page mode, 96*a9fa9459Szrj@code{@value{AS}} will ignore it and generate an absolute addressing. 97*a9fa9459SzrjThis option prevents @code{@value{AS}} from doing this, and the wrong 98*a9fa9459Szrjusage of the direct page mode will raise an error. 99*a9fa9459Szrj 100*a9fa9459Szrj@cindex @samp{--short-branches} 101*a9fa9459Szrj@item --short-branches 102*a9fa9459SzrjThe @samp{--short-branches} option turns off the translation of 103*a9fa9459Szrjrelative branches into absolute branches when the branch offset is 104*a9fa9459Szrjout of range. By default @code{@value{AS}} transforms the relative 105*a9fa9459Szrjbranch (@samp{bsr}, @samp{bgt}, @samp{bge}, @samp{beq}, @samp{bne}, 106*a9fa9459Szrj@samp{ble}, @samp{blt}, @samp{bhi}, @samp{bcc}, @samp{bls}, 107*a9fa9459Szrj@samp{bcs}, @samp{bmi}, @samp{bvs}, @samp{bvs}, @samp{bra}) into 108*a9fa9459Szrjan absolute branch when the offset is out of the -128 .. 127 range. 109*a9fa9459SzrjIn that case, the @samp{bsr} instruction is translated into a 110*a9fa9459Szrj@samp{jsr}, the @samp{bra} instruction is translated into a 111*a9fa9459Szrj@samp{jmp} and the conditional branches instructions are inverted and 112*a9fa9459Szrjfollowed by a @samp{jmp}. This option disables these translations 113*a9fa9459Szrjand @code{@value{AS}} will generate an error if a relative branch 114*a9fa9459Szrjis out of range. This option does not affect the optimization 115*a9fa9459Szrjassociated to the @samp{jbra}, @samp{jbsr} and @samp{jbXX} pseudo opcodes. 116*a9fa9459Szrj 117*a9fa9459Szrj@cindex @samp{--force-long-branches} 118*a9fa9459Szrj@item --force-long-branches 119*a9fa9459SzrjThe @samp{--force-long-branches} option forces the translation of 120*a9fa9459Szrjrelative branches into absolute branches. This option does not affect 121*a9fa9459Szrjthe optimization associated to the @samp{jbra}, @samp{jbsr} and 122*a9fa9459Szrj@samp{jbXX} pseudo opcodes. 123*a9fa9459Szrj 124*a9fa9459Szrj@cindex @samp{--print-insn-syntax} 125*a9fa9459Szrj@item --print-insn-syntax 126*a9fa9459SzrjYou can use the @samp{--print-insn-syntax} option to obtain the 127*a9fa9459Szrjsyntax description of the instruction when an error is detected. 128*a9fa9459Szrj 129*a9fa9459Szrj@cindex @samp{--print-opcodes} 130*a9fa9459Szrj@item --print-opcodes 131*a9fa9459SzrjThe @samp{--print-opcodes} option prints the list of all the 132*a9fa9459Szrjinstructions with their syntax. The first item of each line 133*a9fa9459Szrjrepresents the instruction name and the rest of the line indicates 134*a9fa9459Szrjthe possible operands for that instruction. The list is printed 135*a9fa9459Szrjin alphabetical order. Once the list is printed @code{@value{AS}} 136*a9fa9459Szrjexits. 137*a9fa9459Szrj 138*a9fa9459Szrj@cindex @samp{--generate-example} 139*a9fa9459Szrj@item --generate-example 140*a9fa9459SzrjThe @samp{--generate-example} option is similar to @samp{--print-opcodes} 141*a9fa9459Szrjbut it generates an example for each instruction instead. 142*a9fa9459Szrj@end table 143*a9fa9459Szrj 144*a9fa9459Szrj@node M68HC11-Syntax 145*a9fa9459Szrj@section Syntax 146*a9fa9459Szrj 147*a9fa9459Szrj@cindex M68HC11 syntax 148*a9fa9459Szrj@cindex syntax, M68HC11 149*a9fa9459Szrj 150*a9fa9459SzrjIn the M68HC11 syntax, the instruction name comes first and it may 151*a9fa9459Szrjbe followed by one or several operands (up to three). Operands are 152*a9fa9459Szrjseparated by comma (@samp{,}). In the normal mode, 153*a9fa9459Szrj@code{@value{AS}} will complain if too many operands are specified for 154*a9fa9459Szrja given instruction. In the MRI mode (turned on with @samp{-M} option), 155*a9fa9459Szrjit will treat them as comments. Example: 156*a9fa9459Szrj 157*a9fa9459Szrj@smallexample 158*a9fa9459Szrjinx 159*a9fa9459Szrjlda #23 160*a9fa9459Szrjbset 2,x #4 161*a9fa9459Szrjbrclr *bot #8 foo 162*a9fa9459Szrj@end smallexample 163*a9fa9459Szrj 164*a9fa9459Szrj@cindex line comment character, M68HC11 165*a9fa9459Szrj@cindex M68HC11 line comment character 166*a9fa9459SzrjThe presence of a @samp{;} character or a @samp{!} character anywhere 167*a9fa9459Szrjon a line indicates the start of a comment that extends to the end of 168*a9fa9459Szrjthat line. 169*a9fa9459Szrj 170*a9fa9459SzrjA @samp{*} or a @samp{#} character at the start of a line also 171*a9fa9459Szrjintroduces a line comment, but these characters do not work elsewhere 172*a9fa9459Szrjon the line. If the first character of the line is a @samp{#} then as 173*a9fa9459Szrjwell as starting a comment, the line could also be logical line number 174*a9fa9459Szrjdirective (@pxref{Comments}) or a preprocessor control command 175*a9fa9459Szrj(@pxref{Preprocessing}). 176*a9fa9459Szrj 177*a9fa9459Szrj@cindex line separator, M68HC11 178*a9fa9459Szrj@cindex statement separator, M68HC11 179*a9fa9459Szrj@cindex M68HC11 line separator 180*a9fa9459SzrjThe M68HC11 assembler does not currently support a line separator 181*a9fa9459Szrjcharacter. 182*a9fa9459Szrj 183*a9fa9459Szrj@cindex M68HC11 addressing modes 184*a9fa9459Szrj@cindex addressing modes, M68HC11 185*a9fa9459SzrjThe following addressing modes are understood for 68HC11 and 68HC12: 186*a9fa9459Szrj@table @dfn 187*a9fa9459Szrj@item Immediate 188*a9fa9459Szrj@samp{#@var{number}} 189*a9fa9459Szrj 190*a9fa9459Szrj@item Address Register 191*a9fa9459Szrj@samp{@var{number},X}, @samp{@var{number},Y} 192*a9fa9459Szrj 193*a9fa9459SzrjThe @var{number} may be omitted in which case 0 is assumed. 194*a9fa9459Szrj 195*a9fa9459Szrj@item Direct Addressing mode 196*a9fa9459Szrj@samp{*@var{symbol}}, or @samp{*@var{digits}} 197*a9fa9459Szrj 198*a9fa9459Szrj@item Absolute 199*a9fa9459Szrj@samp{@var{symbol}}, or @samp{@var{digits}} 200*a9fa9459Szrj@end table 201*a9fa9459Szrj 202*a9fa9459SzrjThe M68HC12 has other more complex addressing modes. All of them 203*a9fa9459Szrjare supported and they are represented below: 204*a9fa9459Szrj 205*a9fa9459Szrj@table @dfn 206*a9fa9459Szrj@item Constant Offset Indexed Addressing Mode 207*a9fa9459Szrj@samp{@var{number},@var{reg}} 208*a9fa9459Szrj 209*a9fa9459SzrjThe @var{number} may be omitted in which case 0 is assumed. 210*a9fa9459SzrjThe register can be either @samp{X}, @samp{Y}, @samp{SP} or 211*a9fa9459Szrj@samp{PC}. The assembler will use the smaller post-byte definition 212*a9fa9459Szrjaccording to the constant value (5-bit constant offset, 9-bit constant 213*a9fa9459Szrjoffset or 16-bit constant offset). If the constant is not known by 214*a9fa9459Szrjthe assembler it will use the 16-bit constant offset post-byte and the value 215*a9fa9459Szrjwill be resolved at link time. 216*a9fa9459Szrj 217*a9fa9459Szrj@item Offset Indexed Indirect 218*a9fa9459Szrj@samp{[@var{number},@var{reg}]} 219*a9fa9459Szrj 220*a9fa9459SzrjThe register can be either @samp{X}, @samp{Y}, @samp{SP} or @samp{PC}. 221*a9fa9459Szrj 222*a9fa9459Szrj@item Auto Pre-Increment/Pre-Decrement/Post-Increment/Post-Decrement 223*a9fa9459Szrj@samp{@var{number},-@var{reg}} 224*a9fa9459Szrj@samp{@var{number},+@var{reg}} 225*a9fa9459Szrj@samp{@var{number},@var{reg}-} 226*a9fa9459Szrj@samp{@var{number},@var{reg}+} 227*a9fa9459Szrj 228*a9fa9459SzrjThe number must be in the range @samp{-8}..@samp{+8} and must not be 0. 229*a9fa9459SzrjThe register can be either @samp{X}, @samp{Y}, @samp{SP} or @samp{PC}. 230*a9fa9459Szrj 231*a9fa9459Szrj@item Accumulator Offset 232*a9fa9459Szrj@samp{@var{acc},@var{reg}} 233*a9fa9459Szrj 234*a9fa9459SzrjThe accumulator register can be either @samp{A}, @samp{B} or @samp{D}. 235*a9fa9459SzrjThe register can be either @samp{X}, @samp{Y}, @samp{SP} or @samp{PC}. 236*a9fa9459Szrj 237*a9fa9459Szrj@item Accumulator D offset indexed-indirect 238*a9fa9459Szrj@samp{[D,@var{reg}]} 239*a9fa9459Szrj 240*a9fa9459SzrjThe register can be either @samp{X}, @samp{Y}, @samp{SP} or @samp{PC}. 241*a9fa9459Szrj 242*a9fa9459Szrj@end table 243*a9fa9459Szrj 244*a9fa9459SzrjFor example: 245*a9fa9459Szrj 246*a9fa9459Szrj@smallexample 247*a9fa9459Szrjldab 1024,sp 248*a9fa9459Szrjldd [10,x] 249*a9fa9459Szrjorab 3,+x 250*a9fa9459Szrjstab -2,y- 251*a9fa9459Szrjldx a,pc 252*a9fa9459Szrjsty [d,sp] 253*a9fa9459Szrj@end smallexample 254*a9fa9459Szrj 255*a9fa9459Szrj 256*a9fa9459Szrj@node M68HC11-Modifiers 257*a9fa9459Szrj@section Symbolic Operand Modifiers 258*a9fa9459Szrj 259*a9fa9459Szrj@cindex M68HC11 modifiers 260*a9fa9459Szrj@cindex syntax, M68HC11 261*a9fa9459Szrj 262*a9fa9459SzrjThe assembler supports several modifiers when using symbol addresses 263*a9fa9459Szrjin 68HC11 and 68HC12 instruction operands. The general syntax is 264*a9fa9459Szrjthe following: 265*a9fa9459Szrj 266*a9fa9459Szrj@smallexample 267*a9fa9459Szrj%modifier(symbol) 268*a9fa9459Szrj@end smallexample 269*a9fa9459Szrj 270*a9fa9459Szrj@table @code 271*a9fa9459Szrj@cindex symbol modifiers 272*a9fa9459Szrj@item %addr 273*a9fa9459SzrjThis modifier indicates to the assembler and linker to use 274*a9fa9459Szrjthe 16-bit physical address corresponding to the symbol. This is intended 275*a9fa9459Szrjto be used on memory window systems to map a symbol in the memory bank window. 276*a9fa9459SzrjIf the symbol is in a memory expansion part, the physical address 277*a9fa9459Szrjcorresponds to the symbol address within the memory bank window. 278*a9fa9459SzrjIf the symbol is not in a memory expansion part, this is the symbol address 279*a9fa9459Szrj(using or not using the %addr modifier has no effect in that case). 280*a9fa9459Szrj 281*a9fa9459Szrj@item %page 282*a9fa9459SzrjThis modifier indicates to use the memory page number corresponding 283*a9fa9459Szrjto the symbol. If the symbol is in a memory expansion part, its page 284*a9fa9459Szrjnumber is computed by the linker as a number used to map the page containing 285*a9fa9459Szrjthe symbol in the memory bank window. If the symbol is not in a memory 286*a9fa9459Szrjexpansion part, the page number is 0. 287*a9fa9459Szrj 288*a9fa9459Szrj@item %hi 289*a9fa9459SzrjThis modifier indicates to use the 8-bit high part of the physical 290*a9fa9459Szrjaddress of the symbol. 291*a9fa9459Szrj 292*a9fa9459Szrj@item %lo 293*a9fa9459SzrjThis modifier indicates to use the 8-bit low part of the physical 294*a9fa9459Szrjaddress of the symbol. 295*a9fa9459Szrj 296*a9fa9459Szrj@end table 297*a9fa9459Szrj 298*a9fa9459SzrjFor example a 68HC12 call to a function @samp{foo_example} stored in memory 299*a9fa9459Szrjexpansion part could be written as follows: 300*a9fa9459Szrj 301*a9fa9459Szrj@smallexample 302*a9fa9459Szrjcall %addr(foo_example),%page(foo_example) 303*a9fa9459Szrj@end smallexample 304*a9fa9459Szrj 305*a9fa9459Szrjand this is equivalent to 306*a9fa9459Szrj 307*a9fa9459Szrj@smallexample 308*a9fa9459Szrjcall foo_example 309*a9fa9459Szrj@end smallexample 310*a9fa9459Szrj 311*a9fa9459SzrjAnd for 68HC11 it could be written as follows: 312*a9fa9459Szrj 313*a9fa9459Szrj@smallexample 314*a9fa9459Szrjldab #%page(foo_example) 315*a9fa9459Szrjstab _page_switch 316*a9fa9459Szrjjsr %addr(foo_example) 317*a9fa9459Szrj@end smallexample 318*a9fa9459Szrj 319*a9fa9459Szrj@node M68HC11-Directives 320*a9fa9459Szrj@section Assembler Directives 321*a9fa9459Szrj 322*a9fa9459Szrj@cindex assembler directives, M68HC11 323*a9fa9459Szrj@cindex assembler directives, M68HC12 324*a9fa9459Szrj@cindex M68HC11 assembler directives 325*a9fa9459Szrj@cindex M68HC12 assembler directives 326*a9fa9459Szrj 327*a9fa9459SzrjThe 68HC11 and 68HC12 version of @code{@value{AS}} have the following 328*a9fa9459Szrjspecific assembler directives: 329*a9fa9459Szrj 330*a9fa9459Szrj@table @code 331*a9fa9459Szrj@item .relax 332*a9fa9459Szrj@cindex assembler directive .relax, M68HC11 333*a9fa9459Szrj@cindex M68HC11 assembler directive .relax 334*a9fa9459SzrjThe relax directive is used by the @samp{GNU Compiler} to emit a specific 335*a9fa9459Szrjrelocation to mark a group of instructions for linker relaxation. 336*a9fa9459SzrjThe sequence of instructions within the group must be known to the linker 337*a9fa9459Szrjso that relaxation can be performed. 338*a9fa9459Szrj 339*a9fa9459Szrj@item .mode [mshort|mlong|mshort-double|mlong-double] 340*a9fa9459Szrj@cindex assembler directive .mode, M68HC11 341*a9fa9459Szrj@cindex M68HC11 assembler directive .mode 342*a9fa9459SzrjThis directive specifies the ABI. It overrides the @samp{-mshort}, 343*a9fa9459Szrj@samp{-mlong}, @samp{-mshort-double} and @samp{-mlong-double} options. 344*a9fa9459Szrj 345*a9fa9459Szrj@item .far @var{symbol} 346*a9fa9459Szrj@cindex assembler directive .far, M68HC11 347*a9fa9459Szrj@cindex M68HC11 assembler directive .far 348*a9fa9459SzrjThis directive marks the symbol as a @samp{far} symbol meaning that it 349*a9fa9459Szrjuses a @samp{call/rtc} calling convention as opposed to @samp{jsr/rts}. 350*a9fa9459SzrjDuring a final link, the linker will identify references to the @samp{far} 351*a9fa9459Szrjsymbol and will verify the proper calling convention. 352*a9fa9459Szrj 353*a9fa9459Szrj@item .interrupt @var{symbol} 354*a9fa9459Szrj@cindex assembler directive .interrupt, M68HC11 355*a9fa9459Szrj@cindex M68HC11 assembler directive .interrupt 356*a9fa9459SzrjThis directive marks the symbol as an interrupt entry point. 357*a9fa9459SzrjThis information is then used by the debugger to correctly unwind the 358*a9fa9459Szrjframe across interrupts. 359*a9fa9459Szrj 360*a9fa9459Szrj@item .xrefb @var{symbol} 361*a9fa9459Szrj@cindex assembler directive .xrefb, M68HC11 362*a9fa9459Szrj@cindex M68HC11 assembler directive .xrefb 363*a9fa9459SzrjThis directive is defined for compatibility with the 364*a9fa9459Szrj@samp{Specification for Motorola 8 and 16-Bit Assembly Language Input 365*a9fa9459SzrjStandard} and is ignored. 366*a9fa9459Szrj 367*a9fa9459Szrj@end table 368*a9fa9459Szrj 369*a9fa9459Szrj@node M68HC11-Float 370*a9fa9459Szrj@section Floating Point 371*a9fa9459Szrj 372*a9fa9459Szrj@cindex floating point, M68HC11 373*a9fa9459Szrj@cindex M68HC11 floating point 374*a9fa9459SzrjPacked decimal (P) format floating literals are not supported. 375*a9fa9459SzrjFeel free to add the code! 376*a9fa9459Szrj 377*a9fa9459SzrjThe floating point formats generated by directives are these. 378*a9fa9459Szrj 379*a9fa9459Szrj@table @code 380*a9fa9459Szrj@cindex @code{float} directive, M68HC11 381*a9fa9459Szrj@item .float 382*a9fa9459Szrj@code{Single} precision floating point constants. 383*a9fa9459Szrj 384*a9fa9459Szrj@cindex @code{double} directive, M68HC11 385*a9fa9459Szrj@item .double 386*a9fa9459Szrj@code{Double} precision floating point constants. 387*a9fa9459Szrj 388*a9fa9459Szrj@cindex @code{extend} directive M68HC11 389*a9fa9459Szrj@cindex @code{ldouble} directive M68HC11 390*a9fa9459Szrj@item .extend 391*a9fa9459Szrj@itemx .ldouble 392*a9fa9459Szrj@code{Extended} precision (@code{long double}) floating point constants. 393*a9fa9459Szrj@end table 394*a9fa9459Szrj 395*a9fa9459Szrj@need 2000 396*a9fa9459Szrj@node M68HC11-opcodes 397*a9fa9459Szrj@section Opcodes 398*a9fa9459Szrj 399*a9fa9459Szrj@cindex M68HC11 opcodes 400*a9fa9459Szrj@cindex opcodes, M68HC11 401*a9fa9459Szrj@cindex instruction set, M68HC11 402*a9fa9459Szrj 403*a9fa9459Szrj@menu 404*a9fa9459Szrj* M68HC11-Branch:: Branch Improvement 405*a9fa9459Szrj@end menu 406*a9fa9459Szrj 407*a9fa9459Szrj@node M68HC11-Branch 408*a9fa9459Szrj@subsection Branch Improvement 409*a9fa9459Szrj 410*a9fa9459Szrj@cindex pseudo-opcodes, M68HC11 411*a9fa9459Szrj@cindex M68HC11 pseudo-opcodes 412*a9fa9459Szrj@cindex branch improvement, M68HC11 413*a9fa9459Szrj@cindex M68HC11 branch improvement 414*a9fa9459Szrj 415*a9fa9459SzrjCertain pseudo opcodes are permitted for branch instructions. 416*a9fa9459SzrjThey expand to the shortest branch instruction that reach the 417*a9fa9459Szrjtarget. Generally these mnemonics are made by prepending @samp{j} to 418*a9fa9459Szrjthe start of Motorola mnemonic. These pseudo opcodes are not affected 419*a9fa9459Szrjby the @samp{--short-branches} or @samp{--force-long-branches} options. 420*a9fa9459Szrj 421*a9fa9459SzrjThe following table summarizes the pseudo-operations. 422*a9fa9459Szrj 423*a9fa9459Szrj@smallexample 424*a9fa9459Szrj Displacement Width 425*a9fa9459Szrj +-------------------------------------------------------------+ 426*a9fa9459Szrj | Options | 427*a9fa9459Szrj | --short-branches --force-long-branches | 428*a9fa9459Szrj +--------------------------+----------------------------------+ 429*a9fa9459Szrj Op |BYTE WORD | BYTE WORD | 430*a9fa9459Szrj +--------------------------+----------------------------------+ 431*a9fa9459Szrj bsr | bsr <pc-rel> <error> | jsr <abs> | 432*a9fa9459Szrj bra | bra <pc-rel> <error> | jmp <abs> | 433*a9fa9459Szrjjbsr | bsr <pc-rel> jsr <abs> | bsr <pc-rel> jsr <abs> | 434*a9fa9459Szrjjbra | bra <pc-rel> jmp <abs> | bra <pc-rel> jmp <abs> | 435*a9fa9459Szrj bXX | bXX <pc-rel> <error> | bNX +3; jmp <abs> | 436*a9fa9459SzrjjbXX | bXX <pc-rel> bNX +3; | bXX <pc-rel> bNX +3; jmp <abs> | 437*a9fa9459Szrj | jmp <abs> | | 438*a9fa9459Szrj +--------------------------+----------------------------------+ 439*a9fa9459SzrjXX: condition 440*a9fa9459SzrjNX: negative of condition XX 441*a9fa9459Szrj 442*a9fa9459Szrj@end smallexample 443*a9fa9459Szrj 444*a9fa9459Szrj@table @code 445*a9fa9459Szrj@item jbsr 446*a9fa9459Szrj@itemx jbra 447*a9fa9459SzrjThese are the simplest jump pseudo-operations; they always map to one 448*a9fa9459Szrjparticular machine instruction, depending on the displacement to the 449*a9fa9459Szrjbranch target. 450*a9fa9459Szrj 451*a9fa9459Szrj@item jb@var{XX} 452*a9fa9459SzrjHere, @samp{jb@var{XX}} stands for an entire family of pseudo-operations, 453*a9fa9459Szrjwhere @var{XX} is a conditional branch or condition-code test. The full 454*a9fa9459Szrjlist of pseudo-ops in this family is: 455*a9fa9459Szrj@smallexample 456*a9fa9459Szrj jbcc jbeq jbge jbgt jbhi jbvs jbpl jblo 457*a9fa9459Szrj jbcs jbne jblt jble jbls jbvc jbmi 458*a9fa9459Szrj@end smallexample 459*a9fa9459Szrj 460*a9fa9459SzrjFor the cases of non-PC relative displacements and long displacements, 461*a9fa9459Szrj@code{@value{AS}} issues a longer code fragment in terms of 462*a9fa9459Szrj@var{NX}, the opposite condition to @var{XX}. For example, for the 463*a9fa9459Szrjnon-PC relative case: 464*a9fa9459Szrj@smallexample 465*a9fa9459Szrj jb@var{XX} foo 466*a9fa9459Szrj@end smallexample 467*a9fa9459Szrjgives 468*a9fa9459Szrj@smallexample 469*a9fa9459Szrj b@var{NX}s oof 470*a9fa9459Szrj jmp foo 471*a9fa9459Szrj oof: 472*a9fa9459Szrj@end smallexample 473*a9fa9459Szrj 474*a9fa9459Szrj@end table 475*a9fa9459Szrj 476*a9fa9459Szrj 477