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.
260 lines
11 KiB
HTML
260 lines
11 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>S12Z-Syntax (Using as)</title>
|
|
|
|
<meta name="description" content="S12Z-Syntax (Using as)">
|
|
<meta name="keywords" content="S12Z-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="S12Z_002dDependent.html#S12Z_002dDependent" rel="up" title="S12Z-Dependent">
|
|
<link href="S12Z_002dDirectives.html#S12Z_002dDirectives" rel="next" title="S12Z-Directives">
|
|
<link href="S12Z_002dOpts.html#S12Z_002dOpts" rel="prev" title="S12Z-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="S12Z_002dSyntax"></a>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="S12Z_002dDirectives.html#S12Z_002dDirectives" accesskey="n" rel="next">S12Z-Directives</a>, Previous: <a href="S12Z_002dOpts.html#S12Z_002dOpts" accesskey="p" rel="prev">S12Z-Opts</a>, Up: <a href="S12Z_002dDependent.html#S12Z_002dDependent" accesskey="u" rel="up">S12Z-Dependent</a> [<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-18"></a>
|
|
<h4 class="subsection">9.23.2 Syntax</h4>
|
|
|
|
<a name="index-S12Z-syntax"></a>
|
|
<a name="index-syntax_002c-S12Z"></a>
|
|
|
|
<p>In the S12Z syntax, the instruction name comes first and it may
|
|
be followed by one or by several operands.
|
|
In most cases the maximum number of operands is three.
|
|
Some instructions accept and (in certain situations require) a suffix
|
|
indicating the size of the operand.
|
|
The suffix is separated from the instruction name by a period (‘<samp>.</samp>’)
|
|
and may be one of ‘<samp>b</samp>’, ‘<samp>w</samp>’, ‘<samp>p</samp>’ or ‘<samp>l</samp>’ indicating
|
|
‘byte’ (a single byte), ‘word’ (2 bytes), ‘pointer’ (3 bytes) or ‘long’ (4 bytes)
|
|
respectively.
|
|
Operands are separated by a comma (‘<samp>,</samp>’).
|
|
A comma however does not act as a separator if it appears within parentheses
|
|
(‘<samp>()</samp>’) or within square brackets (‘<samp>[]</samp>’).
|
|
<code>as</code> will complain if too many, too few or inappropriate operands
|
|
are specified for a given instruction.
|
|
The MRI mode is not supported for this architecture.
|
|
Example:
|
|
</p>
|
|
<div class="smallexample">
|
|
<pre class="smallexample"> bset.b 0xA98, #5
|
|
mov.b #6, 0x2409
|
|
ld d0, #4
|
|
mov.l (d0, x), 0x2409
|
|
inc d0
|
|
cmp d0, #12
|
|
blt *-4
|
|
lea x, 0x2409
|
|
st y, (1, x)
|
|
</pre></div>
|
|
|
|
<a name="index-line-comment-character_002c-S12Z"></a>
|
|
<a name="index-S12Z-line-comment-character"></a>
|
|
<p>The presence of a ‘<samp>;</samp>’ character anywhere
|
|
on a line indicates the start of a comment that extends to the end of
|
|
that line.
|
|
</p>
|
|
<p>A ‘<samp>*</samp>’ or a ‘<samp>#</samp>’ 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 ‘<samp>#</samp>’ 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-S12Z"></a>
|
|
<a name="index-statement-separator_002c-S12Z"></a>
|
|
<a name="index-S12Z-line-separator"></a>
|
|
<p>The S12Z assembler does not currently support a line separator
|
|
character.
|
|
</p>
|
|
<a name="index-S12Z-addressing-modes"></a>
|
|
<a name="index-addressing-modes_002c-S12Z"></a>
|
|
<p>The following addressing modes are understood for the S12Z.
|
|
</p><dl compact="compact">
|
|
<dt><em>Immediate</em></dt>
|
|
<dd><p>‘<samp>#<var>number</var></samp>’
|
|
</p>
|
|
</dd>
|
|
<dt><em>Immediate Bit Field</em></dt>
|
|
<dd><p>‘<samp>#<var>width</var>:<var>offset</var></samp>’
|
|
</p>
|
|
<p>Bit field instructions in the immediate mode require the width and offset to
|
|
be specified.
|
|
The <var>width</var> pararmeter specifies the number of bits in the field.
|
|
It should be a number in the range [1,32].
|
|
<var>Offset</var> determines the position within the field where the operation
|
|
should start.
|
|
It should be a number in the range [0,31].
|
|
</p>
|
|
</dd>
|
|
<dt><em>Relative</em></dt>
|
|
<dd><p>‘<samp>*<var>symbol</var></samp>’, or ‘<samp>*[+-]<var>digits</var></samp>’
|
|
</p>
|
|
<p>Program counter relative addresses have a width of 15 bits.
|
|
Thus, they must be within the range [-32768, 32767].
|
|
</p>
|
|
</dd>
|
|
<dt><em>Register</em></dt>
|
|
<dd><p>‘<samp><var>reg</var></samp>’
|
|
</p>
|
|
<p>Some instructions accept a register as an operand.
|
|
In general, <var>reg</var> may be a data register (‘<samp>D0</samp>’, ‘<samp>D1</samp>’ …
|
|
‘<samp>D7</samp>’), the <var>X</var> register or the <var>Y</var> register.
|
|
</p>
|
|
<p>A few instructions accept as an argument the stack pointer
|
|
register (‘<samp>S</samp>’), and/or the program counter (‘<samp>P</samp>’).
|
|
</p>
|
|
<p>Some very special instructions accept arguments which refer to the
|
|
condition code register. For these arguments the syntax is
|
|
‘<samp>CCR</samp>’, ‘<samp>CCH</samp>’ or ‘<samp>CCL</samp>’ which refer to the complete condition code register, the condition code register high byte and the condition code register low byte respectively.
|
|
</p>
|
|
</dd>
|
|
<dt><em>Absolute Direct</em></dt>
|
|
<dd><p>‘<samp><var>symbol</var></samp>’, or ‘<samp><var>digits</var></samp>’
|
|
</p>
|
|
</dd>
|
|
<dt><em>Absolute Indirect</em></dt>
|
|
<dd><p>‘<samp>[<var>symbol</var></samp>’, or ‘<samp><var>digits</var>]</samp>’
|
|
</p>
|
|
|
|
</dd>
|
|
<dt><em>Constant Offset Indexed</em></dt>
|
|
<dd><p>‘<samp>(<var>number</var>,<var>reg</var>)</samp>’
|
|
</p>
|
|
<p><var>Reg</var> may be either ‘<samp>X</samp>’, ‘<samp>Y</samp>’, ‘<samp>S</samp>’ or
|
|
‘<samp>P</samp>’ or one of the data registers ‘<samp>D0</samp>’, ‘<samp>D1</samp>’ …
|
|
‘<samp>D7</samp>’.
|
|
If any of the registers ‘<samp>D2</samp>’ … ‘<samp>D5</samp>’ are specified, then the
|
|
register value is treated as a signed value.
|
|
Otherwise it is treated as unsigned.
|
|
<var>Number</var> may be any integer in the range [-8388608,8388607].
|
|
</p>
|
|
</dd>
|
|
<dt><em>Offset Indexed Indirect</em></dt>
|
|
<dd><p>‘<samp>[<var>number</var>,<var>reg</var>]</samp>’
|
|
</p>
|
|
<p><var>Reg</var> may be either ‘<samp>X</samp>’, ‘<samp>Y</samp>’, ‘<samp>S</samp>’ or
|
|
‘<samp>P</samp>’.
|
|
<var>Number</var> may be any integer in the range [-8388608,8388607].
|
|
</p>
|
|
</dd>
|
|
<dt><em>Auto Pre-Increment/Pre-Decrement/Post-Increment/Post-Decrement</em></dt>
|
|
<dd><p>‘<samp>-<var>reg</var></samp>’,
|
|
‘<samp>+<var>reg</var></samp>’,
|
|
‘<samp><var>reg</var>-</samp>’ or
|
|
‘<samp><var>reg</var>+</samp>’
|
|
</p>
|
|
<p>This addressing mode is typically used to access a value at an address,
|
|
and simultaneously to increment/decrement the register pointing to that
|
|
address.
|
|
Thus <var>reg</var> may be any of the 24 bit registers ‘<samp>X</samp>’, ‘<samp>Y</samp>’, or
|
|
‘<samp>S</samp>’.
|
|
Pre-increment and post-decrement are not available for
|
|
register ‘<samp>S</samp>’ (only post-increment and pre-decrement are available).
|
|
</p>
|
|
</dd>
|
|
<dt><em>Register Offset Direct</em></dt>
|
|
<dd><p>‘<samp>(<var>data-reg</var>,<var>reg</var>)</samp>’
|
|
</p>
|
|
<p><var>Reg</var> can be either ‘<samp>X</samp>’, ‘<samp>Y</samp>’, or ‘<samp>S</samp>’.
|
|
<var>Data-reg</var>
|
|
must be one of the data registers ‘<samp>D0</samp>’, ‘<samp>D1</samp>’ … ‘<samp>D7</samp>’.
|
|
If any of the registers ‘<samp>D2</samp>’ … ‘<samp>D5</samp>’ are specified, then
|
|
the register value is treated as a signed value.
|
|
Otherwise it is treated as unsigned.
|
|
</p>
|
|
</dd>
|
|
<dt><em>Register Offset Indirect</em></dt>
|
|
<dd><p>‘<samp>[<var>data-reg</var>,<var>reg</var>]</samp>’
|
|
</p>
|
|
<p><var>Reg</var> can be either ‘<samp>X</samp>’ or ‘<samp>Y</samp>’.
|
|
<var>Data-reg</var>
|
|
must be one of the data registers ‘<samp>D0</samp>’, ‘<samp>D1</samp>’ … ‘<samp>D7</samp>’.
|
|
If any of the registers ‘<samp>D2</samp>’ … ‘<samp>D5</samp>’ are specified, then
|
|
the register value is treated as a signed value.
|
|
Otherwise it is treated as unsigned.
|
|
</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
<p>For example:
|
|
</p>
|
|
<div class="smallexample">
|
|
<pre class="smallexample"> trap #197
|
|
bra *+49
|
|
bra .L0
|
|
jmp 0xFE0034
|
|
jmp [0xFD0012]
|
|
inc.b (4,x)
|
|
dec.w [4,y]
|
|
clr.p (-s)
|
|
neg.l (d0, s)
|
|
com.b [d1, x]
|
|
jsr (45, d0)
|
|
psh cch
|
|
</pre></div>
|
|
|
|
<hr>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="S12Z_002dDirectives.html#S12Z_002dDirectives" accesskey="n" rel="next">S12Z-Directives</a>, Previous: <a href="S12Z_002dOpts.html#S12Z_002dOpts" accesskey="p" rel="prev">S12Z-Opts</a>, Up: <a href="S12Z_002dDependent.html#S12Z_002dDependent" accesskey="u" rel="up">S12Z-Dependent</a> [<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>
|