So, as the question states, what is the purpose of CS and IP registers in intel's 8086
I found this explanation:
Code segment (CS) is a 16-bit register containing address of 64 KB segment with processor instructions. The processor uses CS segment for all accesses to instructions referenced by instruction pointer (IP) register. CS register cannot be changed directly. The CS register is automatically updated during far jump, far call and far return instructions.
and this for IP:
Instruction Pointer (IP) is a 16-bit register.
I don't really understand what this basically means, so if someone could provide a more "vivid" explanation, that would be great :)
A special-purpose register, usually called the instruction pointer (IP) or program counter (PC), keeps track of what instruction is being executed.
Instruction Pointer (IP): It is a 16-bit register. It holds offset of the next instructions in the Code Segment. IP is incremented after every instruction byte is fetched. IP gets a new value whenever a branch instruction occurs.
Given that cs means "code segment" and that ip means "instruction pointer" (this is not a general purpose register!) the combination cs:ip represents the location where the CPU is currently fetching instructions to execute. Follow this answer to receive notifications. answered Nov 12, 2017 at 14:30. Sep Roland.
Segment register − BIU has 4 segment buses, i.e. CS, DS, SS& ES. It holds the addresses of instructions and data in memory, which are used by the processor to access memory locations. It also contains 1 pointer register IP, which holds the address of the next instruction to executed by the EU.
The physical address is calculated from 2 parts. i) segment address. ii) offset address. The CS(code segment register) is used to address the code segment of the memory i.e a location in the memory where the code is stored. The IP(Instruction pointer) contains the offset within the code segment of the memory. Hence CS:IP is used to point to the location (i.e to calculate the physical address)of the code in the memory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With