1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-03 01:31:55 +00:00

Fixed a bug

git-svn-id: svn://svn.cc65.org/cc65/trunk@2312 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-08-14 13:08:46 +00:00
parent 3302bfc108
commit 91a79e4714

View File

@ -598,19 +598,29 @@ void g_restore_regvars (int StackOffs, int RegOffs, unsigned Bytes)
AddCodeLine ("lda (sp),y");
AddCodeLine ("sta regbank%+d", RegOffs+1);
} else if (Bytes == 3 && CodeSizeFactor >= 133) {
ldyconst (StackOffs);
AddCodeLine ("lda (sp),y");
AddCodeLine ("sta regbank%+d", RegOffs);
AddCodeLine ("iny");
AddCodeLine ("lda (sp),y");
AddCodeLine ("sta regbank%+d", RegOffs+1);
AddCodeLine ("iny");
AddCodeLine ("lda (sp),y");
AddCodeLine ("sta regbank%+d", RegOffs+2);
} else {
/* More than two bytes - loop */
/* More bytes - loop */
unsigned Label = GetLocalLabel ();
ldyconst (StackOffs+Bytes-1);
ldxconst (Bytes);
ldyconst (StackOffs);
g_defcodelabel (Label);
AddCodeLine ("lda (sp),y");
AddCodeLine ("sta regbank%+d,x", RegOffs-1);
AddCodeLine ("dey");
AddCodeLine ("dex");
AddCodeLine ("sta regbank%+d,y", RegOffs - StackOffs);
AddCodeLine ("iny");
AddCodeLine ("cpy #$%02X", StackOffs + Bytes);
AddCodeLine ("bne %s", LocalLabelName (Label));
}
}