From: cuz Date: Mon, 10 Dec 2001 18:01:53 +0000 (+0000) Subject: Fixed a bug X-Git-Tag: V2.12.0~2473 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5f8c0269d6d6905250ae0eadc4b95268555bc054;p=cc65 Fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@1137 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/coptcmp.c b/src/cc65/coptcmp.c index a88e7047d..c185ecc27 100644 --- a/src/cc65/coptcmp.c +++ b/src/cc65/coptcmp.c @@ -670,17 +670,16 @@ unsigned OptCmp4 (CodeSeg* S) /* Change the code to just use the A register. Move the load * of the low byte after the first branch if possible: * - * ldy #o-1 + * ldy #o * lda (sp),y * cmp #a * bne L1 - * ldy #o + * ldy #o-1 * lda (sp),y * cmp #b * jne/jeq ... */ - sprintf (Buf, "$%02X", (int)(L[0]->Num-1)); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Buf, 0, L[0]->LI); + X = NewCodeEntry (OP65_LDY, AM65_IMM, L[0]->Arg, 0, L[0]->LI); CS_InsertEntry (S, X, I+3); X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); @@ -689,7 +688,8 @@ unsigned OptCmp4 (CodeSeg* S) X = NewCodeEntry (OP65_CMP, L[2]->AM, L[2]->Arg, 0, L[2]->LI); CS_InsertEntry (S, X, I+5); - X = NewCodeEntry (OP65_LDY, AM65_IMM, L[0]->Arg, 0, L[0]->LI); + sprintf (Buf, "$%02X", (int)(L[0]->Num-1)); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Buf, 0, L[0]->LI); CS_InsertEntry (S, X, I+7); X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI);