MPC - Branch Islands on the PIC16C5x

MPC

The 8 bit address limitation of the 16C5x program counter imposes a restriction on the starting address of functions which presents added complexity. For example, on the 16C54 you cannot call a function that starts anywhere between 0x100-0x1FF as the 9th bit of the address in the CALL instruction is always 0.

MPC automatically inserts a branch island to overcome this restriction. The CALL to the function is replaced by a CALL to a corresponding branch island, which lies in the first part of the program memory. The branch island consists of any necessary clearing or setting of page bits to access the function, and a GOTO instruciton to the real function's starting address. The GOTO instruction does not have the 8 bit address limitation of CALL.

 #pragma memory ROM [MAXROM - 0x00] @ 0x00;
// Inserted branch island #pragma memory RAM [MAXRAM - 0x09] @ 0x09;
#pragma memory RAM [MAXB0  - 0x10] @ 0x10;
#pragma memory RAM [MAXB1  - 0x30] @ 0x30;
#pragma memory RAM [MAXB2  - 0x50] @ 0x50;
#pragma memory RAM [MAXB3  - 0x70] @ 0x70;
 void putchar(char ch);
 void main(){   char c;
  __TRIS(0x00,PORTB);
  putchar(c);
} 
#pragma memory ROM[MAXROM-0x700] @ 0x700;
 void putchar(char ch){   PORTB=ch;
}