From 772d51aa5e58eef1333e2752ae652f5be3b83fd0 Mon Sep 17 00:00:00 2001 From: uz Date: Thu, 19 Jan 2012 11:55:36 +0000 Subject: [PATCH] Added handling of new expression opcodes. git-svn-id: svn://svn.cc65.org/cc65/trunk@5411 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ld65/expr.c | 6 ++++++ src/ld65/o65.c | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/ld65/expr.c b/src/ld65/expr.c index f45aa1787..966c40698 100644 --- a/src/ld65/expr.c +++ b/src/ld65/expr.c @@ -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); diff --git a/src/ld65/o65.c b/src/ld65/o65.c index 6931d3d6c..9f2673943 100644 --- a/src/ld65/o65.c +++ b/src/ld65/o65.c @@ -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 */ -- 2.39.5