0% found this document useful (0 votes)
2 views4 pages

Ex 02

The experiment focused on performing 32-bit addition and subtraction using EMU-8086 software, demonstrating the use of ADD and SUB instructions. Results showed that the emulator accurately simulates arithmetic operations, with expected behavior of carry and overflow flags under specific conditions. The study highlights the importance of understanding low-level programming and computer architecture through the use of emulator software.

Uploaded by

kinjor khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Ex 02

The experiment focused on performing 32-bit addition and subtraction using EMU-8086 software, demonstrating the use of ADD and SUB instructions. Results showed that the emulator accurately simulates arithmetic operations, with expected behavior of carry and overflow flags under specific conditions. The study highlights the importance of understanding low-level programming and computer architecture through the use of emulator software.

Uploaded by

kinjor khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment No: 02

Experiment Name: Experimental study of 32-bit Addition & Subtraction using EMULATOR Software.
Objectives:
1. Perform addition and subtraction of two 32-bit numbers stored in memory and save the results.
2. Explore addition operations using EMU-8086 software.
3. Understand the methods for handling addition and subtraction in this software.
Required Software: EMU-8086.
Theory:
We use ADD instruction for addition and SUB instruction for subtraction. ADD instruction adds an
immediate data or contents of a memory location specified in the instruction or a register (source) to the
contents of another register (destination) or memory location. The result is in the destination operand.
However, both the source and destination operands cannot be memory operands. That means memory to
memory addition is not possible. All the condition code flags are affected depending upon the result.
Hence one of the operands is initially moved to AL OR AX. Then using the add instruction, 32-bit
addition is performed. The next arithmetic primitive is SUB. As discussed in ADD it permits the same
modes of addressing. Hence moving the minuend to a register pair is necessary. Then the result is moved
to a location in memory.
Source Code:

For Addition:

MOV AX, 1234H

MOV BX, 5678H

MOV CX, 4687H

MOV DX, 8986H

ADD BX, DX ADC AX,


CX

For Subtraction:

MOV AX, 1234H

MOV BX, 5678H

MOV CX, 4687H

MOV DX, 8986H

SUB BX, DX

SBB AX, CX
Original Source & Output for ADDITION:

Figure-2.1(a) Original source code for Addition and Output for Addition.

Original Source & Output for SUBTRACTION:

Figure-2.1(b) Original source code for Subtraction and Output for Subtraction.
Result Table:

Assembly Language Machine Code Kit output

MOV AX, 1234H B8 1234


34
12
MOV BX, 5678H BB 5678
78
56
MOV CX, 4687H B9 4687
87
46
MOV DX, 8986H BA 8986
86
89
ADD BX, DX 03 DF FE
DA

ADC AX, CX 13 58 BB
C1
MOV AX, 1234H B8 12324
34
12
MOV BX, 5678H BB 5678
78
56
MOV CX, 4687H B9 4687
87
46
MOV DX, 8986H BA 8986
86
89
SUB BX, DX 2B CC F2
DA
SBB AX, CX 1B CB AC
C1
Result and Discussion:
The experimental study successfully demonstrated 32-bit addition and subtraction using emulator
software. The results obtained from the emulator matched the expected theoretical values. No carry or
overflow was observed in normal cases, but special conditions like adding the maximum signed integer
resulted in an overflow flag (OF = 1), and subtracting a larger number from a smaller one triggered the
carry flag (CF = 1). This confirms that the emulator accurately simulates arithmetic operations at the
processor level, providing insights into how modern CPUs handle data.
Conclusion:
This experiment effectively illustrated the execution of 32-bit addition and subtraction at the assembly
language level. By analyzing the results, we observed how carry, borrow, and overflow flags behave
during arithmetic operations. Understanding these concepts is crucial for low-level programming,
microprocessor design, and embedded system development, making emulator software a valuable tool for
learning computer architecture assembly and language.

You might also like