From: cuz Date: Sat, 5 Jun 2004 16:18:30 +0000 (+0000) Subject: Generate LDY instead of INY whenever possible because this allows better X-Git-Tag: V2.12.0~734 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=522f1d86d4ed6adb2e33e72cecfd135f3e4a074c;p=cc65 Generate LDY instead of INY whenever possible because this allows better detection of known patterns and is replaced by INY in a later step anyway. git-svn-id: svn://svn.cc65.org/cc65/trunk@3098 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/coptstop.c b/src/cc65/coptstop.c index 57aa51b78..6eab4affe 100644 --- a/src/cc65/coptstop.c +++ b/src/cc65/coptstop.c @@ -481,7 +481,13 @@ static unsigned Opt_staxspidx (StackOpData* D) /* Inline the store */ X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, D->ZPLo, 0, D->OpEntry->LI); InsertEntry (D, X, D->OpIndex+1); - X = NewCodeEntry (OP65_INY, AM65_IMP, 0, 0, D->OpEntry->LI); + if (RegValIsKnown (D->OpEntry->RI->In.RegY)) { + /* Value of Y is known */ + const char* Arg = MakeHexArg (D->OpEntry->RI->In.RegY + 1); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, D->OpEntry->LI); + } else { + X = NewCodeEntry (OP65_INY, AM65_IMP, 0, 0, D->OpEntry->LI); + } InsertEntry (D, X, D->OpIndex+2); if (RegValIsKnown (D->OpEntry->RI->In.RegX)) { /* Value of X is known */