/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
+#if 0
static void insertBankSwitch(pCodeInstruction *pci, int Set_Clear, int RP_BankBit)
{
pCode *new_pc;
insertPCodeInstruction(pci, PCI(new_pc));
}
-
+#endif
/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
static void insertBankSel(pCodeInstruction *pci, const char *name)
static int LastRegIdx = -1; /* If the previous register is the same one again then no need to change bank. */
static int BankSelect(pCodeInstruction *pci, int cur_bank, regs *reg)
{
+#if 1
+ /* Always insert BANKSELs rather than try to be clever:
+ * Too many bugs in optimized banksels... */
+ insertBankSel(pci, reg->name); // Let linker choose the bank selection
+ return 'L';
+#else
int bank;
int a = reg->alias>>7;
if ((a&3) == 3) {
LastRegIdx = reg->rIdx;
#endif
+ /* Optimized code---unfortunately this turns out to be buggy
+ * (at least on devices with more than two banks). */
if (reg->isFixed) {
bank = REG_BANK(reg);
} else if (reg->isExtern) {
}
return bank;
+#endif
}
/*-----------------------------------------------------------------*/
}
reg = getRegFromInstruction(pc);
+ if (!reg && isPCI(pc) &&
+ ((PCI(pc)->inCond | PCI(pc)->outCond) & PCC_REGISTER))
+ {
+ assert(!"Could not get register from instruction.");
+ }
if (reg) {
if (IsBankChange(pc,reg,&cur_bank))
return cur_bank;