Topic
16
Data Register
LEARNING OUTCOMES By the end of this topic, you should be able to:
1.
Differentiate the six types of register used in data operation; and
2.
List all the components for these five types of register.
INTRODUCTION
In this topic, we will discuss how registers are used. As explained earlier, register is an important component to store and manage operations. The 8088 CPU provides 14 registers and each register is 16 bits. These particular registers are classified into the following: (a)
Data Register: AX, BX, CX, DX
(b)
Segment Register: CS, DS, SS, ES
(c)
Index Register: SI, DI
(d)
Special Purpose Register: IP, SP, BP
(e)
Flags
142
TOPIC 16
DATA REGISTER
16.1 DATA REGISTER ACTIVITY 16.1 Registers are classified according to their functions. In your opinion, why do we need various registers while executing a process? It is called data register or general function register because it is used to perform arithmetic operation and data movement. Each 16-bits register can be divided into two 8 bits-register as shown below: AX AH
BX AL
BH
CX BL
CH
DX CL
DH
DL
For example, if register AX has value 126Fh thus the value for AL and AL register are: AL = 6Fh AH = 12h The tasks of a data register are as follows: (a)
(accumulator ) is used by the CPU for arithmetic operations.
(b)
(base ) can also be used for arithmetic operations. BX usually stores address of variables.
(c)
(counter ) CX is used as a counter for loops.
(d)
(data ): has an important task in multiplication and division processes.
16.2 SEGMENT REGISTER The 8088 CPU was designed to address 220 bytes of memory space. However, as its size is only 16 bits, it can only address up to 216 bytes. To solve this particular problem, the memory space was divided into a few segments. Each segment was 216 bytes. Segment register is provided to show the base location for a particular segment.
TOPIC 16
DATA REGISTER
143
A program has four segments such as code segment, data segment, stack segment and additional segment. The base location for each segment is shown in the below diagram:
.1: Segment register
16.3 INDEX REGISTER The Index register contains the value that refers to the variable, label or instruction from the base position for a segment. Index register can be used to increase the efficiency of string processing, arrays and any data structure that has various elements. Index register can be divided into: (a)
(source index ): This register is named based on the string movement for the 8088 CPU that is used so that the string source can be shown by the register. SI usually consists of offset value for DS register.
(b)
(destination index ): It functions as a pointer to the destination of the string movement instruction. It usually consists of offset value for ES register.
144
TOPIC 16
DATA REGISTER
16.4 SPECIAL PURPOSE REGISTER This register consists of three types as shown below:
16.5 FLAG ACTIVITY 16.2 In your opinion, why do we need registers named Flags? Flags are special 16-bits register because each byte position will give an output status for an arithmetic operation. However, each flag position is not required to be reminded because 8088 CPU instructions are designed to test and manipulate the flag.
SELF-CHECK 16.1 List down the similarities and differences of the data register and index register.
TOPIC 16
DATA REGISTER
145
In short, this topic covers information on data register used in the 8088 CPU processor. For easy understanding, these registers were classified by its function. As you now understand more on the registers, you will learn the assembly language program format that is used in developing a program.
Data Register
Segment Register
Flag
Special Purpose Register
Index Register