New function GenAddExpr
git-svn-id: svn://svn.cc65.org/cc65/trunk@2664 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -1641,6 +1641,17 @@ static ExprNode* GenSectionExpr (unsigned SegNum)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ExprNode* GenAddExpr (ExprNode* Left, ExprNode* Right)
|
||||||
|
/* Generate an addition from the two operands */
|
||||||
|
{
|
||||||
|
ExprNode* Root = NewExprNode (EXPR_PLUS);
|
||||||
|
Root->Left = Left;
|
||||||
|
Root->Right = Right;
|
||||||
|
return Root;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ExprNode* GenCurrentPC (void)
|
ExprNode* GenCurrentPC (void)
|
||||||
/* Return the current program counter as expression */
|
/* Return the current program counter as expression */
|
||||||
{
|
{
|
||||||
@@ -1648,9 +1659,8 @@ ExprNode* GenCurrentPC (void)
|
|||||||
|
|
||||||
if (RelocMode) {
|
if (RelocMode) {
|
||||||
/* Create SegmentBase + Offset */
|
/* Create SegmentBase + Offset */
|
||||||
Root = NewExprNode (EXPR_PLUS);
|
Root = GenAddExpr (GenSectionExpr (GetCurrentSegNum ()),
|
||||||
Root->Left = GenSectionExpr (GetCurrentSegNum ());
|
GenLiteralExpr (GetPC ()));
|
||||||
Root->Right = GenLiteralExpr (GetPC ());
|
|
||||||
} else {
|
} else {
|
||||||
/* Absolute mode, just return PC value */
|
/* Absolute mode, just return PC value */
|
||||||
Root = GenLiteralExpr (GetPC ());
|
Root = GenLiteralExpr (GetPC ());
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ ExprNode* GenLiteralExpr (long Val);
|
|||||||
ExprNode* GenSymExpr (struct SymEntry* Sym);
|
ExprNode* GenSymExpr (struct SymEntry* Sym);
|
||||||
/* Return an expression node that encodes the given symbol */
|
/* Return an expression node that encodes the given symbol */
|
||||||
|
|
||||||
|
ExprNode* GenAddExpr (ExprNode* Left, ExprNode* Right);
|
||||||
|
/* Generate an addition from the two operands */
|
||||||
|
|
||||||
ExprNode* GenCurrentPC (void);
|
ExprNode* GenCurrentPC (void);
|
||||||
/* Return the current program counter as expression */
|
/* Return the current program counter as expression */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user