blob: 6e70444370ffb175adf4188ca4c45de61351e7e5 [file] [log] [blame]
<html lang="en">
<head>
<title>M68HC11-Modifiers - 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_002dSyntax.html#M68HC11_002dSyntax" title="M68HC11-Syntax">
<link rel="next" href="M68HC11_002dDirectives.html#M68HC11_002dDirectives" title="M68HC11-Directives">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".
Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2006, 2007, 2008, 2009, 2010 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>
<link rel="stylesheet" type="text/css" href="../cs.css">
</head>
<body>
<div class="node">
<a name="M68HC11-Modifiers"></a>
<a name="M68HC11_002dModifiers"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="M68HC11_002dDirectives.html#M68HC11_002dDirectives">M68HC11-Directives</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="M68HC11_002dSyntax.html#M68HC11_002dSyntax">M68HC11-Syntax</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="M68HC11_002dDependent.html#M68HC11_002dDependent">M68HC11-Dependent</a>
<hr>
</div>
<h4 class="subsection">9.22.3 Symbolic Operand Modifiers</h4>
<p><a name="index-M68HC11-modifiers-1218"></a><a name="index-syntax_002c-M68HC11-1219"></a>
The assembler supports several modifiers when using symbol addresses
in 68HC11 and 68HC12 instruction operands. The general syntax is
the following:
<pre class="smallexample"> %modifier(symbol)
</pre>
<a name="index-symbol-modifiers-1220"></a>
<dl><dt><code>%addr</code><dd>This modifier indicates to the assembler and linker to use
the 16-bit physical address corresponding to the symbol. This is intended
to be used on memory window systems to map a symbol in the memory bank window.
If the symbol is in a memory expansion part, the physical address
corresponds to the symbol address within the memory bank window.
If the symbol is not in a memory expansion part, this is the symbol address
(using or not using the %addr modifier has no effect in that case).
<br><dt><code>%page</code><dd>This modifier indicates to use the memory page number corresponding
to the symbol. If the symbol is in a memory expansion part, its page
number is computed by the linker as a number used to map the page containing
the symbol in the memory bank window. If the symbol is not in a memory
expansion part, the page number is 0.
<br><dt><code>%hi</code><dd>This modifier indicates to use the 8-bit high part of the physical
address of the symbol.
<br><dt><code>%lo</code><dd>This modifier indicates to use the 8-bit low part of the physical
address of the symbol.
</dl>
<p>For example a 68HC12 call to a function &lsquo;<samp><span class="samp">foo_example</span></samp>&rsquo; stored in memory
expansion part could be written as follows:
<pre class="smallexample"> call %addr(foo_example),%page(foo_example)
</pre>
<p>and this is equivalent to
<pre class="smallexample"> call foo_example
</pre>
<p>And for 68HC11 it could be written as follows:
<pre class="smallexample"> ldab #%page(foo_example)
stab _page_switch
jsr %addr(foo_example)
</pre>
</body></html>