pic16f877-20
PIC16F877A has analog comparators. On reset they are turned off but the pins are configured as analog inputs. The A model won't act pin compatible with the older PIC16F877 until the software changes the pins back to digital inputs.
There is a separate MicroChip programming spec for the A version which has different flow chart algorithms compared to the 16F877 specification.
And there are more differencies.
So it looks like you can not directly replace older 877 with the "improved" 877A..