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:
parent
3302bfc108
commit
91a79e4714
@ -585,39 +585,49 @@ void g_restore_regvars (int StackOffs, int RegOffs, unsigned Bytes)
|
|||||||
/* Don't loop for up to two bytes */
|
/* Don't loop for up to two bytes */
|
||||||
if (Bytes == 1) {
|
if (Bytes == 1) {
|
||||||
|
|
||||||
ldyconst (StackOffs);
|
ldyconst (StackOffs);
|
||||||
AddCodeLine ("lda (sp),y");
|
AddCodeLine ("lda (sp),y");
|
||||||
AddCodeLine ("sta regbank%+d", RegOffs);
|
AddCodeLine ("sta regbank%+d", RegOffs);
|
||||||
|
|
||||||
} else if (Bytes == 2) {
|
} else if (Bytes == 2) {
|
||||||
|
|
||||||
ldyconst (StackOffs);
|
ldyconst (StackOffs);
|
||||||
AddCodeLine ("lda (sp),y");
|
AddCodeLine ("lda (sp),y");
|
||||||
AddCodeLine ("sta regbank%+d", RegOffs);
|
AddCodeLine ("sta regbank%+d", RegOffs);
|
||||||
AddCodeLine ("iny");
|
AddCodeLine ("iny");
|
||||||
AddCodeLine ("lda (sp),y");
|
AddCodeLine ("lda (sp),y");
|
||||||
AddCodeLine ("sta regbank%+d", RegOffs+1);
|
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 {
|
} else {
|
||||||
|
|
||||||
/* More than two bytes - loop */
|
/* More bytes - loop */
|
||||||
unsigned Label = GetLocalLabel ();
|
unsigned Label = GetLocalLabel ();
|
||||||
ldyconst (StackOffs+Bytes-1);
|
ldyconst (StackOffs);
|
||||||
ldxconst (Bytes);
|
g_defcodelabel (Label);
|
||||||
g_defcodelabel (Label);
|
|
||||||
AddCodeLine ("lda (sp),y");
|
AddCodeLine ("lda (sp),y");
|
||||||
AddCodeLine ("sta regbank%+d,x", RegOffs-1);
|
AddCodeLine ("sta regbank%+d,y", RegOffs - StackOffs);
|
||||||
AddCodeLine ("dey");
|
AddCodeLine ("iny");
|
||||||
AddCodeLine ("dex");
|
AddCodeLine ("cpy #$%02X", StackOffs + Bytes);
|
||||||
AddCodeLine ("bne %s", LocalLabelName (Label));
|
AddCodeLine ("bne %s", LocalLabelName (Label));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Fetching memory cells */
|
/* Fetching memory cells */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user