Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of CS and IP registers in Intel 8086 assembly?

Tags:

x86

x86-16

intel

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 :)

like image 488
idjuradj Avatar asked Jul 21 '13 21:07

idjuradj


People also ask

What is the purpose of the IP register?

A special-purpose register, usually called the instruction pointer (IP) or program counter (PC), keeps track of what instruction is being executed.

What is the use of IP register in 8086?

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.

What is address CS IP?

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.

What is the purpose of segment registers in 8086?

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.


1 Answers

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.

like image 70
kiran james Avatar answered Sep 19 '22 15:09

kiran james