int IsWordRange (long Val)
/* Return true if this is a word value */
{
- return (Val & ~0xFFFF) == 0;
+ return (Val & ~0xFFFFL) == 0;
+}
+
+
+
+int IsFarRange (long Val)
+/* Return true if this is a far (24 bit) value */
+{
+ return (Val & ~0xFFFFFFL) == 0;
}
/* Done */
return Result;
-}
+}
static ExprNode* FuncSizeOf (void)
/* Handle the .SIZEOF function */
-{
+{
long Size;
/* Get the struct for the scoped struct name */
ExprNode* SimplifyExpr (ExprNode* Expr);
/* Try to simplify the given expression tree */
-ExprNode* GenLiteralExpr (long Val);
+ExprNode* GenLiteralExpr (long Val);
/* Return an expression tree that encodes the given literal value */
ExprNode* GenSymExpr (struct SymEntry* Sym);
int IsWordRange (long Val);
/* Return true if this is a word value */
+int IsFarRange (long Val);
+/* Return true if this is a far (24 bit) value */
+
ExprNode* CloneExpr (ExprNode* Expr);
/* Clone the given expression tree. The function will simply clone symbol
* nodes, it will not resolve them.
"DIRECT", "ZEROPAGE", "ZP",
"ABSOLUTE", "ABS", "NEAR",
"FAR",
+ "LONG", "DWORD",
};
/* Check for an identifier */
case 4:
case 5: return ADDR_SIZE_ABS;
case 6: return ADDR_SIZE_FAR;
+ case 7:
+ case 8: return ADDR_SIZE_LONG;
default:
Error ("Address size specifier expected");
return ADDR_SIZE_DEFAULT;
/* Map a default address size to a real value */
if (AddrSize == ADDR_SIZE_DEFAULT) {
long Val;
- if (IsConstExpr (Expr, &Val) && IsByteRange (Val)) {
- AddrSize = ADDR_SIZE_ZP;
+ if (IsConstExpr (Expr, &Val)) {
+ if (IsByteRange (Val)) {
+ AddrSize = ADDR_SIZE_ZP;
+ } else if (IsWordRange (Val)) {
+ AddrSize = ADDR_SIZE_ABS;
+ } else if (IsFarRange (Val)) {
+ AddrSize = ADDR_SIZE_FAR;
+ } else {
+ AddrSize = ADDR_SIZE_LONG;
+ }
} else {
AddrSize = SymAddrSize (S);
}