Mark segments that are referenced in a .BANK statement.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5383 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
#include "exprdefs.h"
|
#include "exprdefs.h"
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
#include "shift.h"
|
#include "shift.h"
|
||||||
|
#include "segdefs.h"
|
||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
#include "tgttrans.h"
|
#include "tgttrans.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
@@ -1839,10 +1840,16 @@ ExprNode* FinalizeExpr (ExprNode* Expr, const Collection* LineInfos)
|
|||||||
LIError (LineInfos,
|
LIError (LineInfos,
|
||||||
"Too many segment references in argument to .BANK");
|
"Too many segment references in argument to .BANK");
|
||||||
} else {
|
} else {
|
||||||
|
Segment* S;
|
||||||
|
|
||||||
FreeExpr (Expr->Left);
|
FreeExpr (Expr->Left);
|
||||||
Expr->Op = EXPR_BANK;
|
Expr->Op = EXPR_BANK;
|
||||||
Expr->Left = 0;
|
Expr->Left = 0;
|
||||||
Expr->V.SecNum = ED.SecRef[0].Ref;
|
Expr->V.SecNum = ED.SecRef[0].Ref;
|
||||||
|
|
||||||
|
/* Mark the segment */
|
||||||
|
S = CollAt (&SegmentList, Expr->V.SecNum);
|
||||||
|
S->Flags |= SEG_FLAG_BANKREF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ SegDef* DupSegDef (const SegDef* D);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* End of segdefs.h */
|
/* End of segdef.h */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include "alignment.h"
|
#include "alignment.h"
|
||||||
#include "coll.h"
|
#include "coll.h"
|
||||||
#include "mmodel.h"
|
#include "mmodel.h"
|
||||||
|
#include "segdefs.h"
|
||||||
#include "segnames.h"
|
#include "segnames.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
@@ -107,6 +108,7 @@ static Segment* NewSegFromDef (SegDef* Def)
|
|||||||
S->Last = 0;
|
S->Last = 0;
|
||||||
S->FragCount = 0;
|
S->FragCount = 0;
|
||||||
S->Num = CollCount (&SegmentList);
|
S->Num = CollCount (&SegmentList);
|
||||||
|
S->Flags = SEG_FLAG_NONE;
|
||||||
S->Align = 1;
|
S->Align = 1;
|
||||||
S->RelocMode = 1;
|
S->RelocMode = 1;
|
||||||
S->PC = 0;
|
S->PC = 0;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 1998-2011, Ullrich von Bassewitz */
|
/* (C) 1998-2012, Ullrich von Bassewitz */
|
||||||
/* Roemerstrasse 52 */
|
/* Roemerstrasse 52 */
|
||||||
/* D-70794 Filderstadt */
|
/* D-70794 Filderstadt */
|
||||||
/* EMail: uz@cc65.org */
|
/* EMail: uz@cc65.org */
|
||||||
@@ -62,6 +62,7 @@ struct Segment {
|
|||||||
Fragment* Last; /* Pointer to last fragment */
|
Fragment* Last; /* Pointer to last fragment */
|
||||||
unsigned long FragCount; /* Number of fragments */
|
unsigned long FragCount; /* Number of fragments */
|
||||||
unsigned Num; /* Segment number */
|
unsigned Num; /* Segment number */
|
||||||
|
unsigned Flags; /* Segment flags */
|
||||||
unsigned long Align; /* Segment alignment */
|
unsigned long Align; /* Segment alignment */
|
||||||
int RelocMode; /* Relocatable mode if OrgPerSeg */
|
int RelocMode; /* Relocatable mode if OrgPerSeg */
|
||||||
unsigned long PC; /* PC if in relocatable mode */
|
unsigned long PC; /* PC if in relocatable mode */
|
||||||
|
|||||||
58
src/common/segdefs.h
Normal file
58
src/common/segdefs.h
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/*****************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* segdefs.h */
|
||||||
|
/* */
|
||||||
|
/* Constants and flags for segments */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* (C) 2012, Ullrich von Bassewitz */
|
||||||
|
/* Roemerstrasse 52 */
|
||||||
|
/* D-70794 Filderstadt */
|
||||||
|
/* EMail: uz@cc65.org */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
/* warranty. In no event will the authors be held liable for any damages */
|
||||||
|
/* arising from the use of this software. */
|
||||||
|
/* */
|
||||||
|
/* Permission is granted to anyone to use this software for any purpose, */
|
||||||
|
/* including commercial applications, and to alter it and redistribute it */
|
||||||
|
/* freely, subject to the following restrictions: */
|
||||||
|
/* */
|
||||||
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
||||||
|
/* claim that you wrote the original software. If you use this software */
|
||||||
|
/* in a product, an acknowledgment in the product documentation would be */
|
||||||
|
/* appreciated but is not required. */
|
||||||
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
||||||
|
/* be misrepresented as being the original software. */
|
||||||
|
/* 3. This notice may not be removed or altered from any source */
|
||||||
|
/* distribution. */
|
||||||
|
/* */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef SEGDEFS_H
|
||||||
|
#define SEGDEFS_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Data */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Segment flags */
|
||||||
|
#define SEG_FLAG_NONE 0x00
|
||||||
|
#define SEG_FLAG_BANKREF 0x01 /* Segment is referenced by .BANK */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* End of segdefs.h */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user