Previous: AVR-Regs, Up: AVR Syntax


9.5.2.3 Relocatable Expression Modifiers

The assembler supports several modifiers when using relocatable addresses in AVR instruction operands. The general syntax is the following:

     modifier(relocatable-expression)
lo8
This modifier allows you to use bits 0 through 7 of an address expression as 8 bit relocatable expression.
hi8
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 `ldi' instruction and `lo8' modifier.

For example

          ldi r26, lo8(sym+10)
          ldi r27, hi8(sym+10)
     

hh8
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.
hlo8
Synonym of `hh8'.
hhi8
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 `ldi' instruction and `lo8', `hi8', `hlo8', `hhi8', modifier.

For example

          ldi r26, lo8(285774925)
          ldi r27, hi8(285774925)
          ldi r28, hlo8(285774925)
          ldi r29, hhi8(285774925)
          ; r29,r28,r27,r26 = 285774925
     

pm_lo8
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 `pm_lo8' similar to `lo8'.
pm_hi8
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.
pm_hh8
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.