toolchain/share/doc/as.html/M68HC11_002dSyntax.html

139 lines
8.2 KiB
HTML

<html lang="en">
<head>
<title>M68HC11-Syntax - Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="M68HC11_002dDependent.html#M68HC11_002dDependent" title="M68HC11-Dependent">
<link rel="prev" href="M68HC11_002dOpts.html#M68HC11_002dOpts" title="M68HC11-Opts">
<link rel="next" href="M68HC11_002dModifiers.html#M68HC11_002dModifiers" title="M68HC11-Modifiers">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".
Copyright (C) 1991-2019 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="M68HC11-Syntax"></a>
<a name="M68HC11_002dSyntax"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="M68HC11_002dModifiers.html#M68HC11_002dModifiers">M68HC11-Modifiers</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="M68HC11_002dOpts.html#M68HC11_002dOpts">M68HC11-Opts</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="M68HC11_002dDependent.html#M68HC11_002dDependent">M68HC11-Dependent</a>
<hr>
</div>
<h4 class="subsection">9.23.2 Syntax</h4>
<p><a name="index-M68HC11-syntax-1477"></a><a name="index-syntax_002c-M68HC11-1478"></a>
In the M68HC11 syntax, the instruction name comes first and it may
be followed by one or several operands (up to three). Operands are
separated by comma (&lsquo;<samp><span class="samp">,</span></samp>&rsquo;). In the normal mode,
<code>as</code> will complain if too many operands are specified for
a given instruction. In the MRI mode (turned on with &lsquo;<samp><span class="samp">-M</span></samp>&rsquo; option),
it will treat them as comments. Example:
<pre class="smallexample"> inx
lda #23
bset 2,x #4
brclr *bot #8 foo
</pre>
<p><a name="index-line-comment-character_002c-M68HC11-1479"></a><a name="index-M68HC11-line-comment-character-1480"></a>The presence of a &lsquo;<samp><span class="samp">;</span></samp>&rsquo; character or a &lsquo;<samp><span class="samp">!</span></samp>&rsquo; character anywhere
on a line indicates the start of a comment that extends to the end of
that line.
<p>A &lsquo;<samp><span class="samp">*</span></samp>&rsquo; or a &lsquo;<samp><span class="samp">#</span></samp>&rsquo; character at the start of a line also
introduces a line comment, but these characters do not work elsewhere
on the line. If the first character of the line is a &lsquo;<samp><span class="samp">#</span></samp>&rsquo; then as
well as starting a comment, the line could also be logical line number
directive (see <a href="Comments.html#Comments">Comments</a>) or a preprocessor control command
(see <a href="Preprocessing.html#Preprocessing">Preprocessing</a>).
<p><a name="index-line-separator_002c-M68HC11-1481"></a><a name="index-statement-separator_002c-M68HC11-1482"></a><a name="index-M68HC11-line-separator-1483"></a>The M68HC11 assembler does not currently support a line separator
character.
<p><a name="index-M68HC11-addressing-modes-1484"></a><a name="index-addressing-modes_002c-M68HC11-1485"></a>The following addressing modes are understood for 68HC11 and 68HC12:
<dl>
<dt><dfn>Immediate</dfn><dd>&lsquo;<samp><span class="samp">#</span><var>number</var></samp>&rsquo;
<br><dt><dfn>Address Register</dfn><dd>&lsquo;<samp><var>number</var><span class="samp">,X</span></samp>&rsquo;, &lsquo;<samp><var>number</var><span class="samp">,Y</span></samp>&rsquo;
<p>The <var>number</var> may be omitted in which case 0 is assumed.
<br><dt><dfn>Direct Addressing mode</dfn><dd>&lsquo;<samp><span class="samp">*</span><var>symbol</var></samp>&rsquo;, or &lsquo;<samp><span class="samp">*</span><var>digits</var></samp>&rsquo;
<br><dt><dfn>Absolute</dfn><dd>&lsquo;<samp><var>symbol</var></samp>&rsquo;, or &lsquo;<samp><var>digits</var></samp>&rsquo;
</dl>
<p>The M68HC12 has other more complex addressing modes. All of them
are supported and they are represented below:
<dl>
<dt><dfn>Constant Offset Indexed Addressing Mode</dfn><dd>&lsquo;<samp><var>number</var><span class="samp">,</span><var>reg</var></samp>&rsquo;
<p>The <var>number</var> may be omitted in which case 0 is assumed.
The register can be either &lsquo;<samp><span class="samp">X</span></samp>&rsquo;, &lsquo;<samp><span class="samp">Y</span></samp>&rsquo;, &lsquo;<samp><span class="samp">SP</span></samp>&rsquo; or
&lsquo;<samp><span class="samp">PC</span></samp>&rsquo;. The assembler will use the smaller post-byte definition
according to the constant value (5-bit constant offset, 9-bit constant
offset or 16-bit constant offset). If the constant is not known by
the assembler it will use the 16-bit constant offset post-byte and the value
will be resolved at link time.
<br><dt><dfn>Offset Indexed Indirect</dfn><dd>&lsquo;<samp><span class="samp">[</span><var>number</var><span class="samp">,</span><var>reg</var><span class="samp">]</span></samp>&rsquo;
<p>The register can be either &lsquo;<samp><span class="samp">X</span></samp>&rsquo;, &lsquo;<samp><span class="samp">Y</span></samp>&rsquo;, &lsquo;<samp><span class="samp">SP</span></samp>&rsquo; or &lsquo;<samp><span class="samp">PC</span></samp>&rsquo;.
<br><dt><dfn>Auto Pre-Increment/Pre-Decrement/Post-Increment/Post-Decrement</dfn><dd>&lsquo;<samp><var>number</var><span class="samp">,-</span><var>reg</var></samp>&rsquo;
&lsquo;<samp><var>number</var><span class="samp">,+</span><var>reg</var></samp>&rsquo;
&lsquo;<samp><var>number</var><span class="samp">,</span><var>reg</var><span class="samp">-</span></samp>&rsquo;
&lsquo;<samp><var>number</var><span class="samp">,</span><var>reg</var><span class="samp">+</span></samp>&rsquo;
<p>The number must be in the range &lsquo;<samp><span class="samp">-8</span></samp>&rsquo;..&lsquo;<samp><span class="samp">+8</span></samp>&rsquo; and must not be 0.
The register can be either &lsquo;<samp><span class="samp">X</span></samp>&rsquo;, &lsquo;<samp><span class="samp">Y</span></samp>&rsquo;, &lsquo;<samp><span class="samp">SP</span></samp>&rsquo; or &lsquo;<samp><span class="samp">PC</span></samp>&rsquo;.
<br><dt><dfn>Accumulator Offset</dfn><dd>&lsquo;<samp><var>acc</var><span class="samp">,</span><var>reg</var></samp>&rsquo;
<p>The accumulator register can be either &lsquo;<samp><span class="samp">A</span></samp>&rsquo;, &lsquo;<samp><span class="samp">B</span></samp>&rsquo; or &lsquo;<samp><span class="samp">D</span></samp>&rsquo;.
The register can be either &lsquo;<samp><span class="samp">X</span></samp>&rsquo;, &lsquo;<samp><span class="samp">Y</span></samp>&rsquo;, &lsquo;<samp><span class="samp">SP</span></samp>&rsquo; or &lsquo;<samp><span class="samp">PC</span></samp>&rsquo;.
<br><dt><dfn>Accumulator D offset indexed-indirect</dfn><dd>&lsquo;<samp><span class="samp">[D,</span><var>reg</var><span class="samp">]</span></samp>&rsquo;
<p>The register can be either &lsquo;<samp><span class="samp">X</span></samp>&rsquo;, &lsquo;<samp><span class="samp">Y</span></samp>&rsquo;, &lsquo;<samp><span class="samp">SP</span></samp>&rsquo; or &lsquo;<samp><span class="samp">PC</span></samp>&rsquo;.
</dl>
<p>For example:
<pre class="smallexample"> ldab 1024,sp
ldd [10,x]
orab 3,+x
stab -2,y-
ldx a,pc
sty [d,sp]
</pre>
</body></html>