neingeist
/
arduinisten
Archived
1
0
Fork 0
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

103 lines
4.3 KiB
HTML

<html lang="en">
<head>
<title>M32C-Modifiers - Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.7">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="M32C_002dDependent.html#M32C_002dDependent" title="M32C-Dependent">
<link rel="prev" href="M32C_002dOpts.html#M32C_002dOpts" title="M32C-Opts">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002,
2006, 2007 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.1
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''.
man end-->
<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; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="M32C_002dModifiers"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="M32C_002dOpts.html#M32C_002dOpts">M32C-Opts</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="M32C_002dDependent.html#M32C_002dDependent">M32C-Dependent</a>
<hr><br>
</div>
<h4 class="subsection">9.18.2 Symbolic Operand Modifiers</h4>
<p><a name="index-M32C-modifiers-1035"></a><a name="index-syntax_002c-M32C-1036"></a>
The assembler supports several modifiers when using symbol addresses
in M32C instruction operands. The general syntax is the following:
<pre class="smallexample"> %modifier(symbol)
</pre>
<a name="index-symbol-modifiers-1037"></a>
<dl>
<dt><code>%dsp8</code><dt><code>%dsp16</code><dd>
These modifiers override the assembler's assumptions about how big a
symbol's address is. Normally, when it sees an operand like
<span class="samp">sym[a0]</span> it assumes <span class="samp">sym</span> may require the widest
displacement field (16 bits for <span class="samp">-m16c</span>, 24 bits for
<span class="samp">-m32c</span>). These modifiers tell it to assume the address will fit
in an 8 or 16 bit (respectively) unsigned displacement. Note that, of
course, if it doesn't actually fit you will get linker errors. Example:
<pre class="smallexample"> mov.w %dsp8(sym)[a0],r1
mov.b #0,%dsp8(sym)[a0]
</pre>
<br><dt><code>%hi8</code><dd>
This modifier allows you to load bits 16 through 23 of a 24 bit
address into an 8 bit register. This is useful with, for example, the
M16C <span class="samp">smovf</span> instruction, which expects a 20 bit address in
<span class="samp">r1h</span> and <span class="samp">a0</span>. Example:
<pre class="smallexample"> mov.b #%hi8(sym),r1h
mov.w #%lo16(sym),a0
smovf.b
</pre>
<br><dt><code>%lo16</code><dd>
Likewise, this modifier allows you to load bits 0 through 15 of a 24
bit address into a 16 bit register.
<br><dt><code>%hi16</code><dd>
This modifier allows you to load bits 16 through 31 of a 32 bit
address into a 16 bit register. While the M32C family only has 24
bits of address space, it does support addresses in pairs of 16 bit
registers (like <span class="samp">a1a0</span> for the <span class="samp">lde</span> instruction). This
modifier is for loading the upper half in such cases. Example:
<pre class="smallexample"> mov.w #%hi16(sym),a1
mov.w #%lo16(sym),a0
...
lde.w [a1a0],r1
</pre>
</dl>
<!-- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -->
<!-- 2000, 2003, 2004 -->
<!-- Free Software Foundation, Inc. -->
<!-- This is part of the GAS manual. -->
<!-- For copying conditions, see the file as.texinfo. -->
</body></html>