]> git.sur5r.net Git - cc65/blobdiff - src/ca65/studyexpr.c
Started to add a new .BANK instruction that allows access to a memory area
[cc65] / src / ca65 / studyexpr.c
index b21f3b28bbc375b43a2648b14ee987eb77096295..b9f8d194651a7cb996450d1bbe5623fa9ef8743f 100644 (file)
@@ -1095,6 +1095,33 @@ static void StudyBoolNot (ExprNode* Expr, ExprDesc* D)
 
 
 
+static void StudyBank (ExprNode* Expr, ExprDesc* D)
+/* Study an EXPR_BANK expression node */
+{
+    /* Get the section reference */
+    ED_SecRef* SecRef = ED_GetSecRef (D, Expr->V.SecNum);
+
+    /* Update the data and the address size */
+    ++SecRef->Count;
+
+    /* The expression is always linker evaluated, so invalidate it */
+    ED_Invalidate (D);
+}
+
+
+
+static void StudyBankRaw (ExprNode* Expr, ExprDesc* D)
+/* Study an EXPR_BANKRAW expression node */
+{
+    /* Study the expression extracting section references */
+    StudyExprInternal (Expr->Left, D);
+
+    /* The expression is always linker evaluated, so invalidate it */
+    ED_Invalidate (D);
+}
+
+
+
 static void StudyByte0 (ExprNode* Expr, ExprDesc* D)
 /* Study an EXPR_BYTE0 expression node */
 {
@@ -1231,6 +1258,10 @@ static void StudyExprInternal (ExprNode* Expr, ExprDesc* D)
             StudyULabel (Expr, D);
             break;
 
+        case EXPR_BANK:
+            StudyBank (Expr, D);
+            break;
+
        case EXPR_PLUS:
             StudyPlus (Expr, D);
            break;
@@ -1331,6 +1362,10 @@ static void StudyExprInternal (ExprNode* Expr, ExprDesc* D)
             StudyBoolNot (Expr, D);
             break;
 
+        case EXPR_BANKRAW:
+            StudyBankRaw (Expr, D);
+            break;
+
         case EXPR_BYTE0:
             StudyByte0 (Expr, D);
             break;