]> Shamusworld >> Repos - rmac/blobdiff - dsp56k_amode.c
Fix move <ea>,<ea020> code generation
[rmac] / dsp56k_amode.c
index 347886f6dcb5b1e4359abd84daf71f5fc04f87f7..4e86f362f11c28a81384568eff4388763bdc3485 100644 (file)
@@ -21,7 +21,7 @@
 #include "mntab.h"
 
 // Address-mode information
-int nmodes;                                            // Number of addr'ing modes found
+//int nmodes;                                          // Number of addr'ing modes found
 int dsp_am0;                                   // Addressing mode
 int dsp_a0reg;                                 // Register
 TOKEN dsp_a0expr[EXPRSIZE];            // Expression
@@ -62,6 +62,9 @@ uint64_t dspaaEXVAL;                  // Expression's value
 WORD  dspaaEXATTR;                             // Expression's attribute
 SYM * dspaaESYM;                               // External symbol involved in expr
 
+LONG dsp_a0perspace;                      // Peripheral space (X, Y - used in movep)
+LONG dsp_a1perspace;                      // Peripheral space (X, Y - used in movep)
+
 int dsp_k;                          // Multiplications sign
 
 static inline LONG checkea(const uint32_t termchar, const int strings);
@@ -434,7 +437,8 @@ static inline int dsp_parmode(int *am, int *areg, TOKEN * AnEXPR, uint64_t * AnE
                        {
                                if (*AnEXVAL > 0x3F)
                                {
-                                       warn("short addressing mode forced but address is bigger than $3F - switching to long");
+                                       if (optim_warn_flag)
+                                               warn("short addressing mode forced but address is bigger than $3F - switching to long");
                                        *am = M_DSPEA;
                                        *memspace = 1 << 6;     // Mark we're on Y memory space
                                        *areg = DSP_EA_ABS;
@@ -1606,7 +1610,8 @@ x_gotea1:
                {
                        if (dspImmedEXVAL > 0x3F)
                        {
-                               warn("short addressing mode forced but address is bigger than $3F - switching to long");
+                               if (optim_warn_flag)
+                                       warn("short addressing mode forced but address is bigger than $3F - switching to long");
                                force_imm = NUM_FORCE_LONG;
                                deposit_extra_ea = DEPOSIT_EXTRA_WORD;
                                ea1 = DSP_EA_ABS;
@@ -1873,7 +1878,8 @@ static inline LONG parse_y(LONG inst, LONG S1, LONG D1, LONG S2)
         {
             // We're in 'S1,D1 Y:ea,D2' or 'S1,D1 S1,Y:ea'
             // there's no Y:aa mode here, so we'll force long
-            warn("forced short addressing in R:Y mode is not allowed - switching to long");
+                       if (optim_warn_flag)
+                               warn("forced short addressing in R:Y mode is not allowed - switching to long");
 
             if (expr(dspImmedEXPR, &dspImmedEXVAL, &dspImmedEXATTR, &dspImmedESYM) != OK)
                 return ERROR;
@@ -1896,7 +1902,8 @@ static inline LONG parse_y(LONG inst, LONG S1, LONG D1, LONG S2)
             {
                 if (dspImmedEXVAL > 0xfff)
                 {
-                    warn("short addressing mode forced but address is bigger than $fff - switching to long");
+                                       if (optim_warn_flag)
+                                               warn("short addressing mode forced but address is bigger than $fff - switching to long");
                     ea1 = DSP_EA_ABS;
                     force_imm = NUM_FORCE_LONG;
                     deposit_extra_ea = DEPOSIT_EXTRA_WORD;
@@ -2481,7 +2488,8 @@ LONG parmoves(WORD dest)
                                                }
                                                else
                                                {
-                                                       warn("forced short immediate value doesn't fit in 8 bits - switching to long");
+                                                       if (optim_warn_flag)
+                                                               warn("forced short immediate value doesn't fit in 8 bits - switching to long");
                                                        force_imm = NUM_FORCE_LONG;
                                                }
                                        }
@@ -2551,7 +2559,8 @@ deposit_immediate_short_with_register:
                                        {
                                                // Value's 16 lower bits are not set so the value can fit in a single byte
                                                // (check parallel I move quoted above)
-                                               warn("Immediate value fits inside 8 bits, so using instruction short format");
+                                               if (optim_warn_flag)
+                                                       warn("Immediate value fits inside 8 bits, so using instruction short format");
                                                dspImmedEXVAL >>= 16;
                                                goto deposit_immediate_short_with_register;
                                        }
@@ -2560,7 +2569,8 @@ deposit_immediate_short_with_register:
                                        {
                                                if ((dspImmedEXVAL & 0xFFFF) != 0)
                                                {
-                                                       warn("Immediate value short format forced but value does not fit inside 8 bits - switching to long format");
+                                                       if (optim_warn_flag)
+                                                               warn("Immediate value short format forced but value does not fit inside 8 bits - switching to long format");
                                                        goto deposit_immediate_long_with_register;
                                                }