mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 19:29:37 +00:00
Use X instead of Y register
git-svn-id: svn://svn.cc65.org/cc65/trunk@961 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
fa1f814be5
commit
f3b401cd21
@ -1885,7 +1885,7 @@ static unsigned OptPtrStore2 (CodeSeg* S)
|
|||||||
{
|
{
|
||||||
unsigned Changes = 0;
|
unsigned Changes = 0;
|
||||||
|
|
||||||
/* Walk over the entries */
|
/* Walk over the entries */
|
||||||
unsigned I = 0;
|
unsigned I = 0;
|
||||||
while (I < CS_GetEntryCount (S)) {
|
while (I < CS_GetEntryCount (S)) {
|
||||||
|
|
||||||
@ -2233,9 +2233,9 @@ static unsigned OptPtrLoad4 (CodeSeg* S)
|
|||||||
*
|
*
|
||||||
* and replace it by:
|
* and replace it by:
|
||||||
*
|
*
|
||||||
* ldy xxx
|
* ldx xxx
|
||||||
|
* lda label,x
|
||||||
* ldx #$00
|
* ldx #$00
|
||||||
* lda label,y
|
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
unsigned Changes = 0;
|
unsigned Changes = 0;
|
||||||
@ -2288,18 +2288,18 @@ static unsigned OptPtrLoad4 (CodeSeg* S)
|
|||||||
/* We will create all the new stuff behind the current one so
|
/* We will create all the new stuff behind the current one so
|
||||||
* we keep the line references.
|
* we keep the line references.
|
||||||
*/
|
*/
|
||||||
X = NewCodeEntry (OP65_LDY, L[3]->AM, L[3]->Arg, 0, L[0]->LI);
|
X = NewCodeEntry (OP65_LDX, L[3]->AM, L[3]->Arg, 0, L[0]->LI);
|
||||||
CS_InsertEntry (S, X, I+8);
|
CS_InsertEntry (S, X, I+8);
|
||||||
|
|
||||||
X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[0]->LI);
|
|
||||||
CS_InsertEntry (S, X, I+9);
|
|
||||||
|
|
||||||
Label = memcpy (xmalloc (Len-2), L[0]->Arg+2, Len-3);
|
Label = memcpy (xmalloc (Len-2), L[0]->Arg+2, Len-3);
|
||||||
Label[Len-3] = '\0';
|
Label[Len-3] = '\0';
|
||||||
X = NewCodeEntry (OP65_LDA, AM65_ABSY, Label, 0, L[0]->LI);
|
X = NewCodeEntry (OP65_LDA, AM65_ABSX, Label, 0, L[0]->LI);
|
||||||
CS_InsertEntry (S, X, I+10);
|
CS_InsertEntry (S, X, I+9);
|
||||||
xfree (Label);
|
xfree (Label);
|
||||||
|
|
||||||
|
X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[0]->LI);
|
||||||
|
CS_InsertEntry (S, X, I+10);
|
||||||
|
|
||||||
/* Remove the old code */
|
/* Remove the old code */
|
||||||
CS_DelEntries (S, I, 8);
|
CS_DelEntries (S, I, 8);
|
||||||
|
|
||||||
@ -2335,10 +2335,10 @@ static unsigned OptPtrLoad5 (CodeSeg* S)
|
|||||||
* and replace it by:
|
* and replace it by:
|
||||||
*
|
*
|
||||||
* ldy #$xx
|
* ldy #$xx
|
||||||
* ldx #$00
|
|
||||||
* lda (sp),y
|
* lda (sp),y
|
||||||
* tay
|
* tax
|
||||||
* lda label,y
|
* lda label,x
|
||||||
|
* ldx #$00
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
unsigned Changes = 0;
|
unsigned Changes = 0;
|
||||||
@ -2391,25 +2391,25 @@ static unsigned OptPtrLoad5 (CodeSeg* S)
|
|||||||
CodeEntry* X;
|
CodeEntry* X;
|
||||||
char* Label;
|
char* Label;
|
||||||
|
|
||||||
/* Add the ldx */
|
|
||||||
X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[0]->LI);
|
|
||||||
CS_InsertEntry (S, X, I+3);
|
|
||||||
|
|
||||||
/* Add the lda */
|
/* Add the lda */
|
||||||
X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, L[4]->Arg, 0, L[0]->LI);
|
X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, L[4]->Arg, 0, L[0]->LI);
|
||||||
CS_InsertEntry (S, X, I+4);
|
CS_InsertEntry (S, X, I+3);
|
||||||
|
|
||||||
/* Add the tay */
|
/* Add the tax */
|
||||||
X = NewCodeEntry (OP65_TAY, AM65_IMP, 0, 0, L[0]->LI);
|
X = NewCodeEntry (OP65_TAX, AM65_IMP, 0, 0, L[0]->LI);
|
||||||
CS_InsertEntry (S, X, I+5);
|
CS_InsertEntry (S, X, I+4);
|
||||||
|
|
||||||
/* Add the lda */
|
/* Add the lda */
|
||||||
Label = memcpy (xmalloc (Len-2), L[0]->Arg+2, Len-3);
|
Label = memcpy (xmalloc (Len-2), L[0]->Arg+2, Len-3);
|
||||||
Label[Len-3] = '\0';
|
Label[Len-3] = '\0';
|
||||||
X = NewCodeEntry (OP65_LDA, AM65_ABSY, Label, 0, L[0]->LI);
|
X = NewCodeEntry (OP65_LDA, AM65_ABSX, Label, 0, L[0]->LI);
|
||||||
CS_InsertEntry (S, X, I+6);
|
CS_InsertEntry (S, X, I+5);
|
||||||
xfree (Label);
|
xfree (Label);
|
||||||
|
|
||||||
|
/* Add the ldx */
|
||||||
|
X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[0]->LI);
|
||||||
|
CS_InsertEntry (S, X, I+6);
|
||||||
|
|
||||||
/* Remove the old code */
|
/* Remove the old code */
|
||||||
CS_DelEntries (S, I, 2);
|
CS_DelEntries (S, I, 2);
|
||||||
CS_DelEntries (S, I+5, 6);
|
CS_DelEntries (S, I+5, 6);
|
||||||
|
Loading…
Reference in New Issue
Block a user