home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / RiscOS / APP / DEVS / C / QSYSTE.ZIP / !QSystem / docs / qas / qas.man < prev   
Text File  |  1998-02-07  |  7KB  |  277 lines

  1. NAME
  2.  
  3. qas - Assembler, producing QObject files.
  4. version 2.10
  5. Sat 07th February 1998
  6.  
  7.  
  8. SYNOPSIS
  9.  
  10. qas [option|file]...
  11.  
  12.  
  13. DESCRIPTION
  14.  
  15. qas takes one or more assembler source files and assembles them, producing QObject version 2 files.
  16.  
  17. qas is called with a set of options, plus a list of source files, which by convention are stored in a subdirectory named 's'. If there are no arguments, qas prints a message summarizing its options on the standard error.
  18.  
  19. If more than one source file is specified, qas places the resulting QObject files in a directory 'Q', with names of the files the same as the source filenames.
  20. If only one source file is specified, the default naming scheme is used, however the output filename may be overriden using the -o name option.
  21.  
  22. Options for qas are as follows:-
  23.  
  24. -limit n    Set the error limit to n.
  25. -o filename    Name the output file if only one source file is specified.
  26. -throwback    Use throwback to report errors instead of stderr.
  27. -v        Verbose.
  28. -w        Suppress all warnings.
  29. -p        Pedantic - allow extra informationals and warnings.
  30.  
  31. The `parent object file' name is set to be the filename as given on the command line, without modification.
  32.  
  33.  
  34. ASSEMBLER SOURCE FORMAT
  35.  
  36. Comments begin with a ';' and run to the end of the line.
  37.  
  38. Labels are placed at the beginning of the line; local labels begin with '.'. Labels may end with : and may be quoted with '|'.
  39. eg
  40.  
  41. label
  42. |label|
  43. label:
  44. |label|:
  45. .label
  46. |.label|
  47. .label:
  48. |.label|:
  49.  
  50. Mnemonics are indented by at least one whitespace character; standard ARM, CP and FP mnemonics apply; use either upper- or lowercase. See later for accepted mnemonics.
  51.  
  52. Note that where a register is required, a register must be used, rather than simply a number; define registers using RN:, FN: or CN: (see below).
  53.  
  54. If an instruction cannot be assembled due to a large constant, qas will try to expand it into several instructions. Use the TEMP: switch (see below) to control expansion of some instructions; other instructions can be expanded without a temporary register.
  55.  
  56. Expressions are as per C; thus hex numbers are prefixed by `0x' not `&', since & is the bitwise AND operator. Strings are enclosed within double quotes; escape characters may be used such as \n, although \xnn and \0nn are not supported (although \0 is). Character constants may be used in place of integers, use single quotes.
  57.  
  58. Floating point constants are 0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0. Values 0, 1, 2 etc are not acceptable.
  59.  
  60. Switches are also indented, and are terminated with a ':'. Switches take zero or more parameters.
  61.  
  62. Available switches are:-
  63.     CREATOR:    "string"
  64.     PLATFORM:    "string"
  65.     GET:        "file"
  66.     SEGMENT:    CODE|BSS|DATA|LIT
  67.     EXPORT:        symbolname
  68.     WITHIN:        symbolname
  69.     RN:        string    integer(0..15)
  70.     FN:        string    integer(0..7)
  71.     CN:        string    integer(0..15)
  72.     SET:        string    value    
  73.     LINE:        integer
  74.     BLOCK:        integer
  75.     MSG:        "string"
  76.     TEMP:        register|STACK|NONE
  77.     ERROR:        "string"
  78.  
  79. Notes:
  80. 1) Symbols have their segment set as the last SEGMENT: switch. SEGMENT: will end a symbol.
  81.  
  82. 2) EXPORT: makes a symbol visible to all files rather than static.
  83.  
  84. 3) LINE: will rarely be used by programmers; it is intended to allow use of a macro pre-processor.
  85.  
  86. 4) CREATOR: and PLATFORM: set strings within the object file produced; see a description of the QObject file format.
  87.  
  88. 5) GET: includes a file in a similar way to #include "file" by cpp.
  89.  
  90. 6) The segments defined by SEGMENT: are:-
  91.     CODE    executable code; read only
  92.     BSS    uninitialized variables; read/write
  93.     DATA    initialized variables; read/write
  94.     LIT    constants ; read only
  95. see a description of the QObject file format for more details.
  96.  
  97. 7) WITHIN: defines a symbol within a symbol; in other words it exports a local label. For example:-
  98.  
  99.     SEGMENT:    CODE
  100.     EXPORT:        exportSymbol
  101.     EXPORT:        exportSymbol2
  102.  
  103. aSymbol
  104.     <some mnemonics>
  105.     WITHIN:    exportSymbol
  106.     <some mnemonics>
  107.     WITHIN:    exportSymbol2
  108.     <some mnemonics>
  109.  
  110. This code produces three symbols within the object file; aSymbol which is STATIC and thus cannot be accessed outside the file, and two GLOBAL symbols exportSymbol and exportSymbol2, which can be accessed outside the file. Linking to either or both of these symbols automatically links aSymbol.
  111. An example of the use of this facility is implementing the SharedCLibrary; when a CLib function such as printf is used, it must also link the whole jump table.
  112.  
  113. 8) RN:, FN: and CN: define registers, fp registers and co-processor registers.
  114.  
  115. 9) SET: defines a value which can be used in expressions.
  116.  
  117. 10) MSG: displays the string as an informational. ERROR: displays the string as an error.
  118.  
  119. 11) BLOCK: defines an zero-initialized block of particular size. It ends a symbol, and must not be used in conjunction with code. It is usually used in the BSS or DATA segment. (Occasionally LIT). BSS BLOCK: symbols are initialised by __aif.
  120.  
  121. 12) TEMP: describes how certain instructions may be synthesized. If the argument is a register, this register will be used; note that its value cannot be relied upon to be kept constant (r14 often is suitable). If STACK is used, qas places a register on the stack to use as a temp register. NONE (default) means no temp register is available.
  122.  
  123.  
  124. LIST OF ACCEPTED MNEMONICS
  125.  
  126. Mnemonic syntax as standard; see any ARM programming text. Additional notes given:-
  127.  
  128. =    Same as DCB
  129. &    Same as DCD
  130. %    Same as DBB
  131. ABS
  132. ACS
  133. ADC
  134. ADD
  135. ADF
  136. ADR    Always expands to 12-bytes (3 words)
  137. ALIGN    Aligns to word boundary and pads with zeros. Not necessary at end of symbols
  138. AND
  139. ASN
  140. ATN
  141. B
  142. BIC
  143. BIN    Syntax: BIN "file" include binary file
  144. BL
  145. CDP
  146. CMF
  147. CMN    Requires temp
  148. CMP    Requires temp
  149. CNF
  150. COS
  151. DBB    Declare block of bytes; syntax DBB <number>, [pattern]. Pattern is 0 if omitted
  152. DBD    Declare block of words; syntax DBD <number>, [pattern]
  153. DBW    Declare block of halfwords; syntax DBW <number>, [pattern]
  154. DCB    Declare byte; can also declare strings
  155. DCD    Declare constants or symbolname+offset or symbolname-offset
  156. DCFD    Declare double prec. fp constant
  157. DCFE    Declare extended prec. fp constant; but constant is only double prec.
  158. DCFP    Declare packed BCD fp constant
  159. DCFS    Declare single prec. fp constant
  160. DCW    Declare half-word
  161. DFL    Declare symbol length
  162. DFN    Same as DCD
  163. DVF
  164. DWD    Declare weak word; if symbol cannot be found, insert 0
  165. DWF    Same as DWD
  166. DWL    Declare weak symbol length
  167. EOR
  168. EQUB    Same as DCB
  169. EQUD    Same as DCD
  170. EQUS    Same as DCB
  171. EQUW    Same as DCW
  172. ERROR    Exception
  173. EXP
  174. F0D    \
  175. F0E     | unusual fp instructions; no known function
  176. F0F    /
  177. FDV
  178. FIX
  179. FLT
  180. FML
  181. FRD
  182. FT6    \
  183. FT7     |
  184. FT8     |
  185. FT9     |
  186. FTA     | unusual fp instructions; no known function
  187. FTB     |
  188. FTC     |
  189. FTD     |
  190. FTE     |
  191. FTF    /
  192. LDC
  193. LDF
  194. LDM
  195. LDR
  196. LGN
  197. LOG
  198. MCR
  199. MLA
  200. MNF
  201. MOV
  202. MRC
  203. MUF
  204. MUL
  205. MVF
  206. MVN
  207. NRM
  208. ORR
  209. POL
  210. POW
  211. RDF
  212. RFC
  213. RFS
  214. RMF
  215. RND
  216. RPW
  217. RSF
  218. SBC
  219. SET    Syntax: SET Rd Rn,#value. Same as ADD or SUB, but doesn't warn when converting
  220. SIN
  221. SQT
  222. STC
  223. STF
  224. STM
  225. STR
  226. SUF
  227. SWI
  228. SWP
  229. TAN
  230. TEQ
  231. TST
  232. URD
  233. WFC
  234. WPS
  235. XOR    Same as EOR
  236.  
  237.  
  238. EXAMPLE SOURCE FILE
  239.  
  240. ------------------------------------------
  241.  
  242. ; Print "Hello, world" using UnixLibQ (or other)
  243.  
  244.     GET:        "Q:Registers.s"
  245.  
  246.     TEMP:        lr
  247.  
  248.     SEGMENT:    CODE
  249.  
  250.     EXPORT:        main
  251.  
  252. main    mov    ip, sp
  253.     stmfd    sp!, {v6, fp, ip, lr, pc}
  254.     sub    fp, ip, #4
  255.     cmp    sp, sl
  256.     bllt    x$stack_overflow
  257.     adr    a1, .message
  258.     bl    printf
  259.     mov    a1, #0
  260.     ldmea    fp, {v6, fp, sp, pc}^
  261.  
  262. .message
  263.     dcb    "Hello, world\n"
  264.  
  265. ------------------------------------------
  266.  
  267.  
  268. LIMITATIONS
  269.  
  270. No macro facilities are available in this version.
  271. Input/output must be from files; cannot be from stdin/stdout.
  272.  
  273.  
  274. BUGS
  275.  
  276. None known.
  277.