/* */
/* */
/* */
-/* (C) 2001-2002 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
+/* (C) 2001-2004 Ullrich von Bassewitz */
+/* Römerstraße 52 */
+/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* Opcode description table */
-const OPCDesc OPCTable[OPCODE_COUNT] = {
+const OPCDesc OPCTable[OP65_COUNT] = {
/* 65XX opcodes */
{ OP65_ADC, /* opcode */
0, /* size */
REG_A, /* use */
REG_A, /* chg */
- OF_SETF /* flags */
+ OF_SETF /* flags */
},
{ OP65_AND, /* opcode */
"and", /* mnemonic */
0, /* size */
REG_A, /* use */
REG_A, /* chg */
- OF_SETF /* flags */
+ OF_SETF /* flags */
},
{ OP65_ASL, /* opcode */
"asl", /* mnemonic */
0, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_SETF /* flags */
+ OF_SETF | OF_NOIMP /* flags */
},
{ OP65_BCC, /* opcode */
"bcc", /* mnemonic */
2, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_CBRA /* flags */
+ OF_CBRA /* flags */
},
{ OP65_CLC, /* opcode */
"clc", /* mnemonic */
0, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_SETF /* flags */
+ OF_SETF | OF_NOIMP /* flags */
},
{ OP65_DEX, /* opcode */
"dex", /* mnemonic */
0, /* size */
REG_A, /* use */
REG_A, /* chg */
- OF_SETF /* flags */
+ OF_SETF /* flags */
},
{ OP65_INA, /* opcode */
"ina", /* mnemonic */
0, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_SETF /* flags */
+ OF_SETF | OF_NOIMP /* flags */
},
{ OP65_INX, /* opcode */
"inx", /* mnemonic */
5, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_CBRA | OF_LBRA /* flags */
+ OF_CBRA | OF_LBRA /* flags */
},
{ OP65_JVS, /* opcode */
"jvs", /* mnemonic */
0, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_SETF /* flags */
+ OF_SETF | OF_NOIMP /* flags */
},
{ OP65_NOP, /* opcode */
"nop", /* mnemonic */
1, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_NONE /* flags */
+ OF_NONE /* flags */
},
{ OP65_PLX, /* opcode */
"plx", /* mnemonic */
0, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_SETF /* flags */
+ OF_SETF | OF_NOIMP /* flags */
},
{ OP65_ROR, /* opcode */
"ror", /* mnemonic */
0, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_SETF /* flags */
+ OF_SETF | OF_NOIMP /* flags */
},
+ /* Mark RTI as "uses all registers but doesn't change them", so the
+ * optimizer won't remove preceeding loads.
+ */
{ OP65_RTI, /* opcode */
"rti", /* mnemonic */
1, /* size */
- REG_NONE, /* use */
+ REG_AXY, /* use */
REG_NONE, /* chg */
- OF_RET /* flags */
+ OF_RET /* flags */
},
{ OP65_RTS, /* opcode */
"rts", /* mnemonic */
1, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_RET /* flags */
+ OF_RET /* flags */
},
{ OP65_SBC, /* opcode */
"sbc", /* mnemonic */
0, /* size */
REG_A, /* use */
REG_A, /* chg */
- OF_SETF /* flags */
+ OF_SETF /* flags */
},
{ OP65_SEC, /* opcode */
"sec", /* mnemonic */
1, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_NONE /* flags */
+ OF_NONE /* flags */
},
{ OP65_SED, /* opcode */
"sed", /* mnemonic */
1, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_NONE /* flags */
+ OF_NONE /* flags */
},
{ OP65_SEI, /* opcode */
"sei", /* mnemonic */
1, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_NONE /* flags */
+ OF_NONE /* flags */
},
{ OP65_STA, /* opcode */
"sta", /* mnemonic */
0, /* size */
REG_A, /* use */
REG_NONE, /* chg */
- OF_STORE /* flags */
+ OF_STORE /* flags */
},
{ OP65_STX, /* opcode */
"stx", /* mnemonic */
0, /* size */
REG_X, /* use */
REG_NONE, /* chg */
- OF_STORE /* flags */
+ OF_STORE /* flags */
},
{ OP65_STY, /* opcode */
"sty", /* mnemonic */
0, /* size */
REG_Y, /* use */
REG_NONE, /* chg */
- OF_STORE /* flags */
+ OF_STORE /* flags */
},
{ OP65_STZ, /* opcode */
"stz", /* mnemonic */
0, /* size */
REG_NONE, /* use */
REG_NONE, /* chg */
- OF_STORE /* flags */
+ OF_STORE /* flags */
},
{ OP65_TAX, /* opcode */
"tax", /* mnemonic */
0, /* size */
REG_A, /* use */
REG_NONE, /* chg */
- OF_SETF /* flags */
+ OF_SETF /* flags */
},
{ OP65_TSX, /* opcode */
"tsx", /* mnemonic */
1, /* size */
REG_X, /* use */
REG_NONE, /* chg */
- OF_XFR /* flags */
+ OF_XFR /* flags */
},
{ OP65_TYA, /* opcode */
"tya", /* mnemonic */
Mnemo[I] = '\0';
/* Search for the mnemonic in the table and return the result */
- return bsearch (Mnemo, OPCTable+OP65_FIRST, OP65_COUNT,
+ return bsearch (Mnemo, OPCTable, OP65_COUNT,
sizeof (OPCTable[0]), FindCmp );
}
case OP65_BVS:
case OP65_JVS: return OP65_BVS;
case OP65_BRA:
- case OP65_JMP: return (CPU == CPU_65C02)? OP65_BRA : OP65_JMP;
+ case OP65_JMP: return (CPUIsets[CPU] & CPU_ISET_65SC02)? OP65_BRA : OP65_JMP;
default:
Internal ("MakeShortBranch: Invalid opcode: %d", OPC);
return 0;