A little explanation for the interrupt-on-change function:
(an extract from the datasheet, see below)
The input pins (of RB7:RB4) are compared with the old value latched on the last read of PORTB
(the bottom latch on the attached figure).
The “mismatch” outputs of RB7:RB4 are OR’ed together to generate the RB Port Change Interrupt
with flag bit RBIF (INTCON<0>).
The user, in the Interrupt Service Routine, can clear the interrupt in the following manner:
a) Any read or write of PORTB. This will end the mismatch condition.
b) Clear flag bit RBIF.
A mismatch condition will continue to set flag bit RBIF. Reading PORTB will end the mismatch
condition and allow flag bit RBIF to be cleared.
Attached the figure 3-4 from this datasheet (PIC16F87X):
http://ww1.microchip.com/downloads/en/devicedoc/30292c.pdf View chapter 3.2.
A remark:
You don't needed to handle (enable-disable) the global IE bit (GIE).
It's automatic by the HW: at begin of the IT routine it's disabled, and the return (instr. retfie)
enables it.
Hope this helps, too.
zuisti