You are on page 1of 19

Exp 1: Addition and Subtraction

Q1
AIM: Perform the 8-bit addition and subtraction using the following addressing
modes:
a. Immediate addressing mode
b. Register addressing mode
c. Register indirect addressing mode
d. Direct addressing mode

REQUIREMENTS: MASM software

THEORY:
● Immediate addressing mode: The addressing mode in which immediate
data is part of the instruction.
● Direct addressing mode: Indirect addressing mode 16-bit memory address
is directly specified in the instruction.
● Register addressing mode: It means that the data is stored in a register.
● Register indirect addressing mode: The address of the memory location
which contains data or operand is determined in an indirect way using an
offset register.

ALGORITHM:
CODE:
SIMULATION:
MANUAL CALCULATION AND VERIFICATION:

● Input: AL = 22 H , 33H (immediate)


Output: AL = (22+33) = 55 H
Input: AL = 33 H 22H (immediate)
Output: AL = (33-11) = 11 H
● Input: AL = 22 H and BL = 33 H
Output: AL = (22+33) = 55 H
Input: AL = 22 H and BL = 33 H
Output: BL = (33-11) = 11 H
● Input: AL = [5000] = 22 H and BL = [5000] = 33 H
Output: AL = (22+33) = 55 H
Input: AL = [5000] 22 H and BL = [5000] = 33 H
Output: BL = (33-11) = 11 H
● Input: AL = 22 H , BX = [5000], [5000] = 33H
Output: AL = (22+33) = 55 H
Q2
AIM: Perform the 16-bit addition (with and without carry) and subtraction (with
and without borrow of two numbers.

THEORY: ADD is the command used for adding two numbers without carry and
ADC is used when carry is involved. SUB is the command used for adding two
numbers without borrow and SBB is used when borrow is involved.

CODE:
SIMULATION:
MANUAL CALCULATION:
● INPUT: AX = 2222 BX= 3333
OUTPUT: AX = (2222 + 3333) = 5555
● INPUT: AX = 2222 BX = 6667
OUTPUT: AX = (2222 + 6667) = 8889
● INPUT: AX = 3333 BX = 2222
OUTPUT: AX = (3333 - 2222) = 1111
● INPUT AX = 2222 BX = 1132
OUTPUT: AX = (2222 - 1132) = 10F0

Q3
AIM: Perform 16-bit addition and subtraction with data located at locations
0200H and 0220H.
CODE:

SIMULATION:
MANUAL CALCULATION:

● INPUT: AX = [0200] = 2222, BX = [0220] = 3333


OUTPUT: AX = (2222 + 3333) = 5555
OUTPUT: AX = (2222 - 3333) = FFFF FFFF FFFF EEEF

RESULTS:

All hexadecimal numbers have successfully been added and subtracted in


different methods and addressing modes and with different conditions. The
results have been cross-verified accurately.

You might also like