Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

199 lines
8.5KB

  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-2020 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 6.5, http://www.gnu.org/software/texinfo/ -->
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  15. <title>M68HC11-Syntax (Using as)</title>
  16. <meta name="description" content="M68HC11-Syntax (Using as)">
  17. <meta name="keywords" content="M68HC11-Syntax (Using as)">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  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.indentedblock {margin-right: 0em}
  31. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  32. blockquote.smallquotation {font-size: smaller}
  33. div.display {margin-left: 3.2em}
  34. div.example {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  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.nolinebreak {white-space: nowrap}
  49. span.roman {font-family: initial; font-weight: normal}
  50. span.sansserif {font-family: sans-serif; font-weight: normal}
  51. ul.no-bullet {list-style: none}
  52. -->
  53. </style>
  54. </head>
  55. <body lang="en">
  56. <a name="M68HC11_002dSyntax"></a>
  57. <div class="header">
  58. <p>
  59. 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>
  60. </div>
  61. <hr>
  62. <a name="Syntax-18"></a>
  63. <h4 class="subsection">9.23.2 Syntax</h4>
  64. <a name="index-M68HC11-syntax"></a>
  65. <a name="index-syntax_002c-M68HC11"></a>
  66. <p>In the M68HC11 syntax, the instruction name comes first and it may
  67. be followed by one or several operands (up to three). Operands are
  68. separated by comma (&lsquo;<samp>,</samp>&rsquo;). In the normal mode,
  69. <code>as</code> will complain if too many operands are specified for
  70. a given instruction. In the MRI mode (turned on with &lsquo;<samp>-M</samp>&rsquo; option),
  71. it will treat them as comments. Example:
  72. </p>
  73. <div class="smallexample">
  74. <pre class="smallexample">inx
  75. lda #23
  76. bset 2,x #4
  77. brclr *bot #8 foo
  78. </pre></div>
  79. <a name="index-line-comment-character_002c-M68HC11"></a>
  80. <a name="index-M68HC11-line-comment-character"></a>
  81. <p>The presence of a &lsquo;<samp>;</samp>&rsquo; character or a &lsquo;<samp>!</samp>&rsquo; character anywhere
  82. on a line indicates the start of a comment that extends to the end of
  83. that line.
  84. </p>
  85. <p>A &lsquo;<samp>*</samp>&rsquo; or a &lsquo;<samp>#</samp>&rsquo; character at the start of a line also
  86. introduces a line comment, but these characters do not work elsewhere
  87. on the line. If the first character of the line is a &lsquo;<samp>#</samp>&rsquo; then as
  88. well as starting a comment, the line could also be logical line number
  89. directive (see <a href="Comments.html#Comments">Comments</a>) or a preprocessor control command
  90. (see <a href="Preprocessing.html#Preprocessing">Preprocessing</a>).
  91. </p>
  92. <a name="index-line-separator_002c-M68HC11"></a>
  93. <a name="index-statement-separator_002c-M68HC11"></a>
  94. <a name="index-M68HC11-line-separator"></a>
  95. <p>The M68HC11 assembler does not currently support a line separator
  96. character.
  97. </p>
  98. <a name="index-M68HC11-addressing-modes"></a>
  99. <a name="index-addressing-modes_002c-M68HC11"></a>
  100. <p>The following addressing modes are understood for 68HC11 and 68HC12:
  101. </p><dl compact="compact">
  102. <dt><em>Immediate</em></dt>
  103. <dd><p>&lsquo;<samp>#<var>number</var></samp>&rsquo;
  104. </p>
  105. </dd>
  106. <dt><em>Address Register</em></dt>
  107. <dd><p>&lsquo;<samp><var>number</var>,X</samp>&rsquo;, &lsquo;<samp><var>number</var>,Y</samp>&rsquo;
  108. </p>
  109. <p>The <var>number</var> may be omitted in which case 0 is assumed.
  110. </p>
  111. </dd>
  112. <dt><em>Direct Addressing mode</em></dt>
  113. <dd><p>&lsquo;<samp>*<var>symbol</var></samp>&rsquo;, or &lsquo;<samp>*<var>digits</var></samp>&rsquo;
  114. </p>
  115. </dd>
  116. <dt><em>Absolute</em></dt>
  117. <dd><p>&lsquo;<samp><var>symbol</var></samp>&rsquo;, or &lsquo;<samp><var>digits</var></samp>&rsquo;
  118. </p></dd>
  119. </dl>
  120. <p>The M68HC12 has other more complex addressing modes. All of them
  121. are supported and they are represented below:
  122. </p>
  123. <dl compact="compact">
  124. <dt><em>Constant Offset Indexed Addressing Mode</em></dt>
  125. <dd><p>&lsquo;<samp><var>number</var>,<var>reg</var></samp>&rsquo;
  126. </p>
  127. <p>The <var>number</var> may be omitted in which case 0 is assumed.
  128. The register can be either &lsquo;<samp>X</samp>&rsquo;, &lsquo;<samp>Y</samp>&rsquo;, &lsquo;<samp>SP</samp>&rsquo; or
  129. &lsquo;<samp>PC</samp>&rsquo;. The assembler will use the smaller post-byte definition
  130. according to the constant value (5-bit constant offset, 9-bit constant
  131. offset or 16-bit constant offset). If the constant is not known by
  132. the assembler it will use the 16-bit constant offset post-byte and the value
  133. will be resolved at link time.
  134. </p>
  135. </dd>
  136. <dt><em>Offset Indexed Indirect</em></dt>
  137. <dd><p>&lsquo;<samp>[<var>number</var>,<var>reg</var>]</samp>&rsquo;
  138. </p>
  139. <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;.
  140. </p>
  141. </dd>
  142. <dt><em>Auto Pre-Increment/Pre-Decrement/Post-Increment/Post-Decrement</em></dt>
  143. <dd><p>&lsquo;<samp><var>number</var>,-<var>reg</var></samp>&rsquo;
  144. &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. </p>
  148. <p>The number must be in the range &lsquo;<samp>-8</samp>&rsquo;..&lsquo;<samp>+8</samp>&rsquo; and must not be 0.
  149. 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;.
  150. </p>
  151. </dd>
  152. <dt><em>Accumulator Offset</em></dt>
  153. <dd><p>&lsquo;<samp><var>acc</var>,<var>reg</var></samp>&rsquo;
  154. </p>
  155. <p>The accumulator register can be either &lsquo;<samp>A</samp>&rsquo;, &lsquo;<samp>B</samp>&rsquo; or &lsquo;<samp>D</samp>&rsquo;.
  156. 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;.
  157. </p>
  158. </dd>
  159. <dt><em>Accumulator D offset indexed-indirect</em></dt>
  160. <dd><p>&lsquo;<samp>[D,<var>reg</var>]</samp>&rsquo;
  161. </p>
  162. <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;.
  163. </p>
  164. </dd>
  165. </dl>
  166. <p>For example:
  167. </p>
  168. <div class="smallexample">
  169. <pre class="smallexample">ldab 1024,sp
  170. ldd [10,x]
  171. orab 3,+x
  172. stab -2,y-
  173. ldx a,pc
  174. sty [d,sp]
  175. </pre></div>
  176. <hr>
  177. <div class="header">
  178. <p>
  179. 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>
  180. </div>
  181. </body>
  182. </html>