1*3d8817e4Smiod@c Copyright 2005 2*3d8817e4Smiod@c Free Software Foundation, Inc. 3*3d8817e4Smiod@c This is part of the GAS manual. 4*3d8817e4Smiod@c For copying conditions, see the file as.texinfo. 5*3d8817e4Smiod@ifset GENERIC 6*3d8817e4Smiod@page 7*3d8817e4Smiod@node M32C-Dependent 8*3d8817e4Smiod@chapter M32C Dependent Features 9*3d8817e4Smiod@end ifset 10*3d8817e4Smiod@ifclear GENERIC 11*3d8817e4Smiod@node Machine Dependencies 12*3d8817e4Smiod@chapter M32C Dependent Features 13*3d8817e4Smiod@end ifclear 14*3d8817e4Smiod 15*3d8817e4Smiod@cindex M32C support 16*3d8817e4Smiod 17*3d8817e4Smiod@code{@value{AS}} can assemble code for several different members of 18*3d8817e4Smiodthe Renesas M32C family. Normally the default is to assemble code for 19*3d8817e4Smiodthe M16C microprocessor. The @code{-m32c} option may be used to 20*3d8817e4Smiodchange the default to the M32C microprocessor. 21*3d8817e4Smiod 22*3d8817e4Smiod@menu 23*3d8817e4Smiod* M32C-Opts:: M32C Options 24*3d8817e4Smiod* M32C-Modifiers:: Symbolic Operand Modifiers 25*3d8817e4Smiod@end menu 26*3d8817e4Smiod 27*3d8817e4Smiod@node M32C-Opts 28*3d8817e4Smiod@section M32C Options 29*3d8817e4Smiod 30*3d8817e4Smiod@cindex options, M32C 31*3d8817e4Smiod@cindex M32C options 32*3d8817e4Smiod 33*3d8817e4SmiodThe Renesas M32C version of @code{@value{AS}} has two 34*3d8817e4Smiodmachine-dependent options: 35*3d8817e4Smiod 36*3d8817e4Smiod@table @code 37*3d8817e4Smiod@item -m32c 38*3d8817e4Smiod@cindex @samp{-m32c} option, M32C 39*3d8817e4Smiod@cindex architecture options, M32C 40*3d8817e4Smiod@cindex M32C architecture option 41*3d8817e4SmiodAssemble M32C instructions. 42*3d8817e4Smiod 43*3d8817e4Smiod@item -m16c 44*3d8817e4Smiod@cindex @samp{-m16c} option, M16C 45*3d8817e4Smiod@cindex architecture options, M16C 46*3d8817e4Smiod@cindex M16C architecture option 47*3d8817e4SmiodAssemble M16C instructions (default). 48*3d8817e4Smiod 49*3d8817e4Smiod@end table 50*3d8817e4Smiod 51*3d8817e4Smiod@node M32C-Modifiers 52*3d8817e4Smiod@section Symbolic Operand Modifiers 53*3d8817e4Smiod 54*3d8817e4Smiod@cindex M32C modifiers 55*3d8817e4Smiod@cindex syntax, M32C 56*3d8817e4Smiod 57*3d8817e4SmiodThe assembler supports several modifiers when using symbol addresses 58*3d8817e4Smiodin M32C instruction operands. The general syntax is the following: 59*3d8817e4Smiod 60*3d8817e4Smiod@smallexample 61*3d8817e4Smiod%modifier(symbol) 62*3d8817e4Smiod@end smallexample 63*3d8817e4Smiod 64*3d8817e4Smiod@table @code 65*3d8817e4Smiod@cindex symbol modifiers 66*3d8817e4Smiod 67*3d8817e4Smiod@item %dsp8 68*3d8817e4Smiod@itemx %dsp16 69*3d8817e4Smiod 70*3d8817e4SmiodThese modifiers override the assembler's assumptions about how big a 71*3d8817e4Smiodsymbol's address is. Normally, when it sees an operand like 72*3d8817e4Smiod@samp{sym[a0]} it assumes @samp{sym} may require the widest 73*3d8817e4Smioddisplacement field (16 bits for @samp{-m16c}, 24 bits for 74*3d8817e4Smiod@samp{-m32c}). These modifiers tell it to assume the address will fit 75*3d8817e4Smiodin an 8 or 16 bit (respectively) unsigned displacement. Note that, of 76*3d8817e4Smiodcourse, if it doesn't actually fit you will get linker errors. Example: 77*3d8817e4Smiod 78*3d8817e4Smiod@smallexample 79*3d8817e4Smiodmov.w %dsp8(sym)[a0],r1 80*3d8817e4Smiodmov.b #0,%dsp8(sym)[a0] 81*3d8817e4Smiod@end smallexample 82*3d8817e4Smiod 83*3d8817e4Smiod@item %hi8 84*3d8817e4Smiod 85*3d8817e4SmiodThis modifier allows you to load bits 16 through 23 of a 24 bit 86*3d8817e4Smiodaddress into an 8 bit register. This is useful with, for example, the 87*3d8817e4SmiodM16C @samp{smovf} instruction, which expects a 20 bit address in 88*3d8817e4Smiod@samp{r1h} and @samp{a0}. Example: 89*3d8817e4Smiod 90*3d8817e4Smiod@smallexample 91*3d8817e4Smiodmov.b #%hi8(sym),r1h 92*3d8817e4Smiodmov.w #%lo16(sym),a0 93*3d8817e4Smiodsmovf.b 94*3d8817e4Smiod@end smallexample 95*3d8817e4Smiod 96*3d8817e4Smiod@item %lo16 97*3d8817e4Smiod 98*3d8817e4SmiodLikewise, this modifier allows you to load bits 0 through 15 of a 24 99*3d8817e4Smiodbit address into a 16 bit register. 100*3d8817e4Smiod 101*3d8817e4Smiod@item %hi16 102*3d8817e4Smiod 103*3d8817e4SmiodThis modifier allows you to load bits 16 through 31 of a 32 bit 104*3d8817e4Smiodaddress into a 16 bit register. While the M32C family only has 24 105*3d8817e4Smiodbits of address space, it does support addresses in pairs of 16 bit 106*3d8817e4Smiodregisters (like @samp{a1a0} for the @samp{lde} instruction). This 107*3d8817e4Smiodmodifier is for loading the upper half in such cases. Example: 108*3d8817e4Smiod 109*3d8817e4Smiod@smallexample 110*3d8817e4Smiodmov.w #%hi16(sym),a1 111*3d8817e4Smiodmov.w #%lo16(sym),a0 112*3d8817e4Smiod@dots{} 113*3d8817e4Smiodlde.w [a1a0],r1 114*3d8817e4Smiod@end smallexample 115*3d8817e4Smiod 116*3d8817e4Smiod@end table 117