Several minor changes and fixes
git-svn-id: svn://svn.cc65.org/cc65/trunk@1192 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
0655cac6a6
commit
486640200b
3 changed files with 42 additions and 17 deletions
|
@ -156,6 +156,15 @@ static void SetUseChgInfo (CodeEntry* E, const OPCDesc* D)
|
||||||
/* Check for special zero page registers used */
|
/* Check for special zero page registers used */
|
||||||
switch (E->AM) {
|
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_ZP:
|
||||||
case AM65_ABS:
|
case AM65_ABS:
|
||||||
/* Be conservative: */
|
/* Be conservative: */
|
||||||
|
@ -661,6 +670,22 @@ void CE_GenRegInfo (CodeEntry* E, RegContents* InputRegs)
|
||||||
if (Chg & REG_SREG_HI) {
|
if (Chg & REG_SREG_HI) {
|
||||||
Out->SRegHi = -1;
|
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;
|
break;
|
||||||
|
|
||||||
case OP65_JVC:
|
case OP65_JVC:
|
||||||
|
|
|
@ -566,17 +566,17 @@ unsigned GetKnownReg (unsigned Use, const RegContents* RC)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if ((Use & REG_A) != 0) {
|
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) {
|
} 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) {
|
} 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) {
|
} 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) {
|
} 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) {
|
} 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 {
|
} else {
|
||||||
return REG_NONE;
|
return REG_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,8 +75,8 @@ const OPCDesc OPCTable[OPCODE_COUNT] = {
|
||||||
{ OP65_ASL, /* opcode */
|
{ OP65_ASL, /* opcode */
|
||||||
"asl", /* mnemonic */
|
"asl", /* mnemonic */
|
||||||
0, /* size */
|
0, /* size */
|
||||||
REG_A, /* use */
|
REG_NONE, /* use */
|
||||||
REG_A, /* chg */
|
REG_NONE, /* chg */
|
||||||
OF_SETF /* flags */
|
OF_SETF /* flags */
|
||||||
},
|
},
|
||||||
{ OP65_BCC, /* opcode */
|
{ OP65_BCC, /* opcode */
|
||||||
|
@ -362,8 +362,8 @@ const OPCDesc OPCTable[OPCODE_COUNT] = {
|
||||||
{ OP65_LSR, /* opcode */
|
{ OP65_LSR, /* opcode */
|
||||||
"lsr", /* mnemonic */
|
"lsr", /* mnemonic */
|
||||||
0, /* size */
|
0, /* size */
|
||||||
REG_A, /* use */
|
REG_NONE, /* use */
|
||||||
REG_A, /* chg */
|
REG_NONE, /* chg */
|
||||||
OF_SETF /* flags */
|
OF_SETF /* flags */
|
||||||
},
|
},
|
||||||
{ OP65_NOP, /* opcode */
|
{ OP65_NOP, /* opcode */
|
||||||
|
@ -439,15 +439,15 @@ const OPCDesc OPCTable[OPCODE_COUNT] = {
|
||||||
{ OP65_ROL, /* opcode */
|
{ OP65_ROL, /* opcode */
|
||||||
"rol", /* mnemonic */
|
"rol", /* mnemonic */
|
||||||
0, /* size */
|
0, /* size */
|
||||||
REG_A, /* use */
|
REG_NONE, /* use */
|
||||||
REG_A, /* chg */
|
REG_NONE, /* chg */
|
||||||
OF_SETF /* flags */
|
OF_SETF /* flags */
|
||||||
},
|
},
|
||||||
{ OP65_ROR, /* opcode */
|
{ OP65_ROR, /* opcode */
|
||||||
"ror", /* mnemonic */
|
"ror", /* mnemonic */
|
||||||
0, /* size */
|
0, /* size */
|
||||||
REG_A, /* use */
|
REG_NONE, /* use */
|
||||||
REG_A, /* chg */
|
REG_NONE, /* chg */
|
||||||
OF_SETF /* flags */
|
OF_SETF /* flags */
|
||||||
},
|
},
|
||||||
{ OP65_RTI, /* opcode */
|
{ OP65_RTI, /* opcode */
|
||||||
|
|
Loading…
Add table
Reference in a new issue