M68HC11-Modifiers - Using as
Description: Using as

Next: M68HC11-Directives, Previous: M68HC11-Syntax, Up: M68HC11-Dependent

#### 9.24.3 Symbolic Operand Modifiers

The assembler supports several modifiers when using symbol addresses in 68HC11 and 68HC12 instruction operands. The general syntax is the following:

         %modifier(symbol)

`%addr`
  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).
`%page`
  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.
`%hi`
  This modifier indicates to use the 8-bit high part of the physical address of the symbol.
`%lo`
  This modifier indicates to use the 8-bit low part of the physical address of the symbol.

For example a 68HC12 call to a function ‘`foo_example`’ stored in memory expansion part could be written as follows:

         call %addr(foo_example),%page(foo_example)

and this is equivalent to

         call foo_example

And for 68HC11 it could be written as follows:

         ldab #%page(foo_example)
         stab _page_switch
         jsr  %addr(foo_example)