From 867b2ea2ed73fb8dfadd638b6b617d8ec6de1d63 Mon Sep 17 00:00:00 2001 From: cuz Date: Wed, 4 Dec 2002 11:03:15 +0000 Subject: [PATCH] Fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@1714 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/coptstop.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cc65/coptstop.c b/src/cc65/coptstop.c index c632fd5fe..2a479ed41 100644 --- a/src/cc65/coptstop.c +++ b/src/cc65/coptstop.c @@ -208,8 +208,12 @@ static void CheckDirectOp (StackOpData* D) if (E->AM == AM65_IMM || E->AM == AM65_ZP || E->AM == AM65_ABS) { /* These insns are all ok and replaceable */ D->Flags |= OP_DIRECT; - } else if (E->AM == AM65_ZP_INDY && RegValIsKnown (E->RI->In.RegY)) { - /* Load indirect with known offset is also ok */ + } else if (E->AM == AM65_ZP_INDY && RegValIsKnown (E->RI->In.RegY) && + strcmp (E->Arg, D->ZPLo) != 0 && strcmp (E->Arg, D->ZPHi) != 0) { + /* Load indirect with known offset is also ok, provided that + * the zeropage location used is not the same as the one we're + * using for the temp storage. + */ D->Flags |= (OP_DIRECT | OP_RELOAD_Y); } } -- 2.39.5