You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

199 lines
8.5 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- 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".
-->
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
<head>
<title>M68HC11-Syntax (Using as)</title>
<meta name="description" content="M68HC11-Syntax (Using as)">
<meta name="keywords" content="M68HC11-Syntax (Using as)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="AS-Index.html#AS-Index" rel="index" title="AS Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="M68HC11_002dDependent.html#M68HC11_002dDependent" rel="up" title="M68HC11-Dependent">
<link href="M68HC11_002dModifiers.html#M68HC11_002dModifiers" rel="next" title="M68HC11-Modifiers">
<link href="M68HC11_002dOpts.html#M68HC11_002dOpts" rel="prev" title="M68HC11-Opts">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="M68HC11_002dSyntax"></a>
<div class="header">
<p>
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>
</div>
<hr>
<a name="Syntax-17"></a>
<h4 class="subsection">9.22.2 Syntax</h4>
<a name="index-M68HC11-syntax"></a>
<a name="index-syntax_002c-M68HC11"></a>
<p>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>,</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>-M</samp>&rsquo; option),
it will treat them as comments. Example:
</p>
<div class="smallexample">
<pre class="smallexample">inx
lda #23
bset 2,x #4
brclr *bot #8 foo
</pre></div>
<a name="index-line-comment-character_002c-M68HC11"></a>
<a name="index-M68HC11-line-comment-character"></a>
<p>The presence of a &lsquo;<samp>;</samp>&rsquo; character or a &lsquo;<samp>!</samp>&rsquo; character anywhere
on a line indicates the start of a comment that extends to the end of
that line.
</p>
<p>A &lsquo;<samp>*</samp>&rsquo; or a &lsquo;<samp>#</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>#</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"></a>
<a name="index-statement-separator_002c-M68HC11"></a>
<a name="index-M68HC11-line-separator"></a>
<p>The M68HC11 assembler does not currently support a line separator
character.
</p>
<a name="index-M68HC11-addressing-modes"></a>
<a name="index-addressing-modes_002c-M68HC11"></a>
<p>The following addressing modes are understood for 68HC11 and 68HC12:
</p><dl compact="compact">
<dt><em>Immediate</em></dt>
<dd><p>&lsquo;<samp>#<var>number</var></samp>&rsquo;
</p>
</dd>
<dt><em>Address Register</em></dt>
<dd><p>&lsquo;<samp><var>number</var>,X</samp>&rsquo;, &lsquo;<samp><var>number</var>,Y</samp>&rsquo;
</p>
<p>The <var>number</var> may be omitted in which case 0 is assumed.
</p>
</dd>
<dt><em>Direct Addressing mode</em></dt>
<dd><p>&lsquo;<samp>*<var>symbol</var></samp>&rsquo;, or &lsquo;<samp>*<var>digits</var></samp>&rsquo;
</p>
</dd>
<dt><em>Absolute</em></dt>
<dd><p>&lsquo;<samp><var>symbol</var></samp>&rsquo;, or &lsquo;<samp><var>digits</var></samp>&rsquo;
</p></dd>
</dl>
<p>The M68HC12 has other more complex addressing modes. All of them
are supported and they are represented below:
</p>
<dl compact="compact">
<dt><em>Constant Offset Indexed Addressing Mode</em></dt>
<dd><p>&lsquo;<samp><var>number</var>,<var>reg</var></samp>&rsquo;
</p>
<p>The <var>number</var> may be omitted in which case 0 is assumed.
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;. 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.
</p>
</dd>
<dt><em>Offset Indexed Indirect</em></dt>
<dd><p>&lsquo;<samp>[<var>number</var>,<var>reg</var>]</samp>&rsquo;
</p>
<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;.
</p>
</dd>
<dt><em>Auto Pre-Increment/Pre-Decrement/Post-Increment/Post-Decrement</em></dt>
<dd><p>&lsquo;<samp><var>number</var>,-<var>reg</var></samp>&rsquo;
&lsquo;<samp><var>number</var>,+<var>reg</var></samp>&rsquo;
&lsquo;<samp><var>number</var>,<var>reg</var>-</samp>&rsquo;
&lsquo;<samp><var>number</var>,<var>reg</var>+</samp>&rsquo;
</p>
<p>The number must be in the range &lsquo;<samp>-8</samp>&rsquo;..&lsquo;<samp>+8</samp>&rsquo; and must not be 0.
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;.
</p>
</dd>
<dt><em>Accumulator Offset</em></dt>
<dd><p>&lsquo;<samp><var>acc</var>,<var>reg</var></samp>&rsquo;
</p>
<p>The accumulator register can be either &lsquo;<samp>A</samp>&rsquo;, &lsquo;<samp>B</samp>&rsquo; or &lsquo;<samp>D</samp>&rsquo;.
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;.
</p>
</dd>
<dt><em>Accumulator D offset indexed-indirect</em></dt>
<dd><p>&lsquo;<samp>[D,<var>reg</var>]</samp>&rsquo;
</p>
<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;.
</p>
</dd>
</dl>
<p>For example:
</p>
<div class="smallexample">
<pre class="smallexample">ldab 1024,sp
ldd [10,x]
orab 3,+x
stab -2,y-
ldx a,pc
sty [d,sp]
</pre></div>
<hr>
<div class="header">
<p>
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>
</div>
</body>
</html>