1@c Copyright (C) 2007-2016 Free Software Foundation, Inc.
2@c This is part of the GAS manual.
3@c For copying conditions, see the file as.texinfo.
4
5@ifset GENERIC
6@page
7@node CR16-Dependent
8@chapter CR16 Dependent Features
9@end ifset
10@ifclear GENERIC
11@node Machine Dependencies
12@chapter CR16 Dependent Features
13@end ifclear
14
15@cindex CR16 support
16@menu
17* CR16 Operand Qualifiers::     CR16 Machine Operand Qualifiers
18* CR16 Syntax::                 Syntax for the CR16
19@end menu
20
21@node CR16 Operand Qualifiers
22@section CR16 Operand Qualifiers
23@cindex CR16 Operand Qualifiers
24
25The National Semiconductor CR16 target of @code{@value{AS}} has a few machine dependent operand qualifiers.
26
27Operand expression type qualifier is an optional field in the instruction operand, to determines the type of the expression field of an operand. The @code{@@} is required. CR16 architecture uses one of the following expression qualifiers:
28
29@table @code
30@item  s
31- @code{Specifies expression operand type as small}
32@item  m
33- @code{Specifies expression operand type as medium}
34@item  l
35- @code{Specifies expression operand type as large}
36@item  c
37- @code{Specifies the CR16 Assembler generates a relocation entry for the operand, where pc has implied bit, the expression is adjusted accordingly. The linker uses the relocation entry to update the operand address at link time.}
38@item  got/GOT
39- @code{Specifies the CR16 Assembler generates a relocation entry for the operand, offset from Global Offset Table. The linker uses this relocation entry to update the operand address at link time}
40@item  cgot/cGOT
41- @code{Specifies the CompactRISC Assembler generates a relocation entry for the operand, where pc has implied bit, the expression is adjusted accordingly. The linker uses the relocation entry to update the operand address at link time.}
42@end table
43
44CR16 target operand qualifiers and its size (in bits):
45
46@table @samp
47@item Immediate Operand: s
484 bits.
49
50@item Immediate Operand: m
5116 bits, for movb and movw instructions.
52
53@item Immediate Operand: m
5420 bits, movd instructions.
55
56@item Immediate Operand: l
5732 bits.
58
59@item Absolute Operand: s
60Illegal specifier for this operand.
61
62@item Absolute Operand: m
6320 bits, movd instructions.
64
65@item Displacement Operand: s
668 bits.
67
68@item Displacement Operand: m
6916 bits.
70
71@item Displacement Operand: l
7224 bits.
73
74@end table
75
76For example:
77@example
781   @code{movw $_myfun@@c,r1}
79
80    This loads the address of _myfun, shifted right by 1, into r1.
81
822   @code{movd $_myfun@@c,(r2,r1)}
83
84    This loads the address of _myfun, shifted right by 1, into register-pair r2-r1.
85
863   @code{_myfun_ptr:}
87    @code{.long _myfun@@c}
88    @code{loadd _myfun_ptr, (r1,r0)}
89    @code{jal (r1,r0)}
90
91    This .long directive, the address of _myfunc, shifted right by 1 at link time.
92
934   @code{loadd  _data1@@GOT(r12), (r1,r0)}
94
95    This loads the address of _data1, into global offset table (ie GOT) and its offset value from GOT loads into register-pair r2-r1.
96
975   @code{loadd  _myfunc@@cGOT(r12), (r1,r0)}
98
99    This loads the address of _myfun, shifted right by 1, into global offset table (ie GOT) and its offset value from GOT loads into register-pair r1-r0.
100@end example
101
102@node CR16 Syntax
103@section CR16 Syntax
104@menu
105* CR16-Chars::                Special Characters
106@end menu
107
108@node CR16-Chars
109@subsection Special Characters
110
111@cindex line comment character, CR16
112@cindex CR16 line comment character
113The presence of a @samp{#} on a line indicates the start of a comment
114that extends to the end of the current line.  If the @samp{#} appears
115as the first character of a line, the whole line is treated as a
116comment, but in this case the line can also be a logical line number
117directive (@pxref{Comments}) or a preprocessor control command
118(@pxref{Preprocessing}).
119
120@cindex line separator, CR16
121@cindex statement separator, CR16
122@cindex CR16 line separator
123The @samp{;} character can be used to separate statements on the same
124line.
125