static int functionInlining = 1; /* inline functions if nonzero */
int debug_verbose = 1; /* Set true to inundate .asm file */
-static int GpCodeSequenceNumber = 1;
+// static int GpCodeSequenceNumber = 1;
int GpcFlowSeq = 1;
extern void RemoveUnusedRegisters(void);
static void pCodePrintFunction(FILE *of, pCode *pc);
static void pCodeOpPrint(FILE *of, pCodeOp *pcop);
static char *get_op_from_instruction( pCodeInstruction *pcc);
-char *get_op( pCodeOp *pcop,char *buff,int buf_size);
+char *get_op( pCodeOp *pcop,char *buff,size_t buf_size);
int pCodePeepMatchLine(pCodePeep *peepBlock, pCode *pcs, pCode *pcd);
int pCodePeepMatchRule(pCode *pc);
void pBlockStats(FILE *of, pBlock *pb);
2, // num ops
1,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_W | PCC_REGISTER), // inCond
(PCC_REGISTER | PCC_Z) // outCond
2, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_W | PCC_REGISTER), // inCond
(PCC_W | PCC_Z) // outCond
1, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 1, // literal operand
POC_NOP,
(PCC_W | PCC_LITERAL), // inCond
(PCC_W | PCC_Z | PCC_C | PCC_DC) // outCond
1, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 1, // literal operand
POC_NOP,
(PCC_W | PCC_LITERAL), // inCond
(PCC_W | PCC_Z) // outCond
2, // num ops
1,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_W | PCC_REGISTER), // inCond
(PCC_REGISTER | PCC_Z) // outCond
2, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_W | PCC_REGISTER), // inCond
(PCC_W | PCC_Z) // outCond
2, // num ops
1,1, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_BSF,
(PCC_REGISTER | PCC_EXAMINE_PCOP), // inCond
PCC_REGISTER // outCond
2, // num ops
1,1, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_BCF,
(PCC_REGISTER | PCC_EXAMINE_PCOP), // inCond
(PCC_REGISTER | PCC_EXAMINE_PCOP) // outCond
2, // num ops
0,1, // dest, bit instruction
1,1, // branch, skip
+ 0, // literal operand
POC_BTFSS,
(PCC_REGISTER | PCC_EXAMINE_PCOP), // inCond
PCC_EXAMINE_PCOP // outCond
2, // num ops
0,1, // dest, bit instruction
1,1, // branch, skip
+ 0, // literal operand
POC_BTFSC,
(PCC_REGISTER | PCC_EXAMINE_PCOP), // inCond
PCC_EXAMINE_PCOP // outCond
1, // num ops
0,0, // dest, bit instruction
1,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_NONE, // inCond
PCC_NONE // outCond
2, // num ops
1,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_REGISTER, // inCond
PCC_REGISTER // outCond
2, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_REGISTER, // inCond
PCC_W // outCond
1, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_NONE, // inCond
PCC_REGISTER // outCond
0, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_NONE, // inCond
PCC_W // outCond
0, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_NONE, // inCond
PCC_NONE // outCond
2, // num ops
1,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_REGISTER, // inCond
PCC_REGISTER // outCond
2, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_REGISTER, // inCond
PCC_W // outCond
2, // num ops
1,0, // dest, bit instruction
1,1, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_REGISTER, // inCond
PCC_REGISTER // outCond
2, // num ops
0,0, // dest, bit instruction
1,1, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_REGISTER, // inCond
PCC_W // outCond
1, // num ops
0,0, // dest, bit instruction
1,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_NONE, // inCond
PCC_NONE // outCond
2, // num ops
1,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_REGISTER, // inCond
PCC_REGISTER // outCond
2, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_REGISTER, // inCond
PCC_W // outCond
2, // num ops
1,0, // dest, bit instruction
1,1, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_REGISTER, // inCond
PCC_REGISTER // outCond
2, // num ops
0,0, // dest, bit instruction
1,1, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_REGISTER, // inCond
PCC_W // outCond
2, // num ops
1,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_W | PCC_REGISTER), // inCond
(PCC_REGISTER | PCC_Z) // outCond
2, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_W | PCC_REGISTER), // inCond
(PCC_W | PCC_Z) // outCond
1, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 1, // literal operand
POC_NOP,
(PCC_W | PCC_LITERAL), // inCond
(PCC_W | PCC_Z) // outCond
2, // num ops
1,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_REGISTER, // inCond
PCC_Z // outCond
2, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_REGISTER, // inCond
(PCC_W | PCC_Z) // outCond
1, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_W, // inCond
PCC_REGISTER // outCond
pCodeInstruction pciMOVLW = {
{PC_OPCODE, NULL, NULL, 0, NULL,
- // genericAnalyze,
genericDestruct,
genericPrint},
POC_MOVLW,
1, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 1, // literal operand
POC_NOP,
(PCC_NONE | PCC_LITERAL), // inCond
PCC_W // outCond
0, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_NONE, // inCond
PCC_NONE // outCond
0, // num ops
0,0, // dest, bit instruction
1,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_NONE, // inCond
PCC_NONE // outCond (not true... affects the GIE bit too)
1, // num ops
0,0, // dest, bit instruction
1,0, // branch, skip
+ 1, // literal operand
POC_NOP,
PCC_LITERAL, // inCond
PCC_W // outCond
0, // num ops
0,0, // dest, bit instruction
1,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_NONE, // inCond
PCC_NONE // outCond
2, // num ops
1,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_C | PCC_REGISTER), // inCond
(PCC_REGISTER | PCC_Z | PCC_C | PCC_DC) // outCond
2, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_C | PCC_REGISTER), // inCond
(PCC_W | PCC_Z | PCC_C | PCC_DC) // outCond
2, // num ops
1,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_C | PCC_REGISTER), // inCond
(PCC_REGISTER | PCC_Z | PCC_C | PCC_DC) // outCond
2, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_C | PCC_REGISTER), // inCond
(PCC_W | PCC_Z | PCC_C | PCC_DC) // outCond
2, // num ops
1,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_W | PCC_REGISTER), // inCond
(PCC_REGISTER | PCC_Z) // outCond
2, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_W | PCC_REGISTER), // inCond
(PCC_W | PCC_Z) // outCond
1, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 1, // literal operand
POC_NOP,
(PCC_W | PCC_LITERAL), // inCond
(PCC_W | PCC_Z | PCC_C | PCC_DC) // outCond
2, // num ops
1,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_REGISTER), // inCond
(PCC_REGISTER) // outCond
2, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_REGISTER), // inCond
(PCC_W) // outCond
1, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
PCC_NONE, // inCond
PCC_REGISTER // outCond
2, // num ops
1,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_W | PCC_REGISTER), // inCond
(PCC_REGISTER | PCC_Z) // outCond
2, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 0, // literal operand
POC_NOP,
(PCC_W | PCC_REGISTER), // inCond
(PCC_W | PCC_Z) // outCond
1, // num ops
0,0, // dest, bit instruction
0,0, // branch, skip
+ 1, // literal operand
POC_NOP,
(PCC_W | PCC_LITERAL), // inCond
(PCC_W | PCC_Z | PCC_C | PCC_DC) // outCond
#define MAX_PIC14MNEMONICS 100
pCodeInstruction *pic14Mnemonics[MAX_PIC14MNEMONICS];
-/* This definition needs to be part of configure.in */
-// #define USE_VSNPRINTF
-#ifdef USE_VSNPRINTF
+#ifdef HAVE_VSNPRINTF
// Alas, vsnprintf is not ANSI standard, and does not exist
// on Solaris (and probably other non-Gnu flavored Unixes).
len = strlen(*str);
if(len > *size) {
fprintf(stderr,"WARNING, it looks like %s has overflowed\n",__FUNCTION__);
- fprintf(stderr,"len = %d is > str size %d\n",len,*size);
+ fprintf(stderr,"len = %d is > str size %d\n",len,(int)*size);
}
*str += len;
}
-#else // USE_VSNPRINTF
+#else // HAVE_VSNPRINTF
// This version is *not* safe, despite the name.
}
-#endif // USE_VSNPRINTF
+#endif // HAVE_VSNPRINTF
extern void initStack(int base_address, int size);
char buffer[100];
/* create the file name */
- strcpy(buffer,srcFileName);
+ strcpy(buffer,dstFileName);
strcat(buffer,".p");
if( !(pFile = fopen(buffer, "w" ))) {
if(s)
pcl->label = Safe_strdup(s);
-
+ //fprintf(stderr,"newpCodeLabel: key=%d, name=%s\n",key, ((s)?s:""));
return ( (pCode *)pcl);
}
((pCodeOpLabel *)pcop)->key = key;
+ //fprintf(stderr,"newpCodeOpLabel: key=%d, name=%s\n",key,((s)?s:""));
return pcop;
}
/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
-char *get_op(pCodeOp *pcop,char *buffer, int size)
+char *get_op(pCodeOp *pcop,char *buffer, size_t size)
{
regs *r;
static char b[50];
SAFE_snprintf(&s,&size,"(%s + %d)",
pcop->name,
PCOI(pcop)->index );
- } else
- SAFE_snprintf(&s,&size,"%s",pcop->name);
+ } else {
+ if(PCOI(pcop)->offset)
+ SAFE_snprintf(&s,&size,"(%s >> %d)&0xff",pcop->name, 8*PCOI(pcop)->offset);
+ else
+ SAFE_snprintf(&s,&size,"%s",pcop->name);
+ }
}
return buffer;
if(pcc )
return get_op(pcc->pcop,NULL,0);
-
+
+ /* gcc 3.2: warning: concatenation of string literals with __FUNCTION__ is deprecated
return ("ERROR Null: "__FUNCTION__);
+ */
+ return ("ERROR Null: get_op_from_instruction");
}
/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
-char *pCode2str(char *str, int size, pCode *pc)
+char *pCode2str(char *str, size_t size, pCode *pc)
{
char *s = str;
if( (pct = findLabelinpBlock(pb,pcol)) != NULL)
LinkFlow_pCode(PCI(pc),PCI(pct));
else
- fprintf(stderr, "ERROR: %s, couldn't find label\n",__FUNCTION__);
+ fprintf(stderr, "ERROR: %s, couldn't find label. key=%d,lab=%s\n",
+ __FUNCTION__,pcol->key,((PCOP(pcol)->name)?PCOP(pcol)->name:"-"));
+ //fprintf(stderr,"newpCodeOpLabel: key=%d, name=%s\n",key,((s)?s:""));
continue;
}
/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
-void insertBankSwitch(pCode *pc, int Set_Clear, int RP_BankBit)
+void insertBankSwitch(int position, pCode *pc, int Set_Clear, int RP_BankBit)
{
pCode *new_pc;
new_pc = newpCode((Set_Clear ? POC_BSF : POC_BCF),
popCopyGPR2Bit(PCOP(&pc_status),RP_BankBit));
- pCodeInsertAfter(pc->prev, new_pc);
+ if(position) {
+ /* insert the bank switch after this pc instruction */
+ pCode *pcnext = findNextInstruction(pc);
+ pCodeInsertAfter(pc, new_pc);
+ if(pcnext)
+ pc = pcnext;
+
+ } else
+ pCodeInsertAfter(pc->prev, new_pc);
/* Move the label, if there is one */
while(isPCinFlow(pc,PCODE(pcfl))) {
-
reg = getRegFromInstruction(pc);
#if 0
if(reg) {
}
#endif
- if(reg && REG_BANK(reg)!=cur_bank) {
+ if( ( (reg && REG_BANK(reg)!=cur_bank) ||
+ ((PCI(pc)->op == POC_CALL) && (cur_bank != 0) ) ) &&
+ (!isPCI_LIT(pc)) ){
+
/* Examine the instruction before this one to make sure it is
* not a skip type instruction */
pcprev = findPrevpCode(pc->prev, PC_OPCODE);
+
if(!pcprev || (pcprev && !isPCI_SKIP(pcprev))) {
- int b = cur_bank ^ REG_BANK(reg);
+ int b;
+ int reg_bank;
+
+ reg_bank = (reg) ? REG_BANK(reg) : 0;
+
+ b = cur_bank ^ reg_bank;
//fprintf(stderr, "Cool! can switch banks\n");
- cur_bank = REG_BANK(reg);
+ cur_bank = reg_bank;
switch(b & 3) {
case 0:
break;
case 1:
- insertBankSwitch(pc, cur_bank&1, PIC_RP0_BIT);
+ insertBankSwitch(0, pc, cur_bank&1, PIC_RP0_BIT);
break;
case 2:
- insertBankSwitch(pc, cur_bank&2, PIC_RP1_BIT);
- insertBankSwitch(pc, cur_bank&2, PIC_RP1_BIT);
+ insertBankSwitch(0, pc, cur_bank&2, PIC_RP1_BIT);
+ insertBankSwitch(0, pc, cur_bank&2, PIC_RP1_BIT);
break;
case 3:
if(cur_bank & 3) {
- insertBankSwitch(pc, cur_bank&1, PIC_RP0_BIT);
- insertBankSwitch(pc, cur_bank&2, PIC_RP1_BIT);
+ insertBankSwitch(0, pc, cur_bank&1, PIC_RP0_BIT);
+ insertBankSwitch(0, pc, cur_bank&2, PIC_RP1_BIT);
} else
- insertBankSwitch(pc, -1, -1);
+ insertBankSwitch(0, pc, -1, -1);
break;
- /*
- new_pc = newpCode(((cur_bank&1) ? POC_BSF : POC_BCF),
- popCopyGPR2Bit(PCOP(&pc_status),PIC_RP0_BIT));
- pCodeInsertAfter(pc->prev, new_pc);
- if(PCI(pc)->label) {
- PCI(new_pc)->label = PCI(pc)->label;
- PCI(pc)->label = NULL;
- }
- */
- /*
- new_pc = newpCode(((cur_bank&1) ? POC_BCF : POC_BSF),
- popCopyGPR2Bit(PCOP(&pc_status),PIC_RP0_BIT));
- pCodeInsertAfter(pc, new_pc);
- */
}
void exchangeLabels(pCodeLabel *pcl, pCode *pc)
{
+ char *s=NULL;
+
if(isPCI(pc) &&
(PCI(pc)->pcop) &&
(PCI(pc)->pcop->type == PO_LABEL)) {
if(pcol->pcop.name)
free(pcol->pcop.name);
- sprintf(buffer,"_%05d_DS_",pcl->key);
-
- pcol->pcop.name = Safe_strdup(buffer);
+ /* If the key is negative, then we (probably) have a label to
+ * a function and the name is already defined */
+
+ if(pcl->key>0)
+ sprintf(s=buffer,"_%05d_DS_",pcl->key);
+ else
+ s = pcl->label;
+
+ //sprintf(buffer,"_%05d_DS_",pcl->key);
+ if(!s) {
+ fprintf(stderr, "ERROR %s:%d function label is null\n",__FUNCTION__,__LINE__);
+ }
+ pcol->pcop.name = Safe_strdup(s);
pcol->key = pcl->key;
//pc->print(stderr,pc);
{
pCode *pc=NULL;
pCode *pcprev=NULL;
- pCode *new_pc;
int cur_bank;
regs *reg;
- // return;
+
if(!pb)
return;
//genericPrint(stderr, pc);
reg = getRegFromInstruction(pc);
- #if 0
+#if 0
if(reg) {
fprintf(stderr, " %s ",reg->name);
- fprintf(stderr, "addr = 0x%03x, bank = %d\n",reg->address,REG_BANK(reg));
+ fprintf(stderr, "addr = 0x%03x, bank = %d, bit=%d\n",
+ reg->address,REG_BANK(reg),reg->isBitField);
}
- #endif
- if(reg && REG_BANK(reg)!=cur_bank) {
+#endif
+
+ if( ( (reg && REG_BANK(reg)!=cur_bank) ||
+ ((PCI(pc)->op == POC_CALL) && (cur_bank != 0) ) ) &&
+ (!isPCI_LIT(pc)) ){
+
+
/* Examine the instruction before this one to make sure it is
* not a skip type instruction */
pcprev = findPrevpCode(pc->prev, PC_OPCODE);
- if(!pcprev || (pcprev && !isPCI_SKIP(pcprev))) {
- int b = cur_bank ^ REG_BANK(reg);
- //fprintf(stderr, "Cool! can switch banks\n");
- cur_bank = REG_BANK(reg);
- if(b & 1) {
- new_pc = newpCode(((cur_bank&1) ? POC_BSF : POC_BCF),
- popCopyGPR2Bit(PCOP(&pc_status),PIC_RP0_BIT));
- pCodeInsertAfter(pc->prev, new_pc);
- if(PCI(pc)->label) {
- PCI(new_pc)->label = PCI(pc)->label;
- PCI(pc)->label = NULL;
- }
- /*
- new_pc = newpCode(((cur_bank&1) ? POC_BCF : POC_BSF),
- popCopyGPR2Bit(PCOP(&pc_status),PIC_RP0_BIT));
- pCodeInsertAfter(pc, new_pc);
- */
+ if(!pcprev || (pcprev && !isPCI_SKIP(pcprev))) {
+ int b;
+ int reg_bank;
+
+ reg_bank = (reg) ? REG_BANK(reg) : 0;
+
+ b = cur_bank ^ reg_bank;
+
+ cur_bank = reg_bank;
+ switch(b & 3) {
+ case 0:
+ break;
+ case 1:
+ insertBankSwitch(0, pc, cur_bank&1, PIC_RP0_BIT);
+ break;
+ case 2:
+ insertBankSwitch(0, pc, cur_bank&2, PIC_RP1_BIT);
+ insertBankSwitch(0, pc, cur_bank&2, PIC_RP1_BIT);
+ break;
+ case 3:
+ if(cur_bank & 3) {
+ insertBankSwitch(0, pc, cur_bank&1, PIC_RP0_BIT);
+ insertBankSwitch(0, pc, cur_bank&2, PIC_RP1_BIT);
+ } else
+ insertBankSwitch(0, pc, -1, -1);
+ break;
}
- } else {
+ }else {
//fprintf(stderr, "Bummer can't switch banks\n");
;
}
}
+
+ pcprev = pc;
+
}
- pcprev = pc;
pc = pc->next;
// } while(pc && !(isPCFL(pc)));
}while (pc);
- if(pcprev && cur_bank) {
- /* Brute force - make sure that we point to bank 0 at the
- * end of each flow block */
- new_pc = newpCode(POC_BCF,
- popCopyGPR2Bit(PCOP(&pc_status),PIC_RP0_BIT));
- pCodeInsertAfter(pcprev, new_pc);
- cur_bank = 0;
+ if(pcprev && cur_bank) {
+
+ int pos = 1; /* Assume that the bank swithc instruction(s)
+ * are inserted after this instruction */
+
+ if((PCI(pcprev)->op == POC_RETLW) ||
+ (PCI(pcprev)->op == POC_RETURN) ||
+ (PCI(pcprev)->op == POC_RETFIE)) {
+
+ /* oops, a RETURN - we need to switch banks *before* the RETURN */
+
+ pos = 0;
+
+ }
+
+ /* Brute force - make sure that we point to bank 0 at the
+ * end of each flow block */
+
+ switch(cur_bank & 3) {
+ case 0:
+ break;
+ case 1:
+ insertBankSwitch(pos, pcprev, 0, PIC_RP0_BIT);
+ break;
+ case 2:
+ insertBankSwitch(pos, pcprev, 0, PIC_RP1_BIT);
+ insertBankSwitch(pos, pcprev, 0, PIC_RP1_BIT);
+ break;
+ case 3:
+ insertBankSwitch(pos, pcprev, -1, -1);
+ break;
+
}
+/*
+ new_pc = newpCode(POC_BCF,
+ popCopyGPR2Bit(PCOP(&pc_status),PIC_RP0_BIT));
+ pCodeInsertAfter(pcprev, new_pc);
+*/
+ cur_bank = 0;
+ //fprintf(stderr, "Brute force switch\n");
+ }
}
+
+
+
+#if 0
+ if(reg && REG_BANK(reg)!=cur_bank) {
+ //fprintf(stderr,"need to switch banks\n");
+ /* Examine the instruction before this one to make sure it is
+ * not a skip type instruction */
+ pcprev = findPrevpCode(pc->prev, PC_OPCODE);
+ if(!pcprev || (pcprev && !isPCI_SKIP(pcprev))) {
+ int b = cur_bank ^ REG_BANK(reg);
+
+ cur_bank = REG_BANK(reg);
+
+ switch(b & 3) {
+ case 0:
+ break;
+ case 1:
+ insertBankSwitch(0, pc, cur_bank&1, PIC_RP0_BIT);
+ break;
+ case 2:
+ insertBankSwitch(0, pc, cur_bank&2, PIC_RP1_BIT);
+ insertBankSwitch(0, pc, cur_bank&2, PIC_RP1_BIT);
+ break;
+ case 3:
+ if(cur_bank & 3) {
+ insertBankSwitch(0, pc, cur_bank&1, PIC_RP0_BIT);
+ insertBankSwitch(0, pc, cur_bank&2, PIC_RP1_BIT);
+ } else
+ insertBankSwitch(0, pc, -1, -1);
+ break;
+
+ }
+#endif
+
+
+
+
void pBlockDestruct(pBlock *pb)
{