<html lang="en"> <head> <title>AVR-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="AVR-Syntax.html#AVR-Syntax" title="AVR Syntax"> <link rel="prev" href="AVR_002dRegs.html#AVR_002dRegs" title="AVR-Regs"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This file documents the GNU Assembler "as". Copyright (C) 1991-2015 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> </head> <body> <div class="node"> <a name="AVR-Modifiers"></a> <a name="AVR_002dModifiers"></a> <p> Previous: <a rel="previous" accesskey="p" href="AVR_002dRegs.html#AVR_002dRegs">AVR-Regs</a>, Up: <a rel="up" accesskey="u" href="AVR-Syntax.html#AVR-Syntax">AVR Syntax</a> <hr> </div> <h5 class="subsubsection">9.5.2.3 Relocatable Expression Modifiers</h5> <p><a name="index-AVR-modifiers-799"></a><a name="index-syntax_002c-AVR-800"></a> The assembler supports several modifiers when using relocatable addresses in AVR instruction operands. The general syntax is the following: <pre class="smallexample"> modifier(relocatable-expression) </pre> <a name="index-symbol-modifiers-801"></a> <dl> <dt><code>lo8</code><dd> This modifier allows you to use bits 0 through 7 of an address expression as 8 bit relocatable expression. <br><dt><code>hi8</code><dd> This modifier allows you to use bits 7 through 15 of an address expression as 8 bit relocatable expression. This is useful with, for example, the AVR ‘<samp><span class="samp">ldi</span></samp>’ instruction and ‘<samp><span class="samp">lo8</span></samp>’ modifier. <p>For example <pre class="smallexample"> ldi r26, lo8(sym+10) ldi r27, hi8(sym+10) </pre> <br><dt><code>hh8</code><dd> This modifier allows you to use bits 16 through 23 of an address expression as 8 bit relocatable expression. Also, can be useful for loading 32 bit constants. <br><dt><code>hlo8</code><dd> Synonym of ‘<samp><span class="samp">hh8</span></samp>’. <br><dt><code>hhi8</code><dd> This modifier allows you to use bits 24 through 31 of an expression as 8 bit expression. This is useful with, for example, the AVR ‘<samp><span class="samp">ldi</span></samp>’ instruction and ‘<samp><span class="samp">lo8</span></samp>’, ‘<samp><span class="samp">hi8</span></samp>’, ‘<samp><span class="samp">hlo8</span></samp>’, ‘<samp><span class="samp">hhi8</span></samp>’, modifier. <p>For example <pre class="smallexample"> ldi r26, lo8(285774925) ldi r27, hi8(285774925) ldi r28, hlo8(285774925) ldi r29, hhi8(285774925) ; r29,r28,r27,r26 = 285774925 </pre> <br><dt><code>pm_lo8</code><dd> This modifier allows you to use bits 0 through 7 of an address expression as 8 bit relocatable expression. This modifier useful for addressing data or code from Flash/Program memory. The using of ‘<samp><span class="samp">pm_lo8</span></samp>’ similar to ‘<samp><span class="samp">lo8</span></samp>’. <br><dt><code>pm_hi8</code><dd> This modifier allows you to use bits 8 through 15 of an address expression as 8 bit relocatable expression. This modifier useful for addressing data or code from Flash/Program memory. <br><dt><code>pm_hh8</code><dd> This modifier allows you to use bits 15 through 23 of an address expression as 8 bit relocatable expression. This modifier useful for addressing data or code from Flash/Program memory. </dl> </body></html>