Don't allow to call subroutines that aren't actual functions.
git-svn-id: svn://svn.cc65.org/cc65/trunk@3994 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -337,13 +337,13 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
|
|||||||
if (*L == ',') {
|
if (*L == ',') {
|
||||||
L = SkipSpace (L+1);
|
L = SkipSpace (L+1);
|
||||||
if (toupper (*L) != 'Y') {
|
if (toupper (*L) != 'Y') {
|
||||||
Error ("ASM code error: `Y' expected");
|
Error ("ASM code error: `Y' expected");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
L = SkipSpace (L+1);
|
L = SkipSpace (L+1);
|
||||||
if (*L != '\0') {
|
if (*L != '\0') {
|
||||||
Error ("ASM code error: syntax error");
|
Error ("ASM code error: syntax error");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
AM = AM65_ZP_INDY;
|
AM = AM65_ZP_INDY;
|
||||||
} else if (*L == '\0') {
|
} else if (*L == '\0') {
|
||||||
@@ -375,6 +375,12 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
|
|||||||
} else if (GetZPInfo(Arg) != 0) {
|
} else if (GetZPInfo(Arg) != 0) {
|
||||||
AM = AM65_ZP;
|
AM = AM65_ZP;
|
||||||
} else {
|
} else {
|
||||||
|
/* Check for subroutine call to local label */
|
||||||
|
if ((OPC->Info & OF_CALL) && IsLocalLabelName (Arg)) {
|
||||||
|
Error ("ASM code error: "
|
||||||
|
"Cannot use local label `%s' in subroutine call",
|
||||||
|
Arg);
|
||||||
|
}
|
||||||
AM = AM65_ABS;
|
AM = AM65_ABS;
|
||||||
}
|
}
|
||||||
} else if (*L == ',') {
|
} else if (*L == ',') {
|
||||||
@@ -387,20 +393,20 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L)
|
|||||||
Reg = toupper (*L);
|
Reg = toupper (*L);
|
||||||
L = SkipSpace (L+1);
|
L = SkipSpace (L+1);
|
||||||
if (Reg == 'X') {
|
if (Reg == 'X') {
|
||||||
if (GetZPInfo(Arg) != 0) {
|
if (GetZPInfo(Arg) != 0) {
|
||||||
AM = AM65_ZPX;
|
AM = AM65_ZPX;
|
||||||
} else {
|
} else {
|
||||||
AM = AM65_ABSX;
|
AM = AM65_ABSX;
|
||||||
}
|
}
|
||||||
} else if (Reg == 'Y') {
|
} else if (Reg == 'Y') {
|
||||||
AM = AM65_ABSY;
|
AM = AM65_ABSY;
|
||||||
} else {
|
} else {
|
||||||
Error ("ASM code error: syntax error");
|
Error ("ASM code error: syntax error");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (*L != '\0') {
|
if (*L != '\0') {
|
||||||
Error ("ASM code error: syntax error");
|
Error ("ASM code error: syntax error");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user