]> Shamusworld >> Repos - rmac/blobdiff - rmac.c
Fix for #203. Thanks to Steven Tattersall for the report.
[rmac] / rmac.c
diff --git a/rmac.c b/rmac.c
index 0ae0f6201b9b33c8f3d4f02a4cfd6918da1c9abc..5946105b03b0b68989ec8a19a2979a76aa6071db 100644 (file)
--- a/rmac.c
+++ b/rmac.c
@@ -1,7 +1,7 @@
 //
 // RMAC - Renamed Macro Assembler for all Atari computers
 // RMAC.C - Main Application Code
-// Copyright (C) 199x Landon Dyer, 2011-2021 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2022 Reboot and Friends
 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
 // Source utilised with the kind permission of Landon Dyer
 //
@@ -30,7 +30,7 @@ int list_pag = 1;                             // Enable listing pagination by default
 int verb_flag;                                 // Be verbose about what's going on
 int m6502;                                             // 1, assembling 6502 code
 int glob_flag;                                 // Assume undefined symbols are global
-int lsym_flag;                                 // Include local symbols in object file
+int lsym_flag;                                 // Include local symbols in object file (ALWAYS true)
 int optim_warn_flag;                   // Warn about possible short branches
 int prg_flag;                                  // !=0, produce .PRG executable (2=symbols)
 int prg_extend;                                        // !=0, output extended .PRG symbols
@@ -60,6 +60,7 @@ 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)
 uint32_t org68k_address;               // .org for 68k
+int correctMathRules;                  // 1, use C operator precedence in expressions
 
 //
 // Convert a string to uppercase
@@ -206,6 +207,7 @@ void DisplayHelp(void)
                "  -v                Set verbose mode\n"
                "  -x                Turn on debugging mode\n"
                "  -y[pagelen]       Set page line length (default: 61)\n"
+               "  -4                Use C style operator precedence\n"
                "\n", cmdlnexec);
 }
 
@@ -221,7 +223,7 @@ void DisplayVersion(void)
                "| |  | | | | | | (_| | (__ \n"
                "|_|  |_| |_| |_|\\__,_|\\___|\n"
                "\nRenamed Macro Assembler\n"
-               "Copyright (C) 199x Landon Dyer, 2011-2021 Reboot and Friends\n"
+               "Copyright (C) 199x Landon Dyer, 2011-2022 Reboot and Friends\n"
                "V%01i.%01i.%01i %s (%s)\n\n", MAJOR, MINOR, PATCH, __DATE__, PLATFORM);
 }
 
@@ -334,7 +336,7 @@ int Process(int argc, char ** argv)
        regtab = reg68tab;                              // Idem
        regcheck = reg68check;                  // Idem
        regaccept = reg68accept;                // Idem
-
+    correctMathRules = 0;                      // respect operator precedence
        // Initialize modules
        InitSymbolTable();                              // Symbol table
        InitTokenizer();                                // Tokenizer
@@ -353,6 +355,9 @@ int Process(int argc, char ** argv)
                {
                        switch (argv[argno][1])
                        {
+                       case '4':
+                               correctMathRules = 1;
+                               break;
                        case 'd':                               // Define symbol
                        case 'D':
                                for(s=argv[argno]+2; *s!=EOS;)