1 @c Copyright (C) 2018-2019 Free Software Foundation, Inc.
2 @c This is part of the GAS manual.
3 @c For copying conditions, see the file as.texinfo.
7 @chapter S12Z Dependent Features
10 @node Machine Dependencies
11 @chapter S12Z Dependent Features
14 The Freescale S12Z version of @code{@value{AS}} has a few machine
19 * S12Z-Opts:: S12Z Options
20 * S12Z-Syntax:: Syntax
21 * S12Z-Directives:: Assembler Directives
22 * S12Z-Opcodes:: Opcodes
31 The S12Z version of @code{@value{AS}} has the following options:
33 @cindex @samp{-mreg-prefix=@var{prefix}} option, reg-prefix
34 You can use the @samp{-mreg-prefix=@var{pfx}} option to indicate
35 that the assembler expects each register name to be prefixed with the
38 For an explanation of what this means and why it might be needed,
39 see @ref{Register Notation}.
46 * Register Notation:: How to refer to registers
53 In the S12Z syntax, the instruction name comes first and it may
54 be followed by one or by several operands.
55 In most cases the maximum number of operands is three.
56 Some instructions accept and (in certain situations require) a suffix
57 indicating the size of the operand.
58 The suffix is separated from the instruction name by a period (@samp{.})
59 and may be one of @samp{b}, @samp{w}, @samp{p} or @samp{l} indicating
60 `byte' (a single byte), `word' (2 bytes), `pointer' (3 bytes) or `long' (4 bytes)
62 Operands are separated by a comma (@samp{,}).
63 A comma however does not act as a separator if it appears within parentheses
64 (@samp{()}) or within square brackets (@samp{[]}).
65 @code{@value{AS}} will complain if too many, too few or inappropriate operands
66 are specified for a given instruction.
67 The MRI mode is not supported for this architecture.
82 @cindex line comment character, S12Z
83 @cindex S12Z line comment character
84 The presence of a @samp{;} character anywhere
85 on a line indicates the start of a comment that extends to the end of
88 A @samp{*} or a @samp{#} character at the start of a line also
89 introduces a line comment, but these characters do not work elsewhere
90 on the line. If the first character of the line is a @samp{#} then as
91 well as starting a comment, the line could also be logical line number
92 directive (@pxref{Comments}) or a preprocessor control command
93 (@pxref{Preprocessing}).
95 @cindex line separator, S12Z
96 @cindex statement separator, S12Z
97 @cindex S12Z line separator
98 The S12Z assembler does not currently support a line separator
101 @cindex S12Z addressing modes
102 @cindex addressing modes, S12Z
103 The following addressing modes are understood for the S12Z.
108 @item Immediate Bit Field
109 @samp{#@var{width}:@var{offset}}
111 Bit field instructions in the immediate mode require the width and offset to
113 The @var{width} pararmeter specifies the number of bits in the field.
114 It should be a number in the range [1,32].
115 @var{Offset} determines the position within the field where the operation
117 It should be a number in the range [0,31].
120 @samp{*@var{symbol}}, or @samp{*[+-]@var{digits}}
122 Program counter relative addresses have a width of 15 bits.
123 Thus, they must be within the range [-32768, 32767].
128 @cindex register names, S12Z
129 Some instructions accept a register as an operand.
130 In general, @var{reg} may be a
131 data register (@samp{D0}, @samp{D1} @dots{} @samp{D7}),
132 the @samp{X} register or the @samp{Y} register.
134 A few instructions accept as an argument the stack pointer
135 register (@samp{S}), and/or the program counter (@samp{P}).
137 Some very special instructions accept arguments which refer to the
138 condition code register. For these arguments the syntax is
139 @samp{CCR}, @samp{CCH} or @samp{CCL} which refer to the complete
140 condition code register, the condition code register high byte
141 and the condition code register low byte respectively.
144 @item Absolute Direct
145 @samp{@var{symbol}}, or @samp{@var{digits}}
147 @item Absolute Indirect
148 @samp{[@var{symbol}}, or @samp{@var{digits}]}
151 @item Constant Offset Indexed
152 @samp{(@var{number},@var{reg})}
154 @var{Reg} may be either @samp{X}, @samp{Y}, @samp{S} or
155 @samp{P} or one of the data registers @samp{D0}, @samp{D1} @dots{}
157 If any of the registers @samp{D2} @dots{} @samp{D5} are specified, then the
158 register value is treated as a signed value.
159 Otherwise it is treated as unsigned.
160 @var{Number} may be any integer in the range [-8388608,8388607].
162 @item Offset Indexed Indirect
163 @samp{[@var{number},@var{reg}]}
165 @var{Reg} may be either @samp{X}, @samp{Y}, @samp{S} or
167 @var{Number} may be any integer in the range [-8388608,8388607].
169 @item Auto Pre-Increment/Pre-Decrement/Post-Increment/Post-Decrement
175 This addressing mode is typically used to access a value at an address,
176 and simultaneously to increment/decrement the register pointing to that
178 Thus @var{reg} may be any of the 24 bit registers @samp{X}, @samp{Y}, or
180 Pre-increment and post-decrement are not available for
181 register @samp{S} (only post-increment and pre-decrement are available).
183 @item Register Offset Direct
184 @samp{(@var{data-reg},@var{reg})}
186 @var{Reg} can be either @samp{X}, @samp{Y}, or @samp{S}.
188 must be one of the data registers @samp{D0}, @samp{D1} @dots{} @samp{D7}.
189 If any of the registers @samp{D2} @dots{} @samp{D5} are specified, then
190 the register value is treated as a signed value.
191 Otherwise it is treated as unsigned.
193 @item Register Offset Indirect
194 @samp{[@var{data-reg},@var{reg}]}
196 @var{Reg} can be either @samp{X} or @samp{Y}.
198 must be one of the data registers @samp{D0}, @samp{D1} @dots{} @samp{D7}.
199 If any of the registers @samp{D2} @dots{} @samp{D5} are specified, then
200 the register value is treated as a signed value.
201 Otherwise it is treated as unsigned.
221 @node Register Notation
222 @subsection Register Notation
224 @cindex register notation, S12Z
225 Without a register prefix (@pxref{S12Z-Opts}), S12Z assembler code is expected in the traditional
236 However, if @code{@value{AS}} is started with (for example) @samp{-mreg-prefix=%}
237 then all register names must be prefixed with @samp{%} as follows:
246 The register prefix feature is intended to be used by compilers
247 to avoid ambiguity between symbols and register names.
248 Consider the following assembler instruction:
253 This instruction is most likely to
254 mean ``Store the value in the register D0 into the register D1'' and that is the
255 default way in which @code{@value{AS}} interprets it.
256 However it could also be intended to mean
257 ``Store the value in the register D0 into the memory referenced by the symbol
259 If that is what is intended then @code{@value{AS}} must be invoked with
260 @samp{-mreg-prefix=@var{pfx}} and the code written as
265 where @var{pfx} is the chosen register prefix.
266 For this reason, compiler back-ends should choose a register prefix which
267 cannot be confused with a symbol name.
270 @node S12Z-Directives
271 @section Assembler Directives
273 @cindex assembler directives, S12Z
279 @cindex opcodes, S12Z
280 @cindex instruction set, S12Z