Added new .feature: pc_assignment
git-svn-id: svn://svn.cc65.org/cc65/trunk@310 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -147,6 +147,7 @@ void ErrorMsg (const FilePos* Pos, unsigned ErrNum, va_list ap)
|
|||||||
"Identifier expected",
|
"Identifier expected",
|
||||||
"`.endmacro' expected",
|
"`.endmacro' expected",
|
||||||
"Option key expected",
|
"Option key expected",
|
||||||
|
"`=' expected",
|
||||||
"Command is only valid in 65816 mode",
|
"Command is only valid in 65816 mode",
|
||||||
"User error: %s",
|
"User error: %s",
|
||||||
"String constant too long",
|
"String constant too long",
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ enum Errors {
|
|||||||
ERR_IDENT_EXPECTED,
|
ERR_IDENT_EXPECTED,
|
||||||
ERR_ENDMACRO_EXPECTED,
|
ERR_ENDMACRO_EXPECTED,
|
||||||
ERR_OPTION_KEY_EXPECTED,
|
ERR_OPTION_KEY_EXPECTED,
|
||||||
|
ERR_EQ_EXPECTED,
|
||||||
ERR_816_MODE_ONLY,
|
ERR_816_MODE_ONLY,
|
||||||
ERR_USER,
|
ERR_USER,
|
||||||
ERR_STRING_TOO_LONG,
|
ERR_STRING_TOO_LONG,
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ unsigned char NoColonLabels = 0; /* Allow labels without a colon */
|
|||||||
unsigned char LooseStringTerm = 0; /* Allow ' as string terminator */
|
unsigned char LooseStringTerm = 0; /* Allow ' as string terminator */
|
||||||
unsigned char AtInIdents = 0; /* Allow '@' in identifiers */
|
unsigned char AtInIdents = 0; /* Allow '@' in identifiers */
|
||||||
unsigned char DollarInIdents = 0; /* Allow '$' in identifiers */
|
unsigned char DollarInIdents = 0; /* Allow '$' in identifiers */
|
||||||
|
unsigned char PCAssignment = 0; /* Allow "* = $XXX" or "$ = $XXX" */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ extern unsigned char NoColonLabels; /* Allow labels without a colon */
|
|||||||
extern unsigned char LooseStringTerm;/* Allow ' as string terminator */
|
extern unsigned char LooseStringTerm;/* Allow ' as string terminator */
|
||||||
extern unsigned char AtInIdents; /* Allow '@' in identifiers */
|
extern unsigned char AtInIdents; /* Allow '@' in identifiers */
|
||||||
extern unsigned char DollarInIdents; /* Allow '$' in identifiers */
|
extern unsigned char DollarInIdents; /* Allow '$' in identifiers */
|
||||||
|
extern unsigned char PCAssignment; /* Allow "* = $XXX" or "$ = $XXX" */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -314,6 +314,19 @@ static void OptVersion (const char* Opt, const char* Arg)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void DoPCAssign (void)
|
||||||
|
/* Start absolute code */
|
||||||
|
{
|
||||||
|
long PC = ConstExpression ();
|
||||||
|
if (PC < 0 || PC > 0xFFFFFF) {
|
||||||
|
Error (ERR_RANGE);
|
||||||
|
} else {
|
||||||
|
SetAbsPC (PC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void OneLine (void)
|
static void OneLine (void)
|
||||||
/* Assemble one line */
|
/* Assemble one line */
|
||||||
{
|
{
|
||||||
@@ -394,6 +407,17 @@ static void OneLine (void)
|
|||||||
} else if (Tok == TOK_IDENT && IsMacro (SVal)) {
|
} else if (Tok == TOK_IDENT && IsMacro (SVal)) {
|
||||||
/* A macro expansion */
|
/* A macro expansion */
|
||||||
MacExpandStart ();
|
MacExpandStart ();
|
||||||
|
} else if (PCAssignment && (Tok == TOK_STAR || Tok == TOK_PC)) {
|
||||||
|
NextTok ();
|
||||||
|
if (Tok != TOK_EQ) {
|
||||||
|
Error (ERR_EQ_EXPECTED);
|
||||||
|
SkipUntilSep ();
|
||||||
|
} else {
|
||||||
|
/* Skip the equal sign */
|
||||||
|
NextTok ();
|
||||||
|
/* Enter absolute mode */
|
||||||
|
DoPCAssign ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -519,6 +519,7 @@ static void DoFeature (void)
|
|||||||
"LOOSE_STRING_TERM",
|
"LOOSE_STRING_TERM",
|
||||||
"AT_IN_IDENTIFIERS",
|
"AT_IN_IDENTIFIERS",
|
||||||
"DOLLAR_IN_IDENTIFIERS",
|
"DOLLAR_IN_IDENTIFIERS",
|
||||||
|
"PC_ASSIGNMENT",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Allow a list of comma separated keywords */
|
/* Allow a list of comma separated keywords */
|
||||||
@@ -548,6 +549,7 @@ static void DoFeature (void)
|
|||||||
case 2: LooseStringTerm = 1; break;
|
case 2: LooseStringTerm = 1; break;
|
||||||
case 3: AtInIdents = 1; break;
|
case 3: AtInIdents = 1; break;
|
||||||
case 4: DollarInIdents = 1; break;
|
case 4: DollarInIdents = 1; break;
|
||||||
|
case 5: PCAssignment = 1; break;
|
||||||
default: Internal ("Invalid feature: %d", Feature);
|
default: Internal ("Invalid feature: %d", Feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -870,7 +872,7 @@ static void DoOrg (void)
|
|||||||
/* Start absolute code */
|
/* Start absolute code */
|
||||||
{
|
{
|
||||||
long PC = ConstExpression ();
|
long PC = ConstExpression ();
|
||||||
if (PC < 0 || PC > 0xFFFF) {
|
if (PC < 0 || PC > 0xFFFFFF) {
|
||||||
Error (ERR_RANGE);
|
Error (ERR_RANGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user