M68HC11_002dBranch.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- This file documents the GNU Assembler "as".
  4. Copyright (C) 1991-2017 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3
  7. or any later version published by the Free Software Foundation;
  8. with no Invariant Sections, with no Front-Cover Texts, and with no
  9. Back-Cover Texts. A copy of the license is included in the
  10. section entitled "GNU Free Documentation License".
  11. -->
  12. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <title>Using as: M68HC11-Branch</title>
  15. <meta name="description" content="Using as: M68HC11-Branch">
  16. <meta name="keywords" content="Using as: M68HC11-Branch">
  17. <meta name="resource-type" content="document">
  18. <meta name="distribution" content="global">
  19. <meta name="Generator" content="makeinfo">
  20. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  21. <link href="index.html#Top" rel="start" title="Top">
  22. <link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
  23. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  24. <link href="M68HC11_002dopcodes.html#M68HC11_002dopcodes" rel="up" title="M68HC11-opcodes">
  25. <link href="Meta_002dDependent.html#Meta_002dDependent" rel="next" title="Meta-Dependent">
  26. <link href="M68HC11_002dopcodes.html#M68HC11_002dopcodes" rel="prev" title="M68HC11-opcodes">
  27. <style type="text/css">
  28. <!--
  29. a.summary-letter {text-decoration: none}
  30. blockquote.smallquotation {font-size: smaller}
  31. div.display {margin-left: 3.2em}
  32. div.example {margin-left: 3.2em}
  33. div.indentedblock {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  38. div.smalllisp {margin-left: 3.2em}
  39. kbd {font-style:oblique}
  40. pre.display {font-family: inherit}
  41. pre.format {font-family: inherit}
  42. pre.menu-comment {font-family: serif}
  43. pre.menu-preformatted {font-family: serif}
  44. pre.smalldisplay {font-family: inherit; font-size: smaller}
  45. pre.smallexample {font-size: smaller}
  46. pre.smallformat {font-family: inherit; font-size: smaller}
  47. pre.smalllisp {font-size: smaller}
  48. span.nocodebreak {white-space:nowrap}
  49. span.nolinebreak {white-space:nowrap}
  50. span.roman {font-family:serif; font-weight:normal}
  51. span.sansserif {font-family:sans-serif; font-weight:normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  57. <a name="M68HC11_002dBranch"></a>
  58. <div class="header">
  59. <p>
  60. Up: <a href="M68HC11_002dopcodes.html#M68HC11_002dopcodes" accesskey="u" rel="up">M68HC11-opcodes</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="Branch-Improvement-1"></a>
  64. <h4 class="subsubsection">9.24.6.1 Branch Improvement</h4>
  65. <a name="index-pseudo_002dopcodes_002c-M68HC11"></a>
  66. <a name="index-M68HC11-pseudo_002dopcodes"></a>
  67. <a name="index-branch-improvement_002c-M68HC11"></a>
  68. <a name="index-M68HC11-branch-improvement"></a>
  69. <p>Certain pseudo opcodes are permitted for branch instructions.
  70. They expand to the shortest branch instruction that reach the
  71. target. Generally these mnemonics are made by prepending &lsquo;<samp>j</samp>&rsquo; to
  72. the start of Motorola mnemonic. These pseudo opcodes are not affected
  73. by the &lsquo;<samp>--short-branches</samp>&rsquo; or &lsquo;<samp>--force-long-branches</samp>&rsquo; options.
  74. </p>
  75. <p>The following table summarizes the pseudo-operations.
  76. </p>
  77. <div class="smallexample">
  78. <pre class="smallexample"> Displacement Width
  79. +-------------------------------------------------------------+
  80. | Options |
  81. | --short-branches --force-long-branches |
  82. +--------------------------+----------------------------------+
  83. Op |BYTE WORD | BYTE WORD |
  84. +--------------------------+----------------------------------+
  85. bsr | bsr &lt;pc-rel&gt; &lt;error&gt; | jsr &lt;abs&gt; |
  86. bra | bra &lt;pc-rel&gt; &lt;error&gt; | jmp &lt;abs&gt; |
  87. jbsr | bsr &lt;pc-rel&gt; jsr &lt;abs&gt; | bsr &lt;pc-rel&gt; jsr &lt;abs&gt; |
  88. jbra | bra &lt;pc-rel&gt; jmp &lt;abs&gt; | bra &lt;pc-rel&gt; jmp &lt;abs&gt; |
  89. bXX | bXX &lt;pc-rel&gt; &lt;error&gt; | bNX +3; jmp &lt;abs&gt; |
  90. jbXX | bXX &lt;pc-rel&gt; bNX +3; | bXX &lt;pc-rel&gt; bNX +3; jmp &lt;abs&gt; |
  91. | jmp &lt;abs&gt; | |
  92. +--------------------------+----------------------------------+
  93. XX: condition
  94. NX: negative of condition XX
  95. </pre></div>
  96. <dl compact="compact">
  97. <dt><code>jbsr</code></dt>
  98. <dt><code>jbra</code></dt>
  99. <dd><p>These are the simplest jump pseudo-operations; they always map to one
  100. particular machine instruction, depending on the displacement to the
  101. branch target.
  102. </p>
  103. </dd>
  104. <dt><code>jb<var>XX</var></code></dt>
  105. <dd><p>Here, &lsquo;<samp>jb<var>XX</var></samp>&rsquo; stands for an entire family of pseudo-operations,
  106. where <var>XX</var> is a conditional branch or condition-code test. The full
  107. list of pseudo-ops in this family is:
  108. </p><div class="smallexample">
  109. <pre class="smallexample"> jbcc jbeq jbge jbgt jbhi jbvs jbpl jblo
  110. jbcs jbne jblt jble jbls jbvc jbmi
  111. </pre></div>
  112. <p>For the cases of non-PC relative displacements and long displacements,
  113. <code>as</code> issues a longer code fragment in terms of
  114. <var>NX</var>, the opposite condition to <var>XX</var>. For example, for the
  115. non-PC relative case:
  116. </p><div class="smallexample">
  117. <pre class="smallexample"> jb<var>XX</var> foo
  118. </pre></div>
  119. <p>gives
  120. </p><div class="smallexample">
  121. <pre class="smallexample"> b<var>NX</var>s oof
  122. jmp foo
  123. oof:
  124. </pre></div>
  125. </dd>
  126. </dl>
  127. </body>
  128. </html>