Exp 02u
Exp 02u
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.
Theory: The 8086 processor uses the ADD and SUB instructions for basic arithmetic. The ADD
command adds an immediate value, memory content, or register content to another register or
memory location, storing the result in the destination. However, it doesn't support memory-to-
memory addition, and segment registers cannot participate. Arithmetic flags are updated based on
the results. Similarly, the SUB instruction operates under the same constraints. For effective
addition or subtraction, one operand must first be moved to a register (e.g., AL or AX), where
operations are performed.
Procedure:
1. Input opcodes starting at memory location 2000 using win862 on the 8086 trainer kit.
2. Execute the program step-by-step with the GO command on the 8086 trainer kit.
3. Run the program in MASM611, using -T for single-step execution. Verify the registers to
confirm proper initialization.
For Addition:
For Subtraction:
(a) (b)
Figure-2.1(a) Original source code for Addition and (b) Output for Addition.
Original Source & Output for SUBTRACTION:
(a) (b)
Figure-2.2(a) Original source code for Subtraction and (b) Output for Subtraction
Result Table:
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
Results & Discussion:
When performing 32-bit addition and subtraction in EMU8086, it is crucial to understand the
limitations and implications of working with 32-bit integers on a 16-bit architecture. The
EMU8086 processor, being a 16-bit processor, does not have native support for 32-bit operations.
As a result, 32-bit addition and subtraction operations need to be implemented through multiple
16-bit operations.
In this lab experiment we have seen the addition and subtraction of 32 bit numbers using
microprocessor 8086. Here we have given a code in EMU8086 software to perform addition
operation and a separate code to perform subtraction operation after which we can see the result
in the output. Then we have made the result table where assembly language, machine code and
kit output are arranged in separate columns. And this was the work of our lab experiment.
Conclusion:
In conclusion, while it is possible to perform 32-bit addition and subtraction in EMU8086 through
careful management of data and flags, it is important to be aware of the additional complexity and
considerations involved compared to working with native 16-bit operations. Proper handling of
carry flags, sign bits, and memory alignment is essential for accurate results when working with
32-bit arithmetic on a 16-bit processor architecture like EMU8086.