The code segment is a segment that stores the code data type of a program. Ie it stores the instructions being executed.
The next instruction to be executed in the code segment is located by the following logical address:
- the CS segment selector value is in the CS register
- the EIP offset is located in the EIP register (Instruction Pointer Register)
More Instruction - Cycle.
The segment selector that locate this segment is the CS segment register.
The CS register contains the segment selector for the code segment.
The CS register cannot be loaded explicitly by an application program. Instead, it is loaded implicitly by instructions or internal processor operations that change program control (such as procedure calls, interrupt handling, or task switching).