From f5243e514c447245a1572b7cc3bb5741580558cb Mon Sep 17 00:00:00 2001 From: cuz Date: Wed, 2 Oct 2002 22:21:42 +0000 Subject: [PATCH] Fixed optimizer bug in or/xor git-svn-id: svn://svn.cc65.org/cc65/trunk@1425 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/coptstop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cc65/coptstop.c b/src/cc65/coptstop.c index 9466002ff..697a0b563 100644 --- a/src/cc65/coptstop.c +++ b/src/cc65/coptstop.c @@ -403,7 +403,7 @@ static unsigned Opt_tosorax (CodeSeg* S, unsigned Push, unsigned Or, X = NewCodeEntry (OP65_STX, AM65_ZP, ZPHi, 0, PushEntry->LI); CS_InsertEntry (S, X, Push+1); ++Or; /* Correct the index */ - if (DirectOr) { + if (!DirectOr) { X = NewCodeEntry (OP65_STA, AM65_ZP, ZPLo, 0, PushEntry->LI); CS_InsertEntry (S, X, Push+1); ++Or; /* Correct the index */ @@ -471,13 +471,13 @@ static unsigned Opt_tosxorax (CodeSeg* S, unsigned Push, unsigned Xor, * value in the zero page location. */ DirectXor = (P->OPC == OP65_LDA && - (P->AM == AM65_IMM || P->AM == AM65_ZP || P->AM == AM65_ABS)); + (P->AM == AM65_IMM || P->AM == AM65_ZP || P->AM == AM65_ABS)); /* Store the value into the zeropage instead of pushing it */ X = NewCodeEntry (OP65_STX, AM65_ZP, ZPHi, 0, PushEntry->LI); CS_InsertEntry (S, X, Push+1); ++Xor; /* Correct the index */ - if (DirectXor) { + if (!DirectXor) { X = NewCodeEntry (OP65_STA, AM65_ZP, ZPLo, 0, PushEntry->LI); CS_InsertEntry (S, X, Push+1); ++Xor; /* Correct the index */ -- 2.39.5