Add bounded expressions for immediate addressing and list the new feature in

the docs.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5406 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2012-01-18 19:50:34 +00:00
parent 0e4f581f71
commit 7ecb4c50b1
11 changed files with 185 additions and 40 deletions

View File

@@ -6,10 +6,10 @@
/* */
/* */
/* */
/* (C) 2003-2007 Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* (C) 2003-2012, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
@@ -1206,7 +1206,7 @@ static void StudyWord0 (ExprNode* Expr, ExprDesc* D)
/* We can handle only const expressions */
if (ED_IsConst (D)) {
D->Val = (D->Val & 0xFFFFL);
D->Val &= 0xFFFFL;
} else {
ED_Invalidate (D);
}
@@ -1236,6 +1236,44 @@ static void StudyWord1 (ExprNode* Expr, ExprDesc* D)
static void StudyFarAddr (ExprNode* Expr, ExprDesc* D)
/* Study an EXPR_FARADDR expression node */
{
/* Study the expression */
StudyExprInternal (Expr->Left, D);
/* We can handle only const expressions */
if (ED_IsConst (D)) {
D->Val &= 0xFFFFFFL;
} else {
ED_Invalidate (D);
}
/* In any case, the result is a far address */
D->AddrSize = ADDR_SIZE_FAR;
}
static void StudyDWord (ExprNode* Expr, ExprDesc* D)
/* Study an EXPR_DWORD expression node */
{
/* Study the expression */
StudyExprInternal (Expr->Left, D);
/* We can handle only const expressions */
if (ED_IsConst (D)) {
D->Val &= 0xFFFFFFFFL;
} else {
ED_Invalidate (D);
}
/* In any case, the result is a long expression */
D->AddrSize = ADDR_SIZE_LONG;
}
static void StudyExprInternal (ExprNode* Expr, ExprDesc* D)
/* Study an expression tree and place the contents into D */
{
@@ -1390,6 +1428,14 @@ static void StudyExprInternal (ExprNode* Expr, ExprDesc* D)
StudyWord1 (Expr, D);
break;
case EXPR_FARADDR:
StudyFarAddr (Expr, D);
break;
case EXPR_DWORD:
StudyDWord (Expr, D);
break;
default:
Internal ("Unknown Op type: %u", Expr->Op);
break;