I am trying to simulate the PIC16F84
and now need to implement PCL
/ PCLATH
registers.
The PIC16F84
has 1K of Program memory.
The PCL
is 8Bit wide, so in this case Bit 0 and 1 of PCLATH
is used to switch between the four Pages each having a size of 256B
, am I right so far?
Based on this, I do not understand the following:
The Datasheet states for a GOTO
:
The upper bits of PC are loaded from PCLATH<4:3>. GOTO is a two- cycle instruction.
But aren't the upper Bits of PCLATH
too much? I mean there are only 4 Pages, each 256B, hence only bit 0 and 1 of PCLATH
are needed. Or in other words - Bit 3 and 4 of PCLATH
are always 0 ? Why would I then need to care about 'PCLATH' when performing a 'CALL' or 'GOTO' ?