as: M32C-Modifiers
1
1 9.21.2.1 Symbolic Operand Modifiers
1 ...................................
1
1 The assembler supports several modifiers when using symbol addresses in
1 M32C instruction operands. The general syntax is the following:
1
1 %modifier(symbol)
1
1 '%dsp8'
1 '%dsp16'
1
1 These modifiers override the assembler's assumptions about how big
1 a symbol's address is. Normally, when it sees an operand like
1 'sym[a0]' it assumes 'sym' may require the widest displacement
1 field (16 bits for '-m16c', 24 bits for '-m32c'). These modifiers
1 tell it to assume the address will fit in an 8 or 16 bit
1 (respectively) unsigned displacement. Note that, of course, if it
1 doesn't actually fit you will get linker errors. Example:
1
1 mov.w %dsp8(sym)[a0],r1
1 mov.b #0,%dsp8(sym)[a0]
1
1 '%hi8'
1
1 This modifier allows you to load bits 16 through 23 of a 24 bit
1 address into an 8 bit register. This is useful with, for example,
1 the M16C 'smovf' instruction, which expects a 20 bit address in
1 'r1h' and 'a0'. Example:
1
1 mov.b #%hi8(sym),r1h
1 mov.w #%lo16(sym),a0
1 smovf.b
1
1 '%lo16'
1
1 Likewise, this modifier allows you to load bits 0 through 15 of a
1 24 bit address into a 16 bit register.
1
1 '%hi16'
1
1 This modifier allows you to load bits 16 through 31 of a 32 bit
1 address into a 16 bit register. While the M32C family only has 24
1 bits of address space, it does support addresses in pairs of 16 bit
1 registers (like 'a1a0' for the 'lde' instruction). This modifier
1 is for loading the upper half in such cases. Example:
1
1 mov.w #%hi16(sym),a1
1 mov.w #%lo16(sym),a0
1 ...
1 lde.w [a1a0],r1
1