/* Check for special zero page registers used */
switch (E->AM) {
+ case AM65_ACC:
+ if (E->OPC == OP65_ASL || E->OPC == OP65_DEC ||
+ E->OPC == OP65_INC || E->OPC == OP65_LSR ||
+ E->OPC == OP65_ROL || E->OPC == OP65_ROR) {
+ /* A is changed by these insns */
+ E->Chg |= REG_A;
+ }
+ break;
+
case AM65_ZP:
case AM65_ABS:
/* Be conservative: */
if (Chg & REG_SREG_HI) {
Out->SRegHi = -1;
}
+ /* Quick hack for some known functions: */
+ if (strcmp (E->Arg, "tosandax") == 0) {
+ if (In->RegA == 0) {
+ Out->RegA = 0;
+ }
+ if (In->RegX == 0) {
+ Out->RegX = 0;
+ }
+ } else if (strcmp (E->Arg, "tosorax") == 0) {
+ if (In->RegA == 0xFF) {
+ Out->RegA = 0xFF;
+ }
+ if (In->RegX == 0xFF) {
+ Out->RegX = 0xFF;
+ }
+ }
break;
case OP65_JVC:
*/
{
if ((Use & REG_A) != 0) {
- return (RC && RC->RegA >= 0)? REG_A : REG_NONE;
+ return (RC == 0 || RC->RegA >= 0)? REG_A : REG_NONE;
} else if ((Use & REG_X) != 0) {
- return (RC && RC->RegX >= 0)? REG_X : REG_NONE;
+ return (RC == 0 || RC->RegX >= 0)? REG_X : REG_NONE;
} else if ((Use & REG_Y) != 0) {
- return (RC && RC->RegY >= 0)? REG_Y : REG_NONE;
+ return (RC == 0 || RC->RegY >= 0)? REG_Y : REG_NONE;
} else if ((Use & REG_TMP1) != 0) {
- return (RC && RC->Tmp1 >= 0)? REG_TMP1 : REG_NONE;
+ return (RC == 0 || RC->Tmp1 >= 0)? REG_TMP1 : REG_NONE;
} else if ((Use & REG_SREG_LO) != 0) {
- return (RC && RC->SRegLo >= 0)? REG_SREG_LO : REG_NONE;
+ return (RC == 0 || RC->SRegLo >= 0)? REG_SREG_LO : REG_NONE;
} else if ((Use & REG_SREG_HI) != 0) {
- return (RC && RC->SRegHi >= 0)? REG_SREG_HI : REG_NONE;
+ return (RC == 0 || RC->SRegHi >= 0)? REG_SREG_HI : REG_NONE;
} else {
return REG_NONE;
}