Temp fix for some address size problems
git-svn-id: svn://svn.cc65.org/cc65/trunk@2674 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -196,7 +196,15 @@ int IsByteRange (long Val)
|
|||||||
int IsWordRange (long Val)
|
int IsWordRange (long Val)
|
||||||
/* Return true if this is a word value */
|
/* 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -113,6 +113,9 @@ int IsByteRange (long Val);
|
|||||||
int IsWordRange (long Val);
|
int IsWordRange (long Val);
|
||||||
/* Return true if this is a word value */
|
/* 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);
|
ExprNode* CloneExpr (ExprNode* Expr);
|
||||||
/* Clone the given expression tree. The function will simply clone symbol
|
/* Clone the given expression tree. The function will simply clone symbol
|
||||||
* nodes, it will not resolve them.
|
* nodes, it will not resolve them.
|
||||||
|
|||||||
@@ -1152,6 +1152,7 @@ unsigned char ParseAddrSize (void)
|
|||||||
"DIRECT", "ZEROPAGE", "ZP",
|
"DIRECT", "ZEROPAGE", "ZP",
|
||||||
"ABSOLUTE", "ABS", "NEAR",
|
"ABSOLUTE", "ABS", "NEAR",
|
||||||
"FAR",
|
"FAR",
|
||||||
|
"LONG", "DWORD",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Check for an identifier */
|
/* Check for an identifier */
|
||||||
@@ -1169,6 +1170,8 @@ unsigned char ParseAddrSize (void)
|
|||||||
case 4:
|
case 4:
|
||||||
case 5: return ADDR_SIZE_ABS;
|
case 5: return ADDR_SIZE_ABS;
|
||||||
case 6: return ADDR_SIZE_FAR;
|
case 6: return ADDR_SIZE_FAR;
|
||||||
|
case 7:
|
||||||
|
case 8: return ADDR_SIZE_LONG;
|
||||||
default:
|
default:
|
||||||
Error ("Address size specifier expected");
|
Error ("Address size specifier expected");
|
||||||
return ADDR_SIZE_DEFAULT;
|
return ADDR_SIZE_DEFAULT;
|
||||||
|
|||||||
@@ -195,8 +195,16 @@ void SymDef (SymEntry* S, ExprNode* Expr, unsigned char AddrSize, unsigned Flags
|
|||||||
/* Map a default address size to a real value */
|
/* Map a default address size to a real value */
|
||||||
if (AddrSize == ADDR_SIZE_DEFAULT) {
|
if (AddrSize == ADDR_SIZE_DEFAULT) {
|
||||||
long Val;
|
long Val;
|
||||||
if (IsConstExpr (Expr, &Val) && IsByteRange (Val)) {
|
if (IsConstExpr (Expr, &Val)) {
|
||||||
AddrSize = ADDR_SIZE_ZP;
|
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 {
|
} else {
|
||||||
AddrSize = SymAddrSize (S);
|
AddrSize = SymAddrSize (S);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user