M32C Dependent Features
***********************

AS can assemble code for several different members of the Renesas M32C family.  Normally the default is to assemble code for the M16C microprocessor.  The -m32c option may be used to change the default to the M32C microprocessor.

M32C Options
============

The Renesas M32C version of AS has these machine-dependent options:

-m32c
     Assemble M32C instructions.

-m16c
     Assemble M16C instructions (default).

-relax
     Enable support for link-time relaxations.

-h-tick-hex
     Support H'00 style hex constants in addition to 0x00 style.

M32C Syntax
===========

Symbolic Operand Modifiers
--------------------------

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

     %modifier(symbol)

%dsp8
%dsp16

     These modifiers override the assembler's assumptions about how big a symbol's address is.  Normally, when it sees an operand like sym[a0] it assumes sym may require the widest displacement field (16 bits for -m16c, 24 bits for -m32c).  These modifiers tell it to assume the address will fit in an 8 or 16 bit (respectively) unsigned displacement.  Note that, of course, if it doesn't actually fit you will get linker errors.  Example:

          mov.w %dsp8(sym)[a0],r1
          mov.b #0,%dsp8(sym)[a0]

%hi8

     This modifier allows you to load bits 16 through 23 of a 24 bit address into an 8 bit register.  This is useful with, for example, the M16C smovf instruction, which expects a 20 bit address in r1h and a0.  Example:

          mov.b #%hi8(sym),r1h
          mov.w #%lo16(sym),a0
          smovf.b

%lo16

     Likewise, this modifier allows you to load bits 0 through 15 of a 24 bit address into a 16 bit register.

%hi16

     This modifier allows you to load bits 16 through 31 of a 32 bit address into a 16 bit register.  While the M32C family only has 24 bits of address space, it does support addresses in pairs of 16 bit registers (like a1a0 for the lde instruction).  This modifier is for loading the upper half in such cases.  Example:

          mov.w #%hi16(sym),a1
          mov.w #%lo16(sym),a0
          ...
          lde.w [a1a0],r1

Special Characters
------------------

The presence of a ; character on a line indicates the start of a comment that extends to the end of that line.

If a # appears as the first character of a line, the whole line is treated as a comment, but in this case the line can also be a logical line number directive (see Comments) or a preprocessor control command (see Preprocessing).

The | character can be used to separate statements on the same line.