From 614d23b53a0ff29eecc5751d23ac93b26730b734 Mon Sep 17 00:00:00 2001 From: cuz Date: Thu, 27 Nov 2003 20:43:37 +0000 Subject: [PATCH] Fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@2688 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/coptind.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/cc65/coptind.c b/src/cc65/coptind.c index 6941a2c02..97f9dcfed 100644 --- a/src/cc65/coptind.c +++ b/src/cc65/coptind.c @@ -7,7 +7,7 @@ /* */ /* */ /* (C) 2001-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ +/* Römerstraße 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ @@ -1322,13 +1322,25 @@ unsigned OptPrecalc (CodeSeg* S) switch (E->OPC) { case OP65_LDA: + if (E->AM != AM65_IMM && RegValIsKnown (Out->RegA)) { + /* Result of load is known */ + Arg = MakeHexArg (Out->RegA); + } + break; + case OP65_LDX: + if (E->AM != AM65_IMM && RegValIsKnown (Out->RegX)) { + /* Result of load is known */ + Arg = MakeHexArg (Out->RegX); + } + break; + case OP65_LDY: - if (E->AM == AM65_IMM) { - /* If we do already have an immediate load, bail out */ - break; + if (E->AM != AM65_IMM && RegValIsKnown (Out->RegY)) { + /* Result of load is known */ + Arg = MakeHexArg (Out->RegY); } - /* FALLTHROUGH */ + break; case OP65_ADC: case OP65_ASL: @@ -1336,7 +1348,7 @@ unsigned OptPrecalc (CodeSeg* S) case OP65_LSR: case OP65_SBC: if (RegValIsKnown (Out->RegA)) { - /* Accu AND zp with known contents */ + /* Accu op zp with known contents */ Arg = MakeHexArg (Out->RegA); } break; -- 2.39.5