1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00

Fixed a bug in inlined memcpy

git-svn-id: svn://svn.cc65.org/cc65/trunk@3236 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2004-10-09 19:09:35 +00:00
parent 0e0183020d
commit 8874a80ddd

View File

@ -339,9 +339,9 @@ static void StdFunc_memcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr)
Label = GetLocalLabel ();
/* Generate memcpy code */
if (Arg3.Expr.IVal <= 127) {
if (Arg3.Expr.IVal <= 127 && !AllowOneIndex) {
if (Offs == 0 || AllowOneIndex) {
if (Offs == 0) {
AddCodeLine ("ldy #$%02X", (unsigned char) (Offs + Arg3.Expr.IVal - 1));
g_defcodelabel (Label);
AddCodeLine ("lda %s,y", ED_GetLabelName (&Arg2.Expr, -Offs));
@ -413,13 +413,13 @@ static void StdFunc_memcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr)
Label = GetLocalLabel ();
/* Generate memcpy code */
if (Arg3.Expr.IVal <= 127) {
if (Arg3.Expr.IVal <= 127 && !AllowOneIndex) {
if (Offs == 0 || AllowOneIndex) {
AddCodeLine ("ldy #$%02X", (unsigned char) (Offs + Arg3.Expr.IVal - 1));
if (Offs == 0) {
AddCodeLine ("ldy #$%02X", (unsigned char) (Arg3.Expr.IVal - 1));
g_defcodelabel (Label);
AddCodeLine ("lda (sp),y");
AddCodeLine ("sta %s,y", ED_GetLabelName (&Arg1.Expr, -Offs));
AddCodeLine ("sta %s,y", ED_GetLabelName (&Arg1.Expr, 0));
AddCodeLine ("dey");
AddCodeLine ("bpl %s", LocalLabelName (Label));
} else {