AMn = IMMED;
}
+
+ // Small problem with this is that the opening parentheses might be an
+ // expression that's part of a displacement; this code will falsely flag
+ // that as an error.
+
// (An)
// (An)+
// (An,Xn[.siz][*scale])
if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
return ERROR;
+ // It could be that this is really just an expression prefixing a
+ // register as a displacement...
+ if (*tok == ')')
+ {
+ tok++;
+ goto CHK_FOR_DISPn;
+ }
+
+ // Otherwise, check for PC & etc displacements...
if (*tok++ != ',')
goto badmode;
if (expr(AnEXPR, &AnEXVAL, &AnEXATTR, &AnESYM) != OK)
return ERROR;
+CHK_FOR_DISPn:
if (*tok == DOTW)
{
// expr.W
// Defined, absolute values from $FFFF8000..$00007FFF get optimized
// to absolute short
- if ((AnEXATTR & (TDB|DEFINED)) == DEFINED && (AnEXVAL + 0x8000) < 0x10000)
+ if (optim_flag && (AnEXATTR & (TDB|DEFINED)) == DEFINED && (AnEXVAL + 0x8000) < 0x10000)
+ {
AMn = ABSW;
+ if (sbra_flag)
+ warn("absolute value from $FFFF8000..$00007FFF optimised to absolute short");
+ }
// Is .L forced here?
if (*tok == DOTL)
;
}
-// Cleanup dirty little macros
+// Clean up dirty little macros
#undef AnOK
#undef AMn
#undef AnREG
#undef AnESYM
#undef AMn_IX0
#undef AMn_IXN
+#undef CHK_FOR_DISPn