What happens to the value of IP each time an instruction is executed
In the previous question, assume that the instruction is 2 bytes, what happens for IP after the instruction execution?
1)Instruction Pointer(IP) is the 16 bit register. It holds the offset of the next instruction to be executed in the code segment.
The logical address of the instruction consists of CS(code segments) and IP(instruction pointer).
The instructions are stored in the byte aligned fashion in memory and IP holds the pointer to the instruction. So each time an instruction is executed in byte sized memory, the value of offset in IP register is incremented by one.
Instruction Pointer(IP) is incremented by 1 after every instruction byte is executed. IP->IP + 1
Value of IP will be incremented by 1 each time an instruction is executed.
2) If the instruction is 2 bytes, then value of Offset in IP register will be incremented by 2 .
Instruction pointer IP is incremented once for each byte so for size of two bytes of instruction the Instruction Pointer (IP) will be incremented by 2 that is IP-> IP + 2
Value of IP will be incremented by 2 for instruction of size 2 bytes.
Get Answers For Free
Most questions answered within 1 hours.