SEGMENT REGITERS Presented by: SADIA NAUSHAHI 2014-UETR-CS-05 4 th Semester Presented to : Mam Aasma Fayyaz Subject: Computer Organization & Assembly Language
Basic Concepts 3 1. Register (Discrete memory location) 2. Existence (CPU) 3. Function (To hold temporary data or instruction) 4. Types of registers General purpose registers (AX,BX,CX,DX,BP,DI,SI,SP) Special purpose registers (Hold program state) (IP,FLAGS) Segment Registers (CS,DS,ES,SS,FS,GS)
4 CS CODE SEGMENT DS DATA SEGMENT SS STACK SEGMENT ES EXTRA SEGMENT FS General purpose segment GS General purpose segment SEGMENTS : Segments are the specific areas defined in program containing data, code and stack.
1 . stack (Directive) is for stack segment: Reserves memory space for use of program instructions during function calls. 2 .data (Directive) for data segment: Reserves memory space for constants and variables 3 .code(Directive) for code segment: Reserves space for storage of program instructions in memory 5 IN emu8086
SEGMENT Registers : The registers specify the location of segments are called segment registers. 1. Code segment Register: Starting address of the section of memory holding code. 2. Data segment Register: Stores the starting address of data segment . 3. Extra segment Register: Used by string instruction to hold destination data. 4. Stack segment Register : Defines the area of memory used for the stack. 6
The segment registers stores the starting addresses of a data. To get the exact location of data or instruction within a segment, an offset value is required. To reference any memory location in a segment, the processor combines the segment address in the segment register with the offset value of the location. Formula: Physical address=(Address of data segment)×10H+offset value Segment : offset 7 Physical Address: