]> Shamusworld >> Repos - rmac/commitdiff
Fix for issue #179: Don't touch o10 when +/~Oall is called. Made the o10 error messag... v2.1.6
authorggn <ggn.dbug@gmail.com>
Sun, 8 Nov 2020 14:27:45 +0000 (16:27 +0200)
committerShamus Hammons <jlhamm@acm.org>
Wed, 9 Jun 2021 01:11:29 +0000 (20:11 -0500)
docs/rmac.rst
eagen0.c
parmode.h
rmac.c
rmac.h
sect.c
version.h

index 24110c46eb220330d3104d49a1356e26b5d2eb12..50083e477deb6c6b058d20cec0f165fbcae356c3 100644 (file)
@@ -4,7 +4,7 @@ RMAC
 =====================
 Reference Manual
 ================
-version 2.0.21
+version 2.0.23
 ==============
 
 © and notes
@@ -158,11 +158,11 @@ Switch               Description
 ~o\ *0-10*/*p*       Disable specific optimisation
 
                       `0: Absolute long adddresses to word (on by default)`
-                      
+
                       `1: move.l #x,Dn/An to moveq (on by default)`
 
                       `2: Word branches to short (on by default)`
-                      
+
                       `3: Outer displacement 0(An) to (An)`
 
                       `4: lea to addq`
@@ -185,15 +185,15 @@ Switch               Description
 -r *size*            automatically pad the size of each
                      segment in the output file until the size is an integral multiple of the
                      specified boundary. Size is a letter that specifies the desired boundary.
-                     
+
                       `-rw Word (2 bytes, default alignment)`
 
                       `-rl Long (4 bytes)`
 
                       `-rp Phrase (8 bytes)`
-                      
+
                       `-rd Double Phrase (16 bytes)`
-                      
+
                       `-rq Quad Phrase (32 bytes)`
 -s                   Warn about unoptimized long branches and applied optimisations.
 -u                   Force referenced and undefined symbols global.
@@ -434,7 +434,7 @@ necessary to make other assemblers' source code assemble.
     label2: rs.w 10
     label3: rs.l 5
     label4: rs.b 2
-   
+
     size_so_far equ rscount
 
   can be converted to:
@@ -446,7 +446,7 @@ necessary to make other assemblers' source code assemble.
     label2: ds.w 10
     label3: ds.l 5
     label4: ds.b 2
-   
+
     size_so_far equ ^^abscount
 * A rare case: if your macro contains something like:
 
@@ -510,7 +510,7 @@ As an addition, the exclamation mark character (**!**) can be placed at the very
 character of a line to disbale all optimisations for that specific line, i.e.
 
   ::
-      
+
       !label: operator operand(s)  ; comment
 
 `Equates`_
@@ -638,7 +638,7 @@ and may not be used as symbols (e.g. labels, equates, or the names of macros):
       n0 n1 n2 n3 n4 n5 n6 n7
       m0 m1 m2 m3 m4 m5 m6 m7
       r0 r1 r2 r3 r4 r5 r6 r7
-      
+
 
 `Constants`_
 ''''''''''''
@@ -805,7 +805,7 @@ Operator                            Description
 **~**                               Tilde: bitwise not (l's complement).
 **^^defined** *symbol*              True if symbol has a value.
 **^^referenced** *symbol*           True if symbol has been referenced.
-**^^streq** *stringl*, *string2*    True if the strings are equal.
+**^^streq** *string1*, *string2*    True if the strings are equal.
 **^^macdef** *macroName*            True if the macro is defined.
 **^^abscount**                      Returns the size of current .abs section
 **^^filesize** *string_filename*    Returns the file size of supplied filename
@@ -1044,14 +1044,17 @@ described in the chapter on `6502 Support`_.
 **.opt** *"~On"*
 **.opt** *"+Oall"*
 **.opt** *"~Oall"*
-   
+
    These directives control the optimisations that rmac applies to the source
    automatically. Each directive is applied immediately from the line encountered
    onwards. So it is possible to turn specific optimisations on and off globally
    (when placed at the start of the first file) or locally (by turning desired
    optimisations on and off at certain parts of the source). For a list of the
    optimisations (*n*) available please consult the table in section `The Command Line`_.
-   **all**, as expected, turns all available optimisations on or off.
+
+   **all**, as expected, turns all available optimisations on or off. An exception to this
+   is *o10*/*op* as this is not an optimisation that should be turned on unless the user
+   absolutely needs it.
 
    Lastly, as a "creature comfort" feature, if the first column of any line is prefixed
    with an exclamation mark (*!*) then for that line all optimisations are turned off.
@@ -1122,15 +1125,15 @@ described in the chapter on `6502 Support`_.
            spf_emx_colouropt:  ds.l    1
            spf_emx_psmask:     ds.l    16
            spf_emx_psmaskopt:  ds.l    16
-           
+
            .68000
            ;*-------------------------------------------------------*
-           
+
                move #spf_em_colour,d0
                move #spf_emx_colour,d0
 
    In this example, *spf_em_colour* and *spf_emx_colour* will have the same value.
-           
+
 **.comm** *symbol*, *expression*
 
    Specifies a label and the size of a common region. The label is made global,
@@ -1144,7 +1147,7 @@ described in the chapter on `6502 Support`_.
    and JR instructions for GPU and DSP code. For example:
 
     ::
-   
+
      Always .ccdef 0
      . . .
           jump Always,(r3) ; 'Always' is actually 0
@@ -1153,7 +1156,7 @@ described in the chapter on `6502 Support`_.
 
    Undefines a register name (regname) previously assigned using the
    .CCDEF directive. This is only implemented in GPU and DSP code
-   sections.     
+   sections.
 
 **.dc.i** *expression*
 
@@ -1340,12 +1343,12 @@ described in the chapter on `6502 Support`_.
 **.incbin** "*file*" [, [*size*], [*offset*]]
 
    Include a file as a binary. This can be thought of a series of **dc.b** statements
-   that match the binary bytes of the included file, inserted at the location of the 
+   that match the binary bytes of the included file, inserted at the location of the
    directive. The directive is not allowed in a BSS section. Optional parameters
    control the amount of bytes to be included and offset from the start of the file.
    All the following lines are valid:
 
-              ::   
+              ::
                 .incbin "test.bin"          ; Include the whole file
                 .incbin "test.bin",,$30     ; Skip the first 48 bytes
                 .incbin "test.bin",$70,$30  ; Include $70 bytes starting at offset $30
@@ -1418,11 +1421,11 @@ described in the chapter on `6502 Support`_.
 ============ ======  =======
 Definition   Bit(s)  Meaning
 ============ ======  =======
-PF_FASTLOAD  0       If set, clear only the BSS area on program load, otherwise clear the entire heap. 
-PF_TTRAMLOAD 1       If set, the program may be loaded into alternative RAM, otherwise it must be loaded into standard RAM. 
-PF_TTRAMMEM  2       If set, the program's Malloc() requests may be satisfied from alternative RAM, otherwise they must be satisfied from standard RAM. 
+PF_FASTLOAD  0       If set, clear only the BSS area on program load, otherwise clear the entire heap.
+PF_TTRAMLOAD 1       If set, the program may be loaded into alternative RAM, otherwise it must be loaded into standard RAM.
+PF_TTRAMMEM  2       If set, the program's Malloc() requests may be satisfied from alternative RAM, otherwise they must be satisfied from standard RAM.
 --           3       Currently unused.
-See left.    4 & 5   If these bits are set to 0 (PF_PRIVATE), the processes' entire memory space will be considered private (when memory protection is enabled).If these bits are set to 1 (PF_GLOBAL), the processes' entire memory space will be readable and writable by any process (i.e. global).If these bits are set to 2 (PF_SUPERVISOR), the processes' entire memory space will only be readable and writable by itself and any other process in supervisor mode.If these bits are set to 3 (PF_READABLE), the processes' entire memory space will be readable by any application but only writable by itself. 
+See left.    4 & 5   If these bits are set to 0 (PF_PRIVATE), the processes' entire memory space will be considered private (when memory protection is enabled).If these bits are set to 1 (PF_GLOBAL), the processes' entire memory space will be readable and writable by any process (i.e. global).If these bits are set to 2 (PF_SUPERVISOR), the processes' entire memory space will only be readable and writable by itself and any other process in supervisor mode.If these bits are set to 3 (PF_READABLE), the processes' entire memory space will be readable by any application but only writable by itself.
 --           6-15    Currently unused.
 ============ ======  =======
 
@@ -1562,7 +1565,7 @@ The assembler provides "creature comforts" when it processes 68000 mnemonics:
    their quick forms; **ADDQ** and **SUBQ** must be explicit.
 
  * All optimisations are controllable using the **.opt** directive. Refer to its
-   description in section `Directives`_. 
+   description in section `Directives`_.
 
  * All optimisations are turned off for any source line that has an exclamation mark
    (*!*) on their first column.
@@ -1828,7 +1831,7 @@ modes.
 `Condition Codes`_
 ''''''''''''''''''
 The following condition codes for the GPU/DSP JUMP and JR instructions are built-in:
+
   ::
 
    CC (Carry Clear) = %00100
@@ -2002,7 +2005,7 @@ Atari Falcon XBIOS) and *.p56* (binary equivalent of *.lod*)
   distinguish between the two. rmac needs the user to be explicit and will
   generate an error if the programmer tries to use syntax from one instruction
   to the other.
-- Similarly Motorola's assembler can alias **move** with **movec**, **movep** 
+- Similarly Motorola's assembler can alias **move** with **movec**, **movep**
   and **movem**. rmac also not accept such aliasing and generate an error.
 - Motorola's assembler uses the underscore character (*_*) to define local
   labels. In order for rmac to maintain a uniform syntax across all platforms,
index 6506c376bbe3f3cc888b4b25eca9d0eaa8c52596..686551c3db96a9a5d6378f537230a672a4758626 100644 (file)
--- a/eagen0.c
+++ b/eagen0.c
@@ -329,7 +329,7 @@ int eaNgen(WORD siz)
                        if (CHECK_OPTS(OPT_PC_RELATIVE))
                        {
                                if ((aNexattr & (DEFINED | REFERENCED | EQUATED)) == (DEFINED | REFERENCED))
-                                       return error("relocation not allowed");
+                                       return error("relocation not allowed when o10 is enabled");
                        }
 
                        if (tdb)
index a0cc8de0ec6b19f8a02247437678d7a32fe17001..8aed03ca35e9cf6566a2efe691096fcfa06d6f27 100644 (file)
--- a/parmode.h
+++ b/parmode.h
@@ -1162,16 +1162,15 @@ CHK_FOR_DISPn:
                        // expr[.L]
                        AMn = ABSL;
 
-                       // When PC relative is enforced, check for any symbols that aren't
-                       // EQU'd, in this case it's an illegal mode
-                       if ((CHECK_OPTS(OPT_PC_RELATIVE)) && (AnEXATTR & REFERENCED) && (AnEXATTR & DEFINED) && (!(AnEXATTR & EQUATED)))
-                               return error("relocation not allowed");
-
                        // .L is forced here
                        if (*tok == DOTL)
                        {
+                               // When PC relative is enforced, check for any symbols that aren't
+                               // EQU'd, in this case it's an illegal mode
+                               if ((CHECK_OPTS(OPT_PC_RELATIVE)) && (AnEXATTR & (DEFINED | REFERENCED | EQUATED) == (DEFINED | REFERENCED)))
+                                       return error("relocation not allowed when o10 is enabled9");
+
                                tok++;
-                               AMn = ABSL;
                        }
                        else
                        {
diff --git a/rmac.c b/rmac.c
index 8ea0189e02ef740ecce71b59fad8c4b5076140f9..4f78759070ef6888b0c7897119e87e34ef396d9e 100644 (file)
--- a/rmac.c
+++ b/rmac.c
@@ -53,7 +53,7 @@ char * cmdlnexec;                             // Executable name, pointer to ARGV[0]
 char searchpatha[512] = { 0 }; // Buffer to hold searchpath when specified
 char * searchpath = NULL;              // Search path for include files
 char defname[] = "noname.o";   // Default output filename
-int optim_flags[OPT_COUNT];            // Specific optimisations on/off matrix
+int optim_flags[OPT_COUNT_ALL];        // Specific optimisations on/off matrix
 int activecpu = CPU_68000;             // Active 68k CPU (68000 by default)
 int activefpu = FPU_NONE;              // Active FPU (none by default)
 int org68k_active = 0;                 // .org switch for 68k (only with RAW output format)
diff --git a/rmac.h b/rmac.h
index 6ce90c09e38fb94bb9418d0ea1aad74db9122a2a..e44574ff4be4b9b7ace3acda2066931a693a10ad 100644 (file)
--- a/rmac.h
+++ b/rmac.h
@@ -284,6 +284,7 @@ PTR
 // Optimisation defines
 enum
 {
+    // These will be set to on/off when .opt "+Oall"/"~Oall" is called
        OPT_ABS_SHORT     = 0,
        OPT_MOVEL_MOVEQ   = 1,
        OPT_BSR_BCC_S     = 2,
@@ -294,8 +295,10 @@ enum
        OPT_CLR_DX        = 7,
        OPT_ADDA_ADDQ     = 8,
        OPT_ADDA_LEA      = 9,
-       OPT_PC_RELATIVE   = 10,         // Enforce PC relative
-       OPT_COUNT   // Dummy, used to count number of optimisation switches
+       OPT_COUNT,                  // Dummy, used to count number of optimisation switches
+    // These will be unaffected by "Oall"
+       OPT_PC_RELATIVE   = 11,         // Enforce PC relative
+    OPT_COUNT_ALL               // Dummy, used to count all switches
 };
 
 // Exported variables
@@ -320,7 +323,7 @@ extern int obj_format;
 extern int legacy_flag;
 extern int prg_flag;   // 1 = write ".PRG" relocatable executable
 extern LONG PRGFLAGS;
-extern int optim_flags[OPT_COUNT];
+extern int optim_flags[OPT_COUNT_ALL];
 extern int activecpu;
 extern int activefpu;
 extern uint32_t org68k_address;
diff --git a/sect.c b/sect.c
index a9239e6e638b1cb8c808d801432a7be9b91e93f7..f24c8c13312193eda4b81c4e9698322118d38099 100644 (file)
--- a/sect.c
+++ b/sect.c
@@ -461,9 +461,9 @@ int ResolveFixups(int sno)
                        if (evexpr(fup->expr, &eval, &eattr, &esym) != OK)
                                continue;
 
-                       if ((CHECK_OPTS(OPT_PC_RELATIVE)) && (eattr & REFERENCED) && (eattr & DEFINED) && (!(eattr & EQUATED)))
+                       if ((CHECK_OPTS(OPT_PC_RELATIVE)) && (eattr & (DEFINED | REFERENCED | EQUATED)) == (DEFINED | REFERENCED))
                        {
-                               error("relocation not allowed");
+                               error("relocation not allowed when o10 is enabled");
                                continue;
                        }
                }
@@ -473,9 +473,9 @@ int ResolveFixups(int sno)
                        SYM * sy = fup->symbol;
                        eattr = sy->sattr;
 
-                       if ((CHECK_OPTS(OPT_PC_RELATIVE)) && (eattr & REFERENCED) && (eattr & DEFINED) && (!(eattr & EQUATED)))
+                       if ((CHECK_OPTS(OPT_PC_RELATIVE)) && (eattr & (DEFINED | REFERENCED | EQUATED)) == (DEFINED | REFERENCED))
                        {
-                               error("relocation not allowed");
+                               error("relocation not allowed when o10 is enabled");
                                continue;
                        }
 
index a33153c113e221df40ed81a38d2591af9e5123ad..298c0f1e1bf33f741a393c22290de5649a8cc7ed 100644 (file)
--- a/version.h
+++ b/version.h
@@ -15,6 +15,6 @@
 
 #define MAJOR   2              // Major version number
 #define MINOR   1              // Minor version number
-#define PATCH   5              // Patch release number
+#define PATCH   6              // Patch release number
 
 #endif // __VERSION_H__