c-m32c.texi 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. @c Copyright (C) 2005-2022 Free Software Foundation, Inc.
  2. @c This is part of the GAS manual.
  3. @c For copying conditions, see the file as.texinfo.
  4. @ifset GENERIC
  5. @page
  6. @node M32C-Dependent
  7. @chapter M32C Dependent Features
  8. @end ifset
  9. @ifclear GENERIC
  10. @node Machine Dependencies
  11. @chapter M32C Dependent Features
  12. @end ifclear
  13. @cindex M32C support
  14. @code{@value{AS}} can assemble code for several different members of
  15. the Renesas M32C family. Normally the default is to assemble code for
  16. the M16C microprocessor. The @code{-m32c} option may be used to
  17. change the default to the M32C microprocessor.
  18. @menu
  19. * M32C-Opts:: M32C Options
  20. * M32C-Syntax:: M32C Syntax
  21. @end menu
  22. @node M32C-Opts
  23. @section M32C Options
  24. @cindex options, M32C
  25. @cindex M32C options
  26. The Renesas M32C version of @code{@value{AS}} has these
  27. machine-dependent options:
  28. @table @code
  29. @item -m32c
  30. @cindex @samp{-m32c} option, M32C
  31. @cindex architecture options, M32C
  32. @cindex M32C architecture option
  33. Assemble M32C instructions.
  34. @item -m16c
  35. @cindex @samp{-m16c} option, M16C
  36. @cindex architecture options, M16C
  37. @cindex M16C architecture option
  38. Assemble M16C instructions (default).
  39. @item -relax
  40. Enable support for link-time relaxations.
  41. @item -h-tick-hex
  42. Support H'00 style hex constants in addition to 0x00 style.
  43. @end table
  44. @node M32C-Syntax
  45. @section M32C Syntax
  46. @menu
  47. * M32C-Modifiers:: Symbolic Operand Modifiers
  48. * M32C-Chars:: Special Characters
  49. @end menu
  50. @node M32C-Modifiers
  51. @subsection Symbolic Operand Modifiers
  52. @cindex M32C modifiers
  53. @cindex modifiers, M32C
  54. The assembler supports several modifiers when using symbol addresses
  55. in M32C instruction operands. The general syntax is the following:
  56. @smallexample
  57. %modifier(symbol)
  58. @end smallexample
  59. @table @code
  60. @cindex symbol modifiers
  61. @item %dsp8
  62. @itemx %dsp16
  63. These modifiers override the assembler's assumptions about how big a
  64. symbol's address is. Normally, when it sees an operand like
  65. @samp{sym[a0]} it assumes @samp{sym} may require the widest
  66. displacement field (16 bits for @samp{-m16c}, 24 bits for
  67. @samp{-m32c}). These modifiers tell it to assume the address will fit
  68. in an 8 or 16 bit (respectively) unsigned displacement. Note that, of
  69. course, if it doesn't actually fit you will get linker errors. Example:
  70. @smallexample
  71. mov.w %dsp8(sym)[a0],r1
  72. mov.b #0,%dsp8(sym)[a0]
  73. @end smallexample
  74. @item %hi8
  75. This modifier allows you to load bits 16 through 23 of a 24 bit
  76. address into an 8 bit register. This is useful with, for example, the
  77. M16C @samp{smovf} instruction, which expects a 20 bit address in
  78. @samp{r1h} and @samp{a0}. Example:
  79. @smallexample
  80. mov.b #%hi8(sym),r1h
  81. mov.w #%lo16(sym),a0
  82. smovf.b
  83. @end smallexample
  84. @item %lo16
  85. Likewise, this modifier allows you to load bits 0 through 15 of a 24
  86. bit address into a 16 bit register.
  87. @item %hi16
  88. This modifier allows you to load bits 16 through 31 of a 32 bit
  89. address into a 16 bit register. While the M32C family only has 24
  90. bits of address space, it does support addresses in pairs of 16 bit
  91. registers (like @samp{a1a0} for the @samp{lde} instruction). This
  92. modifier is for loading the upper half in such cases. Example:
  93. @smallexample
  94. mov.w #%hi16(sym),a1
  95. mov.w #%lo16(sym),a0
  96. @dots{}
  97. lde.w [a1a0],r1
  98. @end smallexample
  99. @end table
  100. @node M32C-Chars
  101. @subsection Special Characters
  102. @cindex line comment character, M32C
  103. @cindex M32C line comment character
  104. The presence of a @samp{;} character on a line indicates the start of
  105. a comment that extends to the end of that line.
  106. If a @samp{#} appears as the first character of a line, the whole line
  107. is treated as a comment, but in this case the line can also be a
  108. logical line number directive (@pxref{Comments}) or a
  109. preprocessor control command (@pxref{Preprocessing}).
  110. @cindex line separator, M32C
  111. @cindex statement separator, M32C
  112. @cindex M32C line separator
  113. The @samp{|} character can be used to separate statements on the same
  114. line.