mirror of
https://github.com/cc65/cc65.git
synced 2025-08-13 08:25:28 +00:00
65C02 optimizations
git-svn-id: svn://svn.cc65.org/cc65/trunk@548 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -4106,10 +4106,18 @@ static Line* OptOneBlock (Line* L)
|
|||||||
Delete = 1;
|
Delete = 1;
|
||||||
} else if (LineMatch (L, "\tlda\t(")) {
|
} else if (LineMatch (L, "\tlda\t(")) {
|
||||||
if (IsXAddrMode (L)) {
|
if (IsXAddrMode (L)) {
|
||||||
/* lda (zp,x) - if Y and X are both zero, replace by
|
/* lda (zp,x). */
|
||||||
* load indirect y and save one cycle in some cases.
|
/* If X is zero and we have a 65C02 cpu, replace it by
|
||||||
|
* an indirect load.
|
||||||
*/
|
*/
|
||||||
if (X == 0 && Y == 0) {
|
if (X == 0 && CPU == CPU_65C02) {
|
||||||
|
unsigned Len = strlen (L->Line);
|
||||||
|
L->Line [Len-3] = ')';
|
||||||
|
L->Line [Len-2] = '\0';
|
||||||
|
/* If Y and X are both zero, replace by load indirect
|
||||||
|
* y and save one cycle in some cases.
|
||||||
|
*/
|
||||||
|
} else if (X == 0 && Y == 0) {
|
||||||
char Buf [256];
|
char Buf [256];
|
||||||
const char* S = L->Line + 6;
|
const char* S = L->Line + 6;
|
||||||
char* T = Buf + 6;
|
char* T = Buf + 6;
|
||||||
@@ -4123,6 +4131,15 @@ static Line* OptOneBlock (Line* L)
|
|||||||
*T = '\0';
|
*T = '\0';
|
||||||
L = ReplaceLine (L, Buf);
|
L = ReplaceLine (L, Buf);
|
||||||
}
|
}
|
||||||
|
} else if (IsYAddrMode (L)) {
|
||||||
|
/* lda (zp),y. If Y is zero and we have a 65C02 CPU,
|
||||||
|
* replace it by an indirect load.
|
||||||
|
*/
|
||||||
|
if (Y == 0 && CPU == CPU_65C02) {
|
||||||
|
unsigned Len = strlen (L->Line);
|
||||||
|
L->Line [Len-3] = ')';
|
||||||
|
L->Line [Len-2] = '\0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* In any case invalidate A */
|
/* In any case invalidate A */
|
||||||
A = -1;
|
A = -1;
|
||||||
|
Reference in New Issue
Block a user