1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-02 04:41:35 +00:00

Try to generate more predicable code. clc always before adc or sbc.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4056 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2009-08-27 16:59:26 +00:00
parent 1b4e2111c3
commit 55e8f67640

View File

@ -3235,16 +3235,21 @@ void g_inc (unsigned flags, unsigned long val)
if (val >= 0x300) {
AddCodeLine ("inx");
}
} else {
} else if ((val & 0xFF) != 0) {
AddCodeLine ("clc");
if ((val & 0xFF) != 0) {
AddCodeLine ("adc #$%02X", (unsigned char) val);
}
AddCodeLine ("adc #$%02X", (unsigned char) val);
AddCodeLine ("pha");
AddCodeLine ("txa");
AddCodeLine ("adc #$%02X", (unsigned char) (val >> 8));
AddCodeLine ("tax");
AddCodeLine ("pla");
} else {
AddCodeLine ("pha");
AddCodeLine ("txa");
AddCodeLine ("clc");
AddCodeLine ("adc #$%02X", (unsigned char) (val >> 8));
AddCodeLine ("tax");
AddCodeLine ("pla");
}
}
break;