PIC PAGE TRICK (Peter Hemsley - Received July 01)

When writing code that regularly changes the direction of PIC ports from input to output and vice-versa, more efficient code can be produced by making use of the indirect file registers (FSR and INDF) as they can provide direct access to two register banks (Pages) without the bank
switching instructions:

Example using "normal" bank (page) switching:
PAGE1
BCF TRISA,4   ;change TRISA bit 4 to output
PAGE0
BCF PORTA,4   ;set PORTA bit 4 to low
PAGE1
BSF TRISA,4   ;change TRISA bit 4 to input
PAGE0
MOVF PORTA,W  ;read PORTA

...

Example using INDF:
MOVLW TRISA   ;set FSR for access to TRISA
MOVWF FSR
...
...
BCF INDF,4    ;change TRISA bit 4 to output
BCF PORTA,4   ;set PORTA bit 4 to low
BSF INDF,4    ;change TRISA bit 4 to input
MOVF PORTA,W  ;read PORTA
