]> git.sur5r.net Git - cc65/commitdiff
Added handling of new expression opcodes.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 19 Jan 2012 11:55:36 +0000 (11:55 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 19 Jan 2012 11:55:36 +0000 (11:55 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5411 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/ld65/expr.c
src/ld65/o65.c

index f45aa178754f5b4d157da09a3c80be7dc861a42f..966c40698d39706b944c7b92d1d196f280b8f9ff 100644 (file)
@@ -408,6 +408,12 @@ long GetExprVal (ExprNode* Expr)
 
                case EXPR_WORD1:
            return (GetExprVal (Expr->Left) >> 16) & 0xFFFF;
+             
+        case EXPR_FARADDR:
+            return GetExprVal (Expr->Left) & 0xFFFFFF;
+
+        case EXPR_DWORD:
+            return GetExprVal (Expr->Left) & 0xFFFFFFFF;
 
         default:
                    Internal ("Unknown expression Op type: %u", Expr->Op);
index 6931d3d6cb1b699c236138d93328df308200b543..9f2673943da71a3a2a7eae7b2456b15628345073 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1999-2011, Ullrich von Bassewitz                                      */
+/* (C) 1999-2012, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
@@ -629,9 +629,10 @@ static unsigned O65WriteExpr (ExprNode* E, int Signed, unsigned Size,
 
     /* Determine the expression to relocate */
     Expr = E;
-    if (E->Op == EXPR_BYTE0 || E->Op == EXPR_BYTE1 ||
-               E->Op == EXPR_BYTE2 || E->Op == EXPR_BYTE3 ||
-               E->Op == EXPR_WORD0 || E->Op == EXPR_WORD1) {
+    if (E->Op == EXPR_BYTE0   || E->Op == EXPR_BYTE1 ||
+               E->Op == EXPR_BYTE2   || E->Op == EXPR_BYTE3 ||
+               E->Op == EXPR_WORD0   || E->Op == EXPR_WORD1 ||
+        E->Op == EXPR_FARADDR || E->Op == EXPR_DWORD) {
                /* Use the real expression */
                Expr = E->Left;
     }
@@ -674,6 +675,8 @@ static unsigned O65WriteExpr (ExprNode* E, int Signed, unsigned Size,
                case EXPR_BYTE3:    BinVal = (BinVal >> 24) & 0xFF;     break;
                case EXPR_WORD0:    BinVal &= 0xFFFF;                   break;
                case EXPR_WORD1:    BinVal = (BinVal >> 16) & 0xFFFF;   break;
+        case EXPR_FARADDR:  BinVal &= 0xFFFFFFUL;               break;
+        case EXPR_DWORD:    BinVal &= 0xFFFFFFFFUL;             break;
     }
     WriteVal (D->F, BinVal, Size);
 
@@ -846,7 +849,7 @@ static void O65WriteBssSeg (O65Desc* D)
     /* Initialize variables */
     D->CurReloc        = 0;
 
-    /* Dump all bss segments */               
+    /* Dump all bss segments */
     O65WriteSeg (D, D->BssSeg, D->BssCount, 0);
 
     /* Set the size of the segment */