I am learning 8086 and there is one particular question which is bothering me and I have not been able to find any satisfactory answer yet.
I understand that CPU executes the code sequentially and if want to change the code flow we would like the IP to point to the new/old address where the code of our interest is sitting.
Now, my question is why we(I mean CPU) don't just go and update the IP with the address corresponding to the label when we encounter jump instruction?
What is the need to have a displacement which is added to IP when we encounter jump instruction?
In my opinion
- calculating the displacement(i.e the distance from the jump label to the next instruction after the jump) and
- then taking that displacements 2's compliment,
- which finally gets added to the IP so that IP points to the address/instruction pointed by label
To me this sounds like more work then just updating the IP with the address corresponding to label. But, I am sure there must be a reason for the way things are done, its just that I am not aware.
What was the reason for this design choice in 8086?