Professional Documents
Culture Documents
2
Registers
Course Code: CPE005 Program: BSCPE
Course Title: Computer Systems Organization with Assembly Language Date Performed:
Section: Date Submitted:
Name: Ruiz, Mark Daniel D. Instructor:
1. Objective:
This activity aims to demonstrate how the CPU registers are used for addition, subtraction,
multiplication and division operations and how the flag register are affected by these operations
The 8088 CPU for example, has fourteen 16 bit registers to process the data in a computer.
The general-purpose registers are primarily used for arithmetic and data movement. Each register can
be addressed as either a single 32-bit value or two 16-bit values. Portions of some registers can be
addressed as 8-bit values.
For example, the 32-bit EAX register has a 16-bit lower half named AX. The AX register, in turn, has
an 8-bit upper half named AH (A-High) and an 8-bit lower half named AL(A-Low).
The same overlapping relationship exists for the EAX, EBX, ECX, and EDX registers.
The remaining general-purpose registers only have specific names for their lower 16 bits, these are
used when writing real-address mode programs.
THE FLAGS
The EFLAGS (or just Flags) register consists of individual binary bits that control the operation of the
CPU or reflect the result of arithmetic and logical instructions. Some instructions test and manipulate
individual processor flags.
A flag is set when it equals 1; it is clear (or reset) when it equals 0. Figure 2-1 shows how each flag is
represented by DEBUG.
The operands can be considered as signed numbers or unsigned numbers. The unsigned multiplication
and division operations are MUL, DIV.
Sample Problem B:
1. Open Debug.exe
2. Assemble the following program:
-A 100
movax,ffff
add ax,01
int 21
3. Trace the values of the registers starting at address 0100
-T=100 2
4. Observe the output.
What did you observe in the output? Why?
The output has shown that the sum of bx and si is being moved to AL. And it shows that the
value of AX has chanhed and the carry flag has been set.
5. Record all results in Table 2.5.
6. Reset the values of the registers.
Sample Problem C.
1. Open Debug.exe.
2. Assemble the following program:
-A 100
mov al,00
sub al,01
int 21
2. Trace the values of the registers.
3. Observe the output.
Which flag/flags was/were affected by the given? Why?
The EL and PL were affected because of the negative register.
Sample Problem D.
1. Open Debug.exe.
2. Assemble the following program:
-A 100
mov al,0a
mov bl,05
mulbl
int 21
7. Trace the values of the registers.
Table 2.5 -Result of Sample Problem B.5
8. Observe the output.
What did you observe in the output? Why?
Instruction Register Content Flag Register
BL is being multiplied to all registers.
9. Record all results in Table 2.7.
AX BX CX DX IP NV U EI PL N N P N
10. Reset the values of the registers.
P Z A O C
Sample
MOVProblem E.
AX,FFFF FFF 0000 000 000 010 NV U EI PL N N P N
F 0 0 0 P Z A O C
1. Open Debug.exe.
ADD 2. AX,01
Assemble the following
FFF program:
0000 000 000 010 NV U EI PL N N P N
-A 100 F 0 0 3 P Z A O C
mov dx,0
INT 21hmov ax,8003 0000 0000 000 000 010 NV U EI PL Z A P C
mov cx,100 Table 2.5 -Result
0 of
0 Sample
6 Problem C.5 P R C E Y
div cx
Instruction Register Content Flag Register
int 21
3. Trace the values ofAX the registers.
BX CX DX IP
4. Observe the output.
What MOV
did you
AL,00
observe in the 0000
output? 0000
Why? 000 000 010 NV U EI PL N N P N
All register has been divided by cx. And 0 also,0the register
0 cx hasP the value 0100Zmoved
A into
O it.C And
ax is divided by cx.
SUB AL,01 00F 0000 000 000 010 NV U EI PL N N P N
5. Record all resultsFin Table 2.8. 0 0 2 P Z A O C
6. Reset the values of the registers.
INT 21h 00F 0000 000 000 010 NV U EI N N A P C
F 0 0 4 P G Z C E Y
6. DATA ANALYSIS:
Table 2.4- Result of Sample Problem A.2
AX BX CX DX IP
8. CONCLUSIONS
The registers can have data stored to them temporarily. Also, they’re versatility allows them to be
manipulated with flags and arithmetic
.