Check for usage of Y instead of reloading it. The latter will destroy the
flags from load of A. git-svn-id: svn://svn.cc65.org/cc65/trunk@4055 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
7c55f30627
commit
1b4e2111c3
1 changed files with 2 additions and 6 deletions
|
@ -566,7 +566,6 @@ unsigned OptPtrLoad6 (CodeSeg* S)
|
||||||
* tay
|
* tay
|
||||||
* ldx #$00
|
* ldx #$00
|
||||||
* lda (ptr1),y
|
* lda (ptr1),y
|
||||||
* ldy #$00
|
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
unsigned Changes = 0;
|
unsigned Changes = 0;
|
||||||
|
@ -594,7 +593,8 @@ unsigned OptPtrLoad6 (CodeSeg* S)
|
||||||
L[5]->OPC == OP65_LDY &&
|
L[5]->OPC == OP65_LDY &&
|
||||||
CE_IsKnownImm (L[5], 0) &&
|
CE_IsKnownImm (L[5], 0) &&
|
||||||
CE_IsCallTo (L[6], "ldauidx") &&
|
CE_IsCallTo (L[6], "ldauidx") &&
|
||||||
!CS_RangeHasLabel (S, I+1, 6)) {
|
!CS_RangeHasLabel (S, I+1, 6) &&
|
||||||
|
!RegYUsed (S, I+7)) {
|
||||||
|
|
||||||
CodeEntry* X;
|
CodeEntry* X;
|
||||||
const char* Arg;
|
const char* Arg;
|
||||||
|
@ -628,10 +628,6 @@ unsigned OptPtrLoad6 (CodeSeg* S)
|
||||||
X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[6]->LI);
|
X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[6]->LI);
|
||||||
CS_InsertEntry (S, X, I+13);
|
CS_InsertEntry (S, X, I+13);
|
||||||
|
|
||||||
/* ldy #$00 (will eventually get removed later) */
|
|
||||||
X = NewCodeEntry (OP65_LDY, AM65_IMM, "$00", 0, L[5]->LI);
|
|
||||||
CS_InsertEntry (S, X, I+14);
|
|
||||||
|
|
||||||
/* Remove the old code */
|
/* Remove the old code */
|
||||||
CS_DelEntries (S, I, 7);
|
CS_DelEntries (S, I, 7);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue