<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.8">
<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">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
@import url("../raisonance.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">
<p>
<a name="M32C-Modifiers"></a>
<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>
</div>

<h4 class="subsection">8.16.2 Symbolic Operand Modifiers</h4>

<p><a name="index-M32C-modifiers-981"></a><a name="index-syntax_002c-M32C-982"></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-983"></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
`<samp><span class="samp">sym[a0]</span></samp>' it assumes `<samp><span class="samp">sym</span></samp>' may require the widest
displacement field (16 bits for `<samp><span class="samp">-m16c</span></samp>', 24 bits for
`<samp><span class="samp">-m32c</span></samp>').  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 `<samp><span class="samp">smovf</span></samp>' instruction, which expects a 20 bit address in
`<samp><span class="samp">r1h</span></samp>' and `<samp><span class="samp">a0</span></samp>'.  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 `<samp><span class="samp">a1a0</span></samp>' for the `<samp><span class="samp">lde</span></samp>' 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>

