/* */
/* */
/* */
-/* (C) 2001-2004 Ullrich von Bassewitz */
-/* Römerstrasse 52 */
-/* D-70794 Filderstadt */
-/* EMail: uz@cc65.org */
+/* (C) 2001-2005, Ullrich von Bassewitz */
+/* Römerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
* lookup the information about this function and use it. The jump itself
* does not change any registers, so we don't need to use the data from D.
*/
- if ((E->Info & (OF_BRA | OF_CALL)) != 0 && E->JumpTo == 0) {
+ if ((E->Info & (OF_UBRA | OF_CALL)) != 0 && E->JumpTo == 0) {
/* A subroutine call or jump to external symbol (function exit) */
GetFuncInfo (E->Arg, &E->Use, &E->Chg);
} else {
-int CE_KnownImm (const CodeEntry* E)
-/* Return true if the argument of E is a known immediate value */
+int CE_IsConstImm (const CodeEntry* E)
+/* Return true if the argument of E is a constant immediate value */
{
return (E->AM == AM65_IMM && (E->Flags & CEF_NUMARG) != 0);
}
+int CE_IsKnownImm (const CodeEntry* E, unsigned long Num)
+/* Return true if the argument of E is a constant immediate value that is
+ * equal to Num.
+ */
+{
+ return E->AM == AM65_IMM &&
+ (E->Flags & CEF_NUMARG) != 0 &&
+ E->Num == Num;
+}
+
+
+
int CE_UseLoadFlags (const CodeEntry* E)
/* Return true if the instruction uses any flags that are set by a load of
* a register (N and Z).
case OP65_AND:
if (RegValIsKnown (In->RegA)) {
- if (CE_KnownImm (E)) {
+ if (CE_IsConstImm (E)) {
Out->RegA = In->RegA & (short) E->Num;
} else if (E->AM == AM65_ZP) {
switch (GetKnownReg (E->Use & REG_ZP, In)) {
case OP65_EOR:
if (RegValIsKnown (In->RegA)) {
- if (CE_KnownImm (E)) {
+ if (CE_IsConstImm (E)) {
Out->RegA = In->RegA ^ (short) E->Num;
} else if (E->AM == AM65_ZP) {
switch (GetKnownReg (E->Use & REG_ZP, In)) {
break;
case OP65_LDA:
- if (CE_KnownImm (E)) {
+ if (CE_IsConstImm (E)) {
Out->RegA = (unsigned char) E->Num;
} else if (E->AM == AM65_ZP) {
switch (GetKnownReg (E->Use & REG_ZP, In)) {
break;
case OP65_LDX:
- if (CE_KnownImm (E)) {
+ if (CE_IsConstImm (E)) {
Out->RegX = (unsigned char) E->Num;
} else if (E->AM == AM65_ZP) {
switch (GetKnownReg (E->Use & REG_ZP, In)) {
break;
case OP65_LDY:
- if (CE_KnownImm (E)) {
+ if (CE_IsConstImm (E)) {
Out->RegY = (unsigned char) E->Num;
} else if (E->AM == AM65_ZP) {
switch (GetKnownReg (E->Use & REG_ZP, In)) {
case OP65_ORA:
if (RegValIsKnown (In->RegA)) {
- if (CE_KnownImm (E)) {
+ if (CE_IsConstImm (E)) {
Out->RegA = In->RegA | (short) E->Num;
} else if (E->AM == AM65_ZP) {
switch (GetKnownReg (E->Use & REG_ZP, In)) {