mirror of
https://github.com/cc65/cc65.git
synced 2025-01-16 13:31:16 +00:00
Fixed a bug
git-svn-id: svn://svn.cc65.org/cc65/trunk@895 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
745cf9a6b3
commit
1a39515769
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* codeopt.c */
|
/* codeopt.c */
|
||||||
@ -552,7 +553,7 @@ static unsigned OptAdd1 (CodeSeg* S)
|
|||||||
*
|
*
|
||||||
* and replace it by:
|
* and replace it by:
|
||||||
*
|
*
|
||||||
* ldy xxx
|
* ldy xxx-2
|
||||||
* clc
|
* clc
|
||||||
* adc (sp),y
|
* adc (sp),y
|
||||||
* bcc L
|
* bcc L
|
||||||
@ -576,6 +577,7 @@ static unsigned OptAdd1 (CodeSeg* S)
|
|||||||
strcmp (E->Arg, "pushax") == 0 &&
|
strcmp (E->Arg, "pushax") == 0 &&
|
||||||
CS_GetEntries (S, L, I+1, 5) &&
|
CS_GetEntries (S, L, I+1, 5) &&
|
||||||
L[0]->OPC == OP65_LDY &&
|
L[0]->OPC == OP65_LDY &&
|
||||||
|
CE_KnownImm (L[0]) &&
|
||||||
!CE_HasLabel (L[0]) &&
|
!CE_HasLabel (L[0]) &&
|
||||||
L[1]->OPC == OP65_LDX &&
|
L[1]->OPC == OP65_LDX &&
|
||||||
CE_KnownImm (L[1]) &&
|
CE_KnownImm (L[1]) &&
|
||||||
@ -589,10 +591,16 @@ static unsigned OptAdd1 (CodeSeg* S)
|
|||||||
|
|
||||||
CodeEntry* X;
|
CodeEntry* X;
|
||||||
CodeLabel* Label;
|
CodeLabel* Label;
|
||||||
|
char Buf [16];
|
||||||
|
|
||||||
/* Remove the call to pushax */
|
/* Remove the call to pushax */
|
||||||
CS_DelEntry (S, I);
|
CS_DelEntry (S, I);
|
||||||
|
|
||||||
|
/* Correct the stack offset (needed since pushax was removed) */
|
||||||
|
L[0]->Num -= 2;
|
||||||
|
xsprintf (Buf, sizeof (Buf), "$%02lX", L[0]->Num);
|
||||||
|
CE_SetArg (L[0], Buf);
|
||||||
|
|
||||||
/* Add the clc . */
|
/* Add the clc . */
|
||||||
X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[3]->LI);
|
X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[3]->LI);
|
||||||
CS_InsertEntry (S, X, I+1);
|
CS_InsertEntry (S, X, I+1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user