mirror of
https://github.com/cc65/cc65.git
synced 2025-02-28 20:29:46 +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:
parent
1b4e2111c3
commit
55e8f67640
@ -3235,16 +3235,21 @@ void g_inc (unsigned flags, unsigned long val)
|
|||||||
if (val >= 0x300) {
|
if (val >= 0x300) {
|
||||||
AddCodeLine ("inx");
|
AddCodeLine ("inx");
|
||||||
}
|
}
|
||||||
} else {
|
} else if ((val & 0xFF) != 0) {
|
||||||
AddCodeLine ("clc");
|
AddCodeLine ("clc");
|
||||||
if ((val & 0xFF) != 0) {
|
|
||||||
AddCodeLine ("adc #$%02X", (unsigned char) val);
|
AddCodeLine ("adc #$%02X", (unsigned char) val);
|
||||||
}
|
|
||||||
AddCodeLine ("pha");
|
AddCodeLine ("pha");
|
||||||
AddCodeLine ("txa");
|
AddCodeLine ("txa");
|
||||||
AddCodeLine ("adc #$%02X", (unsigned char) (val >> 8));
|
AddCodeLine ("adc #$%02X", (unsigned char) (val >> 8));
|
||||||
AddCodeLine ("tax");
|
AddCodeLine ("tax");
|
||||||
AddCodeLine ("pla");
|
AddCodeLine ("pla");
|
||||||
|
} else {
|
||||||
|
AddCodeLine ("pha");
|
||||||
|
AddCodeLine ("txa");
|
||||||
|
AddCodeLine ("clc");
|
||||||
|
AddCodeLine ("adc #$%02X", (unsigned char) (val >> 8));
|
||||||
|
AddCodeLine ("tax");
|
||||||
|
AddCodeLine ("pla");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user