c-tic54x.texi 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. @c Copyright (C) 2000-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. @c TI TMS320C54X description by Timothy Wall, twall@cygnus.com
  5. @ifset GENERIC
  6. @page
  7. @node TIC54X-Dependent
  8. @chapter TIC54X Dependent Features
  9. @end ifset
  10. @ifclear GENERIC
  11. @node Machine Dependencies
  12. @chapter TIC54X Dependent Features
  13. @end ifclear
  14. @cindex TIC54X support
  15. @menu
  16. * TIC54X-Opts:: Command-line Options
  17. * TIC54X-Block:: Blocking
  18. * TIC54X-Env:: Environment Settings
  19. * TIC54X-Constants:: Constants Syntax
  20. * TIC54X-Subsyms:: String Substitution
  21. * TIC54X-Locals:: Local Label Syntax
  22. * TIC54X-Builtins:: Builtin Assembler Math Functions
  23. * TIC54X-Ext:: Extended Addressing Support
  24. * TIC54X-Directives:: Directives
  25. * TIC54X-Macros:: Macro Features
  26. * TIC54X-MMRegs:: Memory-mapped Registers
  27. * TIC54X-Syntax:: Syntax
  28. @end menu
  29. @node TIC54X-Opts
  30. @section Options
  31. @cindex options, TIC54X
  32. @cindex TIC54X options
  33. The TMS320C54X version of @code{@value{AS}} has a few machine-dependent options.
  34. @cindex @samp{-mfar-mode} option, far-mode
  35. @cindex @samp{-mf} option, far-mode
  36. You can use the @samp{-mfar-mode} option to enable extended addressing mode.
  37. All addresses will be assumed to be > 16 bits, and the appropriate
  38. relocation types will be used. This option is equivalent to using the
  39. @samp{.far_mode} directive in the assembly code. If you do not use the
  40. @samp{-mfar-mode} option, all references will be assumed to be 16 bits.
  41. This option may be abbreviated to @samp{-mf}.
  42. @cindex @samp{-mcpu} option, cpu
  43. You can use the @samp{-mcpu} option to specify a particular CPU.
  44. This option is equivalent to using the @samp{.version} directive in the
  45. assembly code. For recognized CPU codes, see
  46. @xref{TIC54X-Directives,,@code{.version}}. The default CPU version is
  47. @samp{542}.
  48. @cindex @samp{-merrors-to-file} option, stderr redirect
  49. @cindex @samp{-me} option, stderr redirect
  50. You can use the @samp{-merrors-to-file} option to redirect error output
  51. to a file (this provided for those deficient environments which don't
  52. provide adequate output redirection). This option may be abbreviated to
  53. @samp{-me}.
  54. @node TIC54X-Block
  55. @section Blocking
  56. A blocked section or memory block is guaranteed not to cross the blocking
  57. boundary (usually a page, or 128 words) if it is smaller than the
  58. blocking size, or to start on a page boundary if it is larger than the
  59. blocking size.
  60. @node TIC54X-Env
  61. @section Environment Settings
  62. @cindex environment settings, TIC54X
  63. @cindex @samp{A_DIR} environment variable, TIC54X
  64. @cindex @samp{C54XDSP_DIR} environment variable, TIC54X
  65. @samp{C54XDSP_DIR} and @samp{A_DIR} are semicolon-separated
  66. paths which are added to the list of directories normally searched for
  67. source and include files. @samp{C54XDSP_DIR} will override @samp{A_DIR}.
  68. @node TIC54X-Constants
  69. @section Constants Syntax
  70. @cindex constants, TIC54X
  71. The TIC54X version of @code{@value{AS}} allows the following additional
  72. constant formats, using a suffix to indicate the radix:
  73. @smallexample
  74. @cindex binary constants, TIC54X
  75. Binary @code{000000B, 011000b}
  76. Octal @code{10Q, 224q}
  77. Hexadecimal @code{45h, 0FH}
  78. @end smallexample
  79. @node TIC54X-Subsyms
  80. @section String Substitution
  81. A subset of allowable symbols (which we'll call subsyms) may be assigned
  82. arbitrary string values. This is roughly equivalent to C preprocessor
  83. #define macros. When @code{@value{AS}} encounters one of these
  84. symbols, the symbol is replaced in the input stream by its string value.
  85. Subsym names @strong{must} begin with a letter.
  86. Subsyms may be defined using the @code{.asg} and @code{.eval} directives
  87. (@xref{TIC54X-Directives,,@code{.asg}},
  88. @xref{TIC54X-Directives,,@code{.eval}}.
  89. Expansion is recursive until a previously encountered symbol is seen, at
  90. which point substitution stops.
  91. In this example, x is replaced with SYM2; SYM2 is replaced with SYM1, and SYM1
  92. is replaced with x. At this point, x has already been encountered
  93. and the substitution stops.
  94. @smallexample
  95. .asg "x",SYM1
  96. .asg "SYM1",SYM2
  97. .asg "SYM2",x
  98. add x,a ; final code assembled is "add x, a"
  99. @end smallexample
  100. Macro parameters are converted to subsyms; a side effect of this is the normal
  101. @code{@value{AS}} '\ARG' dereferencing syntax is unnecessary. Subsyms
  102. defined within a macro will have global scope, unless the @code{.var}
  103. directive is used to identify the subsym as a local macro variable
  104. @pxref{TIC54X-Directives,,@code{.var}}.
  105. Substitution may be forced in situations where replacement might be
  106. ambiguous by placing colons on either side of the subsym. The following
  107. code:
  108. @smallexample
  109. .eval "10",x
  110. LAB:X: add #x, a
  111. @end smallexample
  112. When assembled becomes:
  113. @smallexample
  114. LAB10 add #10, a
  115. @end smallexample
  116. Smaller parts of the string assigned to a subsym may be accessed with
  117. the following syntax:
  118. @table @code
  119. @item @code{:@var{symbol}(@var{char_index}):}
  120. Evaluates to a single-character string, the character at @var{char_index}.
  121. @item @code{:@var{symbol}(@var{start},@var{length}):}
  122. Evaluates to a substring of @var{symbol} beginning at @var{start} with
  123. length @var{length}.
  124. @end table
  125. @node TIC54X-Locals
  126. @section Local Labels
  127. Local labels may be defined in two ways:
  128. @itemize @bullet
  129. @item
  130. $N, where N is a decimal number between 0 and 9
  131. @item
  132. LABEL?, where LABEL is any legal symbol name.
  133. @end itemize
  134. Local labels thus defined may be redefined or automatically generated.
  135. The scope of a local label is based on when it may be undefined or reset.
  136. This happens when one of the following situations is encountered:
  137. @itemize @bullet
  138. @item
  139. .newblock directive @pxref{TIC54X-Directives,,@code{.newblock}}
  140. @item
  141. The current section is changed (.sect, .text, or .data)
  142. @item
  143. Entering or leaving an included file
  144. @item
  145. The macro scope where the label was defined is exited
  146. @end itemize
  147. @node TIC54X-Builtins
  148. @section Math Builtins
  149. @cindex math builtins, TIC54X
  150. @cindex TIC54X builtin math functions
  151. @cindex builtin math functions, TIC54X
  152. The following built-in functions may be used to generate a
  153. floating-point value. All return a floating-point value except
  154. @samp{$cvi}, @samp{$int}, and @samp{$sgn}, which return an integer
  155. value.
  156. @table @code
  157. @cindex @code{$acos} math builtin, TIC54X
  158. @item @code{$acos(@var{expr})}
  159. Returns the floating point arccosine of @var{expr}.
  160. @cindex @code{$asin} math builtin, TIC54X
  161. @item @code{$asin(@var{expr})}
  162. Returns the floating point arcsine of @var{expr}.
  163. @cindex @code{$atan} math builtin, TIC54X
  164. @item @code{$atan(@var{expr})}
  165. Returns the floating point arctangent of @var{expr}.
  166. @cindex @code{$atan2} math builtin, TIC54X
  167. @item @code{$atan2(@var{expr1},@var{expr2})}
  168. Returns the floating point arctangent of @var{expr1} / @var{expr2}.
  169. @cindex @code{$ceil} math builtin, TIC54X
  170. @item @code{$ceil(@var{expr})}
  171. Returns the smallest integer not less than @var{expr} as floating point.
  172. @cindex @code{$cosh} math builtin, TIC54X
  173. @item @code{$cosh(@var{expr})}
  174. Returns the floating point hyperbolic cosine of @var{expr}.
  175. @cindex @code{$cos} math builtin, TIC54X
  176. @item @code{$cos(@var{expr})}
  177. Returns the floating point cosine of @var{expr}.
  178. @cindex @code{$cvf} math builtin, TIC54X
  179. @item @code{$cvf(@var{expr})}
  180. Returns the integer value @var{expr} converted to floating-point.
  181. @cindex @code{$cvi} math builtin, TIC54X
  182. @item @code{$cvi(@var{expr})}
  183. Returns the floating point value @var{expr} converted to integer.
  184. @cindex @code{$exp} math builtin, TIC54X
  185. @item @code{$exp(@var{expr})}
  186. Returns the floating point value e ^ @var{expr}.
  187. @cindex @code{$fabs} math builtin, TIC54X
  188. @item @code{$fabs(@var{expr})}
  189. Returns the floating point absolute value of @var{expr}.
  190. @cindex @code{$floor} math builtin, TIC54X
  191. @item @code{$floor(@var{expr})}
  192. Returns the largest integer that is not greater than @var{expr} as
  193. floating point.
  194. @cindex @code{$fmod} math builtin, TIC54X
  195. @item @code{$fmod(@var{expr1},@var{expr2})}
  196. Returns the floating point remainder of @var{expr1} / @var{expr2}.
  197. @cindex @code{$int} math builtin, TIC54X
  198. @item @code{$int(@var{expr})}
  199. Returns 1 if @var{expr} evaluates to an integer, zero otherwise.
  200. @cindex @code{$ldexp} math builtin, TIC54X
  201. @item @code{$ldexp(@var{expr1},@var{expr2})}
  202. Returns the floating point value @var{expr1} * 2 ^ @var{expr2}.
  203. @cindex @code{$log10} math builtin, TIC54X
  204. @item @code{$log10(@var{expr})}
  205. Returns the base 10 logarithm of @var{expr}.
  206. @cindex @code{$log} math builtin, TIC54X
  207. @item @code{$log(@var{expr})}
  208. Returns the natural logarithm of @var{expr}.
  209. @cindex @code{$max} math builtin, TIC54X
  210. @item @code{$max(@var{expr1},@var{expr2})}
  211. Returns the floating point maximum of @var{expr1} and @var{expr2}.
  212. @cindex @code{$min} math builtin, TIC54X
  213. @item @code{$min(@var{expr1},@var{expr2})}
  214. Returns the floating point minimum of @var{expr1} and @var{expr2}.
  215. @cindex @code{$pow} math builtin, TIC54X
  216. @item @code{$pow(@var{expr1},@var{expr2})}
  217. Returns the floating point value @var{expr1} ^ @var{expr2}.
  218. @cindex @code{$round} math builtin, TIC54X
  219. @item @code{$round(@var{expr})}
  220. Returns the nearest integer to @var{expr} as a floating point number.
  221. @cindex @code{$sgn} math builtin, TIC54X
  222. @item @code{$sgn(@var{expr})}
  223. Returns -1, 0, or 1 based on the sign of @var{expr}.
  224. @cindex @code{$sin} math builtin, TIC54X
  225. @item @code{$sin(@var{expr})}
  226. Returns the floating point sine of @var{expr}.
  227. @cindex @code{$sinh} math builtin, TIC54X
  228. @item @code{$sinh(@var{expr})}
  229. Returns the floating point hyperbolic sine of @var{expr}.
  230. @cindex @code{$sqrt} math builtin, TIC54X
  231. @item @code{$sqrt(@var{expr})}
  232. Returns the floating point square root of @var{expr}.
  233. @cindex @code{$tan} math builtin, TIC54X
  234. @item @code{$tan(@var{expr})}
  235. Returns the floating point tangent of @var{expr}.
  236. @cindex @code{$tanh} math builtin, TIC54X
  237. @item @code{$tanh(@var{expr})}
  238. Returns the floating point hyperbolic tangent of @var{expr}.
  239. @cindex @code{$trunc} math builtin, TIC54X
  240. @item @code{$trunc(@var{expr})}
  241. Returns the integer value of @var{expr} truncated towards zero as
  242. floating point.
  243. @end table
  244. @node TIC54X-Ext
  245. @section Extended Addressing
  246. The @code{LDX} pseudo-op is provided for loading the extended addressing bits
  247. of a label or address. For example, if an address @code{_label} resides
  248. in extended program memory, the value of @code{_label} may be loaded as
  249. follows:
  250. @smallexample
  251. ldx #_label,16,a ; loads extended bits of _label
  252. or #_label,a ; loads lower 16 bits of _label
  253. bacc a ; full address is in accumulator A
  254. @end smallexample
  255. @node TIC54X-Directives
  256. @section Directives
  257. @cindex machine directives, TIC54X
  258. @cindex TIC54X machine directives
  259. @table @code
  260. @cindex @code{align} directive, TIC54X
  261. @cindex @code{even} directive, TIC54X
  262. @item .align [@var{size}]
  263. @itemx .even
  264. Align the section program counter on the next boundary, based on
  265. @var{size}. @var{size} may be any power of 2. @code{.even} is
  266. equivalent to @code{.align} with a @var{size} of 2.
  267. @table @code
  268. @item 1
  269. Align SPC to word boundary
  270. @item 2
  271. Align SPC to longword boundary (same as .even)
  272. @item 128
  273. Align SPC to page boundary
  274. @end table
  275. @cindex @code{asg} directive, TIC54X
  276. @item .asg @var{string}, @var{name}
  277. Assign @var{name} the string @var{string}. String replacement is
  278. performed on @var{string} before assignment.
  279. @cindex @code{eval} directive, TIC54X
  280. @item .eval @var{string}, @var{name}
  281. Evaluate the contents of string @var{string} and assign the result as a
  282. string to the subsym @var{name}. String replacement is performed on
  283. @var{string} before assignment.
  284. @cindex @code{bss} directive, TIC54X
  285. @item .bss @var{symbol}, @var{size} [, [@var{blocking_flag}] [,@var{alignment_flag}]]
  286. Reserve space for @var{symbol} in the .bss section. @var{size} is in
  287. words. If present, @var{blocking_flag} indicates the allocated space
  288. should be aligned on a page boundary if it would otherwise cross a page
  289. boundary. If present, @var{alignment_flag} causes the assembler to
  290. allocate @var{size} on a long word boundary.
  291. @cindex @code{byte} directive, TIC54X
  292. @cindex @code{ubyte} directive, TIC54X
  293. @cindex @code{char} directive, TIC54X
  294. @cindex @code{uchar} directive, TIC54X
  295. @item .byte @var{value} [,...,@var{value_n}]
  296. @itemx .ubyte @var{value} [,...,@var{value_n}]
  297. @itemx .char @var{value} [,...,@var{value_n}]
  298. @itemx .uchar @var{value} [,...,@var{value_n}]
  299. Place one or more bytes into consecutive words of the current section.
  300. The upper 8 bits of each word is zero-filled. If a label is used, it
  301. points to the word allocated for the first byte encountered.
  302. @cindex @code{clink} directive, TIC54X
  303. @item .clink ["@var{section_name}"]
  304. Set STYP_CLINK flag for this section, which indicates to the linker that
  305. if no symbols from this section are referenced, the section should not
  306. be included in the link. If @var{section_name} is omitted, the current
  307. section is used.
  308. @cindex @code{c_mode} directive, TIC54X
  309. @item .c_mode
  310. TBD.
  311. @cindex @code{copy} directive, TIC54X
  312. @item .copy "@var{filename}" | @var{filename}
  313. @itemx .include "@var{filename}" | @var{filename}
  314. Read source statements from @var{filename}. The normal include search
  315. path is used. Normally .copy will cause statements from the included
  316. file to be printed in the assembly listing and .include will not, but
  317. this distinction is not currently implemented.
  318. @cindex @code{data} directive, TIC54X
  319. @item .data
  320. Begin assembling code into the .data section.
  321. @cindex @code{double} directive, TIC54X
  322. @cindex @code{ldouble} directive, TIC54X
  323. @cindex @code{float} directive, TIC54X
  324. @cindex @code{xfloat} directive, TIC54X
  325. @item .double @var{value} [,...,@var{value_n}]
  326. @itemx .ldouble @var{value} [,...,@var{value_n}]
  327. @itemx .float @var{value} [,...,@var{value_n}]
  328. @itemx .xfloat @var{value} [,...,@var{value_n}]
  329. Place an IEEE single-precision floating-point representation of one or
  330. more floating-point values into the current section. All but
  331. @code{.xfloat} align the result on a longword boundary. Values are
  332. stored most-significant word first.
  333. @cindex @code{drlist} directive, TIC54X
  334. @cindex @code{drnolist} directive, TIC54X
  335. @item .drlist
  336. @itemx .drnolist
  337. Control printing of directives to the listing file. Ignored.
  338. @cindex @code{emsg} directive, TIC54X
  339. @cindex @code{mmsg} directive, TIC54X
  340. @cindex @code{wmsg} directive, TIC54X
  341. @item .emsg @var{string}
  342. @itemx .mmsg @var{string}
  343. @itemx .wmsg @var{string}
  344. Emit a user-defined error, message, or warning, respectively.
  345. @cindex @code{far_mode} directive, TIC54X
  346. @item .far_mode
  347. Use extended addressing when assembling statements. This should appear
  348. only once per file, and is equivalent to the -mfar-mode option @pxref{TIC54X-Opts,,@code{-mfar-mode}}.
  349. @cindex @code{fclist} directive, TIC54X
  350. @cindex @code{fcnolist} directive, TIC54X
  351. @item .fclist
  352. @itemx .fcnolist
  353. Control printing of false conditional blocks to the listing file.
  354. @cindex @code{field} directive, TIC54X
  355. @item .field @var{value} [,@var{size}]
  356. Initialize a bitfield of @var{size} bits in the current section. If
  357. @var{value} is relocatable, then @var{size} must be 16. @var{size}
  358. defaults to 16 bits. If @var{value} does not fit into @var{size} bits,
  359. the value will be truncated. Successive @code{.field} directives will
  360. pack starting at the current word, filling the most significant bits
  361. first, and aligning to the start of the next word if the field size does
  362. not fit into the space remaining in the current word. A @code{.align}
  363. directive with an operand of 1 will force the next @code{.field}
  364. directive to begin packing into a new word. If a label is used, it
  365. points to the word that contains the specified field.
  366. @cindex @code{global} directive, TIC54X
  367. @cindex @code{def} directive, TIC54X
  368. @cindex @code{ref} directive, TIC54X
  369. @item .global @var{symbol} [,...,@var{symbol_n}]
  370. @itemx .def @var{symbol} [,...,@var{symbol_n}]
  371. @itemx .ref @var{symbol} [,...,@var{symbol_n}]
  372. @code{.def} nominally identifies a symbol defined in the current file
  373. and available to other files. @code{.ref} identifies a symbol used in
  374. the current file but defined elsewhere. Both map to the standard
  375. @code{.global} directive.
  376. @cindex @code{half} directive, TIC54X
  377. @cindex @code{uhalf} directive, TIC54X
  378. @cindex @code{short} directive, TIC54X
  379. @cindex @code{ushort} directive, TIC54X
  380. @cindex @code{int} directive, TIC54X
  381. @cindex @code{uint} directive, TIC54X
  382. @cindex @code{word} directive, TIC54X
  383. @cindex @code{uword} directive, TIC54X
  384. @item .half @var{value} [,...,@var{value_n}]
  385. @itemx .uhalf @var{value} [,...,@var{value_n}]
  386. @itemx .short @var{value} [,...,@var{value_n}]
  387. @itemx .ushort @var{value} [,...,@var{value_n}]
  388. @itemx .int @var{value} [,...,@var{value_n}]
  389. @itemx .uint @var{value} [,...,@var{value_n}]
  390. @itemx .word @var{value} [,...,@var{value_n}]
  391. @itemx .uword @var{value} [,...,@var{value_n}]
  392. Place one or more values into consecutive words of the current section.
  393. If a label is used, it points to the word allocated for the first value
  394. encountered.
  395. @cindex @code{label} directive, TIC54X
  396. @item .label @var{symbol}
  397. Define a special @var{symbol} to refer to the load time address of the
  398. current section program counter.
  399. @cindex @code{length} directive, TIC54X
  400. @cindex @code{width} directive, TIC54X
  401. @item .length
  402. @itemx .width
  403. Set the page length and width of the output listing file. Ignored.
  404. @cindex @code{list} directive, TIC54X
  405. @cindex @code{nolist} directive, TIC54X
  406. @item .list
  407. @itemx .nolist
  408. Control whether the source listing is printed. Ignored.
  409. @cindex @code{long} directive, TIC54X
  410. @cindex @code{ulong} directive, TIC54X
  411. @cindex @code{xlong} directive, TIC54X
  412. @item .long @var{value} [,...,@var{value_n}]
  413. @itemx .ulong @var{value} [,...,@var{value_n}]
  414. @itemx .xlong @var{value} [,...,@var{value_n}]
  415. Place one or more 32-bit values into consecutive words in the current
  416. section. The most significant word is stored first. @code{.long} and
  417. @code{.ulong} align the result on a longword boundary; @code{xlong} does
  418. not.
  419. @cindex @code{loop} directive, TIC54X
  420. @cindex @code{break} directive, TIC54X
  421. @cindex @code{endloop} directive, TIC54X
  422. @item .loop [@var{count}]
  423. @itemx .break [@var{condition}]
  424. @itemx .endloop
  425. Repeatedly assemble a block of code. @code{.loop} begins the block, and
  426. @code{.endloop} marks its termination. @var{count} defaults to 1024,
  427. and indicates the number of times the block should be repeated.
  428. @code{.break} terminates the loop so that assembly begins after the
  429. @code{.endloop} directive. The optional @var{condition} will cause the
  430. loop to terminate only if it evaluates to zero.
  431. @cindex @code{macro} directive, TIC54X
  432. @cindex @code{endm} directive, TIC54X
  433. @item @var{macro_name} .macro [@var{param1}][,...@var{param_n}]
  434. @itemx [.mexit]
  435. @itemx .endm
  436. See the section on macros for more explanation (@xref{TIC54X-Macros}.
  437. @cindex @code{mlib} directive, TIC54X
  438. @item .mlib "@var{filename}" | @var{filename}
  439. Load the macro library @var{filename}. @var{filename} must be an
  440. archived library (BFD ar-compatible) of text files, expected to contain
  441. only macro definitions. The standard include search path is used.
  442. @cindex @code{mlist} directive, TIC54X
  443. @cindex @code{mnolist} directive, TIC54X
  444. @item .mlist
  445. @itemx .mnolist
  446. Control whether to include macro and loop block expansions in the
  447. listing output. Ignored.
  448. @cindex @code{mmregs} directive, TIC54X
  449. @item .mmregs
  450. Define global symbolic names for the 'c54x registers. Supposedly
  451. equivalent to executing @code{.set} directives for each register with
  452. its memory-mapped value, but in reality is provided only for
  453. compatibility and does nothing.
  454. @cindex @code{newblock} directive, TIC54X
  455. @item .newblock
  456. This directive resets any TIC54X local labels currently defined. Normal
  457. @code{@value{AS}} local labels are unaffected.
  458. @cindex @code{option} directive, TIC54X
  459. @item .option @var{option_list}
  460. Set listing options. Ignored.
  461. @cindex @code{sblock} directive, TIC54X
  462. @item .sblock "@var{section_name}" | @var{section_name} [,"@var{name_n}" | @var{name_n}]
  463. Designate @var{section_name} for blocking. Blocking guarantees that a
  464. section will start on a page boundary (128 words) if it would otherwise
  465. cross a page boundary. Only initialized sections may be designated with
  466. this directive. See also @xref{TIC54X-Block}.
  467. @cindex @code{sect} directive, TIC54X
  468. @item .sect "@var{section_name}"
  469. Define a named initialized section and make it the current section.
  470. @cindex @code{set} directive, TIC54X
  471. @cindex @code{equ} directive, TIC54X
  472. @item @var{symbol} .set "@var{value}"
  473. @itemx @var{symbol} .equ "@var{value}"
  474. Equate a constant @var{value} to a @var{symbol}, which is placed in the
  475. symbol table. @var{symbol} may not be previously defined.
  476. @cindex @code{space} directive, TIC54X
  477. @cindex @code{bes} directive, TIC54X
  478. @item .space @var{size_in_bits}
  479. @itemx .bes @var{size_in_bits}
  480. Reserve the given number of bits in the current section and zero-fill
  481. them. If a label is used with @code{.space}, it points to the
  482. @strong{first} word reserved. With @code{.bes}, the label points to the
  483. @strong{last} word reserved.
  484. @cindex @code{sslist} directive, TIC54X
  485. @cindex @code{ssnolist} directive, TIC54X
  486. @item .sslist
  487. @itemx .ssnolist
  488. Controls the inclusion of subsym replacement in the listing output. Ignored.
  489. @cindex @code{string} directive, TIC54X
  490. @cindex @code{pstring} directive, TIC54X
  491. @item .string "@var{string}" [,...,"@var{string_n}"]
  492. @itemx .pstring "@var{string}" [,...,"@var{string_n}"]
  493. Place 8-bit characters from @var{string} into the current section.
  494. @code{.string} zero-fills the upper 8 bits of each word, while
  495. @code{.pstring} puts two characters into each word, filling the
  496. most-significant bits first. Unused space is zero-filled. If a label
  497. is used, it points to the first word initialized.
  498. @cindex @code{struct} directive, TIC54X
  499. @cindex @code{tag} directive, TIC54X
  500. @cindex @code{endstruct} directive, TIC54X
  501. @item [@var{stag}] .struct [@var{offset}]
  502. @itemx [@var{name_1}] element [@var{count_1}]
  503. @itemx [@var{name_2}] element [@var{count_2}]
  504. @itemx [@var{tname}] .tag @var{stagx} [@var{tcount}]
  505. @itemx ...
  506. @itemx [@var{name_n}] element [@var{count_n}]
  507. @itemx [@var{ssize}] .endstruct
  508. @itemx @var{label} .tag [@var{stag}]
  509. Assign symbolic offsets to the elements of a structure. @var{stag}
  510. defines a symbol to use to reference the structure. @var{offset}
  511. indicates a starting value to use for the first element encountered;
  512. otherwise it defaults to zero. Each element can have a named offset,
  513. @var{name}, which is a symbol assigned the value of the element's offset
  514. into the structure. If @var{stag} is missing, these become global
  515. symbols. @var{count} adjusts the offset that many times, as if
  516. @code{element} were an array. @code{element} may be one of
  517. @code{.byte}, @code{.word}, @code{.long}, @code{.float}, or any
  518. equivalent of those, and the structure offset is adjusted accordingly.
  519. @code{.field} and @code{.string} are also allowed; the size of
  520. @code{.field} is one bit, and @code{.string} is considered to be one
  521. word in size. Only element descriptors, structure/union tags,
  522. @code{.align} and conditional assembly directives are allowed within
  523. @code{.struct}/@code{.endstruct}. @code{.align} aligns member offsets
  524. to word boundaries only. @var{ssize}, if provided, will always be
  525. assigned the size of the structure.
  526. The @code{.tag} directive, in addition to being used to define a
  527. structure/union element within a structure, may be used to apply a
  528. structure to a symbol. Once applied to @var{label}, the individual
  529. structure elements may be applied to @var{label} to produce the desired
  530. offsets using @var{label} as the structure base.
  531. @cindex @code{tab} directive, TIC54X
  532. @item .tab
  533. Set the tab size in the output listing. Ignored.
  534. @cindex @code{union} directive, TIC54X
  535. @cindex @code{tag} directive, TIC54X
  536. @cindex @code{endunion} directive, TIC54X
  537. @item [@var{utag}] .union
  538. @itemx [@var{name_1}] element [@var{count_1}]
  539. @itemx [@var{name_2}] element [@var{count_2}]
  540. @itemx [@var{tname}] .tag @var{utagx}[,@var{tcount}]
  541. @itemx ...
  542. @itemx [@var{name_n}] element [@var{count_n}]
  543. @itemx [@var{usize}] .endstruct
  544. @itemx @var{label} .tag [@var{utag}]
  545. Similar to @code{.struct}, but the offset after each element is reset to
  546. zero, and the @var{usize} is set to the maximum of all defined elements.
  547. Starting offset for the union is always zero.
  548. @cindex @code{usect} directive, TIC54X
  549. @item [@var{symbol}] .usect "@var{section_name}", @var{size}, [,[@var{blocking_flag}] [,@var{alignment_flag}]]
  550. Reserve space for variables in a named, uninitialized section (similar to
  551. .bss). @code{.usect} allows definitions sections independent of .bss.
  552. @var{symbol} points to the first location reserved by this allocation.
  553. The symbol may be used as a variable name. @var{size} is the allocated
  554. size in words. @var{blocking_flag} indicates whether to block this
  555. section on a page boundary (128 words) (@pxref{TIC54X-Block}).
  556. @var{alignment flag} indicates whether the section should be
  557. longword-aligned.
  558. @cindex @code{var} directive, TIC54X
  559. @item .var @var{sym}[,..., @var{sym_n}]
  560. Define a subsym to be a local variable within a macro. See
  561. @xref{TIC54X-Macros}.
  562. @cindex @code{version} directive, TIC54X
  563. @item .version @var{version}
  564. Set which processor to build instructions for. Though the following
  565. values are accepted, the op is ignored.
  566. @table @code
  567. @item 541
  568. @itemx 542
  569. @itemx 543
  570. @itemx 545
  571. @itemx 545LP
  572. @itemx 546LP
  573. @itemx 548
  574. @itemx 549
  575. @end table
  576. @end table
  577. @node TIC54X-Macros
  578. @section Macros
  579. @cindex TIC54X-specific macros
  580. @cindex macros, TIC54X
  581. Macros do not require explicit dereferencing of arguments (i.e., \ARG).
  582. During macro expansion, the macro parameters are converted to subsyms.
  583. If the number of arguments passed the macro invocation exceeds the
  584. number of parameters defined, the last parameter is assigned the string
  585. equivalent of all remaining arguments. If fewer arguments are given
  586. than parameters, the missing parameters are assigned empty strings. To
  587. include a comma in an argument, you must enclose the argument in quotes.
  588. @cindex subsym builtins, TIC54X
  589. @cindex TIC54X subsym builtins
  590. @cindex builtin subsym functions, TIC54X
  591. The following built-in subsym functions allow examination of the string
  592. value of subsyms (or ordinary strings). The arguments are strings
  593. unless otherwise indicated (subsyms passed as args will be replaced by
  594. the strings they represent).
  595. @table @code
  596. @cindex @code{$symlen} subsym builtin, TIC54X
  597. @item @code{$symlen(@var{str})}
  598. Returns the length of @var{str}.
  599. @cindex @code{$symcmp} subsym builtin, TIC54X
  600. @item @code{$symcmp(@var{str1},@var{str2})}
  601. Returns 0 if @var{str1} == @var{str2}, non-zero otherwise.
  602. @cindex @code{$firstch} subsym builtin, TIC54X
  603. @item @code{$firstch(@var{str},@var{ch})}
  604. Returns index of the first occurrence of character constant @var{ch} in
  605. @var{str}.
  606. @cindex @code{$lastch} subsym builtin, TIC54X
  607. @item @code{$lastch(@var{str},@var{ch})}
  608. Returns index of the last occurrence of character constant @var{ch} in
  609. @var{str}.
  610. @cindex @code{$isdefed} subsym builtin, TIC54X
  611. @item @code{$isdefed(@var{symbol})}
  612. Returns zero if the symbol @var{symbol} is not in the symbol table,
  613. non-zero otherwise.
  614. @cindex @code{$ismember} subsym builtin, TIC54X
  615. @item @code{$ismember(@var{symbol},@var{list})}
  616. Assign the first member of comma-separated string @var{list} to
  617. @var{symbol}; @var{list} is reassigned the remainder of the list. Returns
  618. zero if @var{list} is a null string. Both arguments must be subsyms.
  619. @cindex @code{$iscons} subsym builtin, TIC54X
  620. @item @code{$iscons(@var{expr})}
  621. Returns 1 if string @var{expr} is binary, 2 if octal, 3 if hexadecimal,
  622. 4 if a character, 5 if decimal, and zero if not an integer.
  623. @cindex @code{$isname} subsym builtin, TIC54X
  624. @item @code{$isname(@var{name})}
  625. Returns 1 if @var{name} is a valid symbol name, zero otherwise.
  626. @cindex @code{$isreg} subsym builtin, TIC54X
  627. @item @code{$isreg(@var{reg})}
  628. Returns 1 if @var{reg} is a valid predefined register name (AR0-AR7 only).
  629. @cindex @code{$structsz} subsym builtin, TIC54X
  630. @item @code{$structsz(@var{stag})}
  631. Returns the size of the structure or union represented by @var{stag}.
  632. @cindex @code{$structacc} subsym builtin, TIC54X
  633. @item @code{$structacc(@var{stag})}
  634. Returns the reference point of the structure or union represented by
  635. @var{stag}. Always returns zero.
  636. @end table
  637. @node TIC54X-MMRegs
  638. @section Memory-mapped Registers
  639. @cindex TIC54X memory-mapped registers
  640. @cindex registers, TIC54X memory-mapped
  641. @cindex memory-mapped registers, TIC54X
  642. The following symbols are recognized as memory-mapped registers:
  643. @table @code
  644. @end table
  645. @node TIC54X-Syntax
  646. @section TIC54X Syntax
  647. @menu
  648. * TIC54X-Chars:: Special Characters
  649. @end menu
  650. @node TIC54X-Chars
  651. @subsection Special Characters
  652. @cindex line comment character, TIC54X
  653. @cindex TIC54X line comment character
  654. The presence of a @samp{;} appearing anywhere on a line indicates the
  655. start of a comment that extends to the end of that line.
  656. If a @samp{#} appears as the first character of a line then the whole
  657. line is treated as a comment, but in this case the line can also be a
  658. logical line number directive (@pxref{Comments}) or a preprocessor
  659. control command (@pxref{Preprocessing}).
  660. The presence of an asterisk (@samp{*}) at the start of a line also
  661. indicates a comment that extends to the end of that line.
  662. @cindex line separator, TIC54X
  663. @cindex statement separator, TIC54X
  664. @cindex TIC54X line separator
  665. The TIC54X assembler does not currently support a line separator
  666. character.