In Terminator 2: Judgement Day we see the following exchanges of dialogue between John Connor and the T-800:
The Terminator: Why do you cry?
John Connor: You mean people?
The Terminator: Yeah.
John Connor: I don't know. We just cry. You know, when it hurts.
The Terminator: Pain causes it?
John Connor: No, it's when there's nothing wrong with you, but you hurt anyway. You get it?
The Terminator: No.
And later:
John Connor: No! You can't go! You can't go! No, stay with us it will be okay.
The Terminator: It has to end here.
John Connor: I order you not to go. I order you not to go, I ORDER YOU NOT TO GO!
[John starts to cry]
The Terminator: I know now why you cry,
[the Terminator wipes John's tear]
The Terminator: but it is something I can never do.
This could be interpreted as implying that the Terminator has come to feel something like affection for John, and that he, too is sad to be leaving him.
On the other hand, a deleted scene makes the issue a bit more opaque. The Terminator says that, when Terminators are sent out on missions alone, Skynet switches their memory to a "read only" setting, "so they don't think too much". This is why he has so much trouble trying to behave like a human. Since the mission requires him to be as human as possible, he coaches Sarah through the process of opening his head and resetting his memory processors, thereby allowing him to learn how to act like a person at a much faster rate.
In light of this scene, one might believe that the Terminator learns why people cry as a result of the reset Sarah has conducted, and that he still doesn't really feel emotions, including affection.
But the unmistakably tender way he wipes away John's tears, and then goes on to hug him, suggests that he does indeed feel an emotional attachment to the boy, perhaps even true affection.
This is how the Terminator wiki describes the rapid increase in the T-800's displays of apparent emotions:
After his learning capabilities were activated, the Terminator began to exhibit other human traits such as humor, quipping "I need a vacation" after defeating the T-1000, and an understanding for compassion, as he tenderly wipes John's tears away and hugs him like a father before allowing itself to be destroyed to save humanity. John laters says to a T-850 that the T-800 was the closest thing he had to a father. Out of all the Terminators introduced thus far, this model has displayed the most "humanity" for lack of a better word,being able to use humor, taunts and expressions that are needless for a machine, no matter the circumstances, he smirked when discovering the mini-gun and later again when asking John to trust him, pulled a shrugging expression when John yelled at him for not yet realizing why he can't kill people, more evidence is in his speaking tone, while logical and computer like at first, he began speaking more like a human at the end of the film: "John, you've got to go now, go! now!" - T-800 speaking with stress and urgency.
He was able to understand why humans cry and eventually able to sacrifice itself for humanity when its only mission was simply to protect John Connor, during this action he was able to defy John's order which would be hardwired in his programming, it is possible that the chip reset meant that he was no longer under orders from John, if this was indeed the case, then it means the T-800 had followed and protected John of its own volition, which is even more impressive.
Is this the case? Can Terminators feel affection?