]> Shamusworld >> Repos - rmac/blobdiff - docs/rmac.rst
Added "-4" switch that enables C style operator precedence (original work by Bastian...
[rmac] / docs / rmac.rst
index 50083e477deb6c6b058d20cec0f165fbcae356c3..78e2d34cb8fae27ae7f615745a65084666415479 100644 (file)
@@ -127,7 +127,7 @@ Switch               Description
 -fx                  Atari 800 com/exe/xex output object file format.
 -i\ *path*           Set include-file directory search path.
 -l\ *[file[prn]]*    Construct and direct assembly listing to the specified file.
--l\ *\*[filename]*   Create an output listing file without pagination
+-l\ *\*[filename]*   Create an output listing file without pagination.
 -m\ *cpu*            Switch CPU type
 
                       `68000 - MC68000`
@@ -153,9 +153,9 @@ Switch               Description
                       `jerry - Jaguar DSP JRISC`
 
                       -o\ *file[.o]*       Direct object code output to the specified file.
-+/~oall              Turn all optimisations on/off
-+o\ *0-10*/*p*       Enable specific optimisation
-~o\ *0-10*/*p*       Disable specific optimisation
++/~oall               Turn all optimisations on/off
++o\ *0-30*/*p*        Enable specific optimisation
+~o\ *0-30*/*p*        Disable specific optimisation
 
                       `0: Absolute long adddresses to word (on by default)`
 
@@ -177,7 +177,12 @@ Switch               Description
 
                       `9: Convert adda.w/l #x,Dy to lea x(Dy),Dy`
 
-                      `p: Force PC-Relative mode (alternative: o10)`
+                      `10: 56001 Use short format for immediate values if possible`
+
+                      `11: 56001 Auto convert short addressing mode to long (default: on)`
+
+                      `o30: Enforce PC relative (alternative name: op)`
+
 -p                   Produce an executable (**.prg**) output file.
 -ps                  Produce an executable (**.prg**) output file with symbols.
 -px                  Produce an executable (**.prg**) output file with extended symbols.
@@ -198,8 +203,9 @@ Switch               Description
 -s                   Warn about unoptimized long branches and applied optimisations.
 -u                   Force referenced and undefined symbols global.
 -v                   Verbose mode (print running dialogue).
--x                   Turn on debugging mode
+-x                   Turn on debugging mode.
 -yn                  Set listing page size to n lines.
+-4                   Use C style operator precedence.
 file\ *[s]*          Assemble the specified file.
 ===================  ===========
 
@@ -291,6 +297,9 @@ the table.
   space), sets the number of lines in a page. RMAC will produce *N* lines
   before emitting a form-feed. If *N* is missing or less than 10 an error message is
   generated.
+**-4**
+  Use C style order of precedence in expressions. See `Order of Evaluation`_ for more
+  information.
 
 `Using RMAC`_
 ===============
@@ -420,7 +429,8 @@ necessary to make other assemblers' source code assemble.
   character codes. Watch out for GEMDOS path names in ASCII constants -
   you will have to convert them to double-backslashes.
 * Expression evaluation is done left-to-right without operator precedence. Use parentheses to
-  force the expression evaluation as you wish.
+  force the expression evaluation as you wish. Alternatively, use the **-4** switch to switch
+  to C style precedence. For more information refer to `Order of Evaluation`_.
 * Mark your segments across files.
   Branching to a code segment that could be identified as BSS will cause a "Error: cannot initialize non-storage (BSS) section"
 * In 68020+ mode **Zan** and **Zri** (register suppression) is not supported.
@@ -628,7 +638,7 @@ and may not be used as symbols (e.g. labels, equates, or the names of macros):
       a0 a1 a2 a3 a4 a5 a6 a7
       Tom/Jerry:
       r0 r1 r2 r3 r4 r5 r6 r7
-      r8 r9 r10 r11 r12 rl3 r14 ri5
+      r8 r9 r10 r11 r12 rl3 r14 r15
       6502:
       x y a
       DSP56001:
@@ -741,6 +751,24 @@ true.
 Thus the expression "1+2*3" evaluates to 9, not 7. However, precedence may be
 forced with parenthesis (**()**) or square-brackets (**[]**).
 
+All the above behavior is the default. However if the command line switch **-4**
+is used, then C style of operator precedence is enforced. The following list
+shows the order of precedence in this mode, from lowest to highest:
+
+ * bitwise XOR ^
+
+ * bitwise OR |
+
+ * bitwise AND &
+
+ * relational = < <= >= > !=
+
+ * shifts << >>
+
+ * sum + -
+
+ * product * /
+
 `Types`_
 '''''''''
 Expressions belong to one of three classes: undefined, absolute or relocatable. An
@@ -837,7 +865,9 @@ Operator     Description
 ===========  ==============================================
 
  * All binary operators have the same precedence:
-   expressions are evaluated strictly left to right.
+   expressions are evaluated strictly left to right,
+   with the exception of the **-4** switch. For more information
+   refer to `Order of Evaluation`_.
 
  * Division or modulo by zero yields an assembly error.
 
@@ -925,9 +955,11 @@ symbol **debug** external, instead of including another source file).
 Assembler directives may be any mix of upper- or lowercase. The leading periods
 are optional, though they are shown here and their use is encouraged. Directives
 may be preceeded by a label; the label is defined before the directive is executed.
-Some directives accept size suffixes (**.b**, **.s**, **.w** or **.1**); the default is word (**.w**) if no
-size is specified. The **.s** suffix is identical to **.b**. Directives relating to the 6502 are
-described in the chapter on `6502 Support`_.
+Some directives accept size suffixes (**.b**, **.s**, **.w**, **.1**, **.d**, **.x**, **.p**, or  **.q**);
+the default is word (**.w**) if no size is specified. The **.s** suffix is identical to **.b**,
+with the exception of being used in a **dc** statement. In that case the **.s**
+refers to single precision floating point numbers.
+Directives relating to the 6502 are described in the chapter on `6502 Support`_.
 
 
 
@@ -1064,7 +1096,6 @@ described in the chapter on `6502 Support`_.
    Start an absolute section, beginning with the specified location (or zero, if
    no location is specified). An absolute section is much like BSS, except that
    locations declared with .ds are based absolute. This directive is useful for
-
    declaring structures or hardware locations.
    For example, the following equates:
 
@@ -1255,11 +1286,11 @@ described in the chapter on `6502 Support`_.
 
 **.equr** *expression*
 
-   Allows you to name a register. This is only implemented for GPU/DSP
-   code sections. For example:
+   Allows you to name a register. For example:
 
     ::
 
+     .gpu
      Clipw .equr r19
      . . .
           add ClipW,r0 ; ClipW actually is r19
@@ -1570,16 +1601,14 @@ The assembler provides "creature comforts" when it processes 68000 mnemonics:
  * All optimisations are turned off for any source line that has an exclamation mark
    (*!*) on their first column.
 
- * Optimisation switches 0, 1 and 2 are turned on by default for legacy reasons.
+ * Optimisation switch 11 is turned on by default for compatibility with the
+   Motorola reference 56001 DSP assembler.
    All other levels are off by default. (refer to section `The Command Line`_
    for a description of all the switches).
 
  * Optimisation warnings are off by default. Invoke RMAC with the *-s* switch to
    turn on warnings in console and listing output.
 
- * In DSP56001 mode size optimisations are on by default. Currently there is no
-   way to disable this behaviour.
-
  * In GPU/DSP code sections, you can use JUMP (Rx) in place of JUMP T, (Rx) and JR
    (Rx) in place of JR T,(Rx).
 
@@ -2021,7 +2050,7 @@ Atari Falcon XBIOS) and *.p56* (binary equivalent of *.lod*)
 
 `6502 Support`_
 ===============
-RMAC will generate code for the Motorola 6502 microprocessor. This chapter
+RMAC will generate code for the MOS 6502 microprocessor. This chapter
 describes extra addressing modes and directives used to support the 6502.
 
 As the 6502 object code is not linkable (currently there is no linker) external
@@ -2179,10 +2208,6 @@ order, along with a short description of what may have caused the problem.
 
     You tried to ``.comm`` a symbol that was already defined.
 
-**.ds permitted only in BSS**
-
-    You tried to use ``.ds`` in the text or data section.
-
 **.init not permitted in BSS or ABS**
 
     You tried to use ``.init`` in the BSS or ABS section.
@@ -2429,11 +2454,6 @@ order, along with a short description of what may have caused the problem.
   The expression has an undefined value because of a forward reference, or an
   undefined or external symbol.
 
-**unimplemented addressing mode**
-
-  You tried to use 68020 "square-bracket" notation for a 68020 addressing mode.
-  RMAC does not support 68020 addressing modes.
-
 **unimplemented directive**
 
   You have found a directive that didn't appear in the documentation. It doesn't
@@ -2448,11 +2468,6 @@ order, along with a short description of what may have caused the problem.
   You followed a ^^ with something other than one of the names defined, referenced
   or streq.
 
-**unsupported 68020 addressing mode**
-
-  The assembler saw a 68020-type addressing mode. RMAC does not assemble
-  code for the 68020 or 68010.
-
 **unterminated string**
 
   You specified a string starting with a single or double quote, but forgot to type