M68HC11_002dSyntax.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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-Syntax</title>
  15. <meta name="description" content="Using as: M68HC11-Syntax">
  16. <meta name="keywords" content="Using as: M68HC11-Syntax">
  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_002dDependent.html#M68HC11_002dDependent" rel="up" title="M68HC11-Dependent">
  25. <link href="M68HC11_002dModifiers.html#M68HC11_002dModifiers" rel="next" title="M68HC11-Modifiers">
  26. <link href="M68HC11_002dOpts.html#M68HC11_002dOpts" rel="prev" title="M68HC11-Opts">
  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_002dSyntax"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="M68HC11_002dModifiers.html#M68HC11_002dModifiers" accesskey="n" rel="next">M68HC11-Modifiers</a>, Previous: <a href="M68HC11_002dOpts.html#M68HC11_002dOpts" accesskey="p" rel="prev">M68HC11-Opts</a>, Up: <a href="M68HC11_002dDependent.html#M68HC11_002dDependent" accesskey="u" rel="up">M68HC11-Dependent</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="Syntax-17"></a>
  64. <h4 class="subsection">9.24.2 Syntax</h4>
  65. <a name="index-M68HC11-syntax"></a>
  66. <a name="index-syntax_002c-M68HC11"></a>
  67. <p>In the M68HC11 syntax, the instruction name comes first and it may
  68. be followed by one or several operands (up to three). Operands are
  69. separated by comma (&lsquo;<samp>,</samp>&rsquo;). In the normal mode,
  70. <code>as</code> will complain if too many operands are specified for
  71. a given instruction. In the MRI mode (turned on with &lsquo;<samp>-M</samp>&rsquo; option),
  72. it will treat them as comments. Example:
  73. </p>
  74. <div class="smallexample">
  75. <pre class="smallexample">inx
  76. lda #23
  77. bset 2,x #4
  78. brclr *bot #8 foo
  79. </pre></div>
  80. <a name="index-line-comment-character_002c-M68HC11"></a>
  81. <a name="index-M68HC11-line-comment-character"></a>
  82. <p>The presence of a &lsquo;<samp>;</samp>&rsquo; character or a &lsquo;<samp>!</samp>&rsquo; character anywhere
  83. on a line indicates the start of a comment that extends to the end of
  84. that line.
  85. </p>
  86. <p>A &lsquo;<samp>*</samp>&rsquo; or a &lsquo;<samp>#</samp>&rsquo; character at the start of a line also
  87. introduces a line comment, but these characters do not work elsewhere
  88. on the line. If the first character of the line is a &lsquo;<samp>#</samp>&rsquo; then as
  89. well as starting a comment, the line could also be logical line number
  90. directive (see <a href="Comments.html#Comments">Comments</a>) or a preprocessor control command
  91. (see <a href="Preprocessing.html#Preprocessing">Preprocessing</a>).
  92. </p>
  93. <a name="index-line-separator_002c-M68HC11"></a>
  94. <a name="index-statement-separator_002c-M68HC11"></a>
  95. <a name="index-M68HC11-line-separator"></a>
  96. <p>The M68HC11 assembler does not currently support a line separator
  97. character.
  98. </p>
  99. <a name="index-M68HC11-addressing-modes"></a>
  100. <a name="index-addressing-modes_002c-M68HC11"></a>
  101. <p>The following addressing modes are understood for 68HC11 and 68HC12:
  102. </p><dl compact="compact">
  103. <dt><em>Immediate</em></dt>
  104. <dd><p>&lsquo;<samp>#<var>number</var></samp>&rsquo;
  105. </p>
  106. </dd>
  107. <dt><em>Address Register</em></dt>
  108. <dd><p>&lsquo;<samp><var>number</var>,X</samp>&rsquo;, &lsquo;<samp><var>number</var>,Y</samp>&rsquo;
  109. </p>
  110. <p>The <var>number</var> may be omitted in which case 0 is assumed.
  111. </p>
  112. </dd>
  113. <dt><em>Direct Addressing mode</em></dt>
  114. <dd><p>&lsquo;<samp>*<var>symbol</var></samp>&rsquo;, or &lsquo;<samp>*<var>digits</var></samp>&rsquo;
  115. </p>
  116. </dd>
  117. <dt><em>Absolute</em></dt>
  118. <dd><p>&lsquo;<samp><var>symbol</var></samp>&rsquo;, or &lsquo;<samp><var>digits</var></samp>&rsquo;
  119. </p></dd>
  120. </dl>
  121. <p>The M68HC12 has other more complex addressing modes. All of them
  122. are supported and they are represented below:
  123. </p>
  124. <dl compact="compact">
  125. <dt><em>Constant Offset Indexed Addressing Mode</em></dt>
  126. <dd><p>&lsquo;<samp><var>number</var>,<var>reg</var></samp>&rsquo;
  127. </p>
  128. <p>The <var>number</var> may be omitted in which case 0 is assumed.
  129. The register can be either &lsquo;<samp>X</samp>&rsquo;, &lsquo;<samp>Y</samp>&rsquo;, &lsquo;<samp>SP</samp>&rsquo; or
  130. &lsquo;<samp>PC</samp>&rsquo;. The assembler will use the smaller post-byte definition
  131. according to the constant value (5-bit constant offset, 9-bit constant
  132. offset or 16-bit constant offset). If the constant is not known by
  133. the assembler it will use the 16-bit constant offset post-byte and the value
  134. will be resolved at link time.
  135. </p>
  136. </dd>
  137. <dt><em>Offset Indexed Indirect</em></dt>
  138. <dd><p>&lsquo;<samp>[<var>number</var>,<var>reg</var>]</samp>&rsquo;
  139. </p>
  140. <p>The register can be either &lsquo;<samp>X</samp>&rsquo;, &lsquo;<samp>Y</samp>&rsquo;, &lsquo;<samp>SP</samp>&rsquo; or &lsquo;<samp>PC</samp>&rsquo;.
  141. </p>
  142. </dd>
  143. <dt><em>Auto Pre-Increment/Pre-Decrement/Post-Increment/Post-Decrement</em></dt>
  144. <dd><p>&lsquo;<samp><var>number</var>,-<var>reg</var></samp>&rsquo;
  145. &lsquo;<samp><var>number</var>,+<var>reg</var></samp>&rsquo;
  146. &lsquo;<samp><var>number</var>,<var>reg</var>-</samp>&rsquo;
  147. &lsquo;<samp><var>number</var>,<var>reg</var>+</samp>&rsquo;
  148. </p>
  149. <p>The number must be in the range &lsquo;<samp>-8</samp>&rsquo;..&lsquo;<samp>+8</samp>&rsquo; and must not be 0.
  150. The register can be either &lsquo;<samp>X</samp>&rsquo;, &lsquo;<samp>Y</samp>&rsquo;, &lsquo;<samp>SP</samp>&rsquo; or &lsquo;<samp>PC</samp>&rsquo;.
  151. </p>
  152. </dd>
  153. <dt><em>Accumulator Offset</em></dt>
  154. <dd><p>&lsquo;<samp><var>acc</var>,<var>reg</var></samp>&rsquo;
  155. </p>
  156. <p>The accumulator register can be either &lsquo;<samp>A</samp>&rsquo;, &lsquo;<samp>B</samp>&rsquo; or &lsquo;<samp>D</samp>&rsquo;.
  157. The register can be either &lsquo;<samp>X</samp>&rsquo;, &lsquo;<samp>Y</samp>&rsquo;, &lsquo;<samp>SP</samp>&rsquo; or &lsquo;<samp>PC</samp>&rsquo;.
  158. </p>
  159. </dd>
  160. <dt><em>Accumulator D offset indexed-indirect</em></dt>
  161. <dd><p>&lsquo;<samp>[D,<var>reg</var>]</samp>&rsquo;
  162. </p>
  163. <p>The register can be either &lsquo;<samp>X</samp>&rsquo;, &lsquo;<samp>Y</samp>&rsquo;, &lsquo;<samp>SP</samp>&rsquo; or &lsquo;<samp>PC</samp>&rsquo;.
  164. </p>
  165. </dd>
  166. </dl>
  167. <p>For example:
  168. </p>
  169. <div class="smallexample">
  170. <pre class="smallexample">ldab 1024,sp
  171. ldd [10,x]
  172. orab 3,+x
  173. stab -2,y-
  174. ldx a,pc
  175. sty [d,sp]
  176. </pre></div>
  177. <hr>
  178. <div class="header">
  179. <p>
  180. Next: <a href="M68HC11_002dModifiers.html#M68HC11_002dModifiers" accesskey="n" rel="next">M68HC11-Modifiers</a>, Previous: <a href="M68HC11_002dOpts.html#M68HC11_002dOpts" accesskey="p" rel="prev">M68HC11-Opts</a>, Up: <a href="M68HC11_002dDependent.html#M68HC11_002dDependent" accesskey="u" rel="up">M68HC11-Dependent</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>
  181. </div>
  182. </body>
  183. </html>