[go: up one dir, main page]

0% found this document useful (0 votes)
10 views6 pages

MP Lab Manual

The document outlines three assembly language programs for the 8085 microprocessor: one for 8-bit addition, one for 16-bit addition, and one for 8-bit subtraction. Each program includes an algorithm, memory addresses, machine codes, and input/output values, demonstrating successful execution and storage of results in memory. The results confirm the correctness of the operations performed in each program.

Uploaded by

Selvam Mano
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)
10 views6 pages

MP Lab Manual

The document outlines three assembly language programs for the 8085 microprocessor: one for 8-bit addition, one for 16-bit addition, and one for 8-bit subtraction. Each program includes an algorithm, memory addresses, machine codes, and input/output values, demonstrating successful execution and storage of results in memory. The results confirm the correctness of the operations performed in each program.

Uploaded by

Selvam Mano
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/ 6

PROGRAM 1: 8-BIT ADDITION

Aim
To add two 8-bit numbers using 8085 Assembly language.
Algorithm
1. Load first 8-bit number into accumulator.
2. Load second 8-bit number into register B.
3. Add B to accumulator.
4. Store result in memory.
5. Halt.
Program
Memory Machine
Label Mnemonics Operand
Address Codes
4100 3A LDA 4500H
4101 00
4102 45
4103 4F MOV C, A
4104 3A LDA 4501H
4105 01
4106 45
4107 81 ADD C
4108 32 STA 4502H
4109 02
411A 45
411B 76 HLT
Input and Output
Memory Address Values / Result
4500 5
4501 3
4502 8
Results
Thus, the above program for 8-bit addition has been executed and the result is verified
successfully.
PROGRAM 2: 16-BIT ADDITION

Aim:

To perform 16-bit addition using 8085 assembly language and store the result in
memory.

Algorithm:
1. Load lower byte of first number into register pair HL.
2. Load lower byte of second number into DE.
3. Add lower bytes and handle carry.
4. Add higher bytes along with carry.
5. Store the 16-bit result in memory.
Program
Memory Machine
Label Mnemonics Operand Comments
Address Codes
Load HL pair with first 16-
4200 2A LHLD 4600H
bit number
4201 00
4202 46
Exchange HL and DE, DE
4203 EB XCHG
has first number
Load HL with second 16-
4204 2A LHLD 4602H
bit number
4205 02
4206 46
Add DE (first) with HL
4207 19 DAD D
(second)
Store result from HL to
4208 22 SHLD 4604H
4604H, 4605H
4209 04
420A 46
420B 76 HLT Halt the program
Input
Memory Address Values / Result
4600 34
4601 12
4602 78
4603 56

Calculation
1st Number: 1234H
2nd Number: 5678H
Result: 68ACH

Output
Memory Address Values / Result
4604 AC
4605 68

Result:

Thus, the 16-bit addition was performed successfully using the 8085 microprocessor,
and the result was stored correctly in memory.
PROGRAM 3: 8-BIT SUBTRACTION

Aim:

To write an assembly language program to subtract two 8-bit numbers using 8085
microprocessor.

Algorithm:
1. Load the first 8-bit number from memory location 4500H into register A.
2. Load the second 8-bit number from memory location 4501H into register
B.
3. Subtract the contents of register B from register A.
4. Store the result in memory location 4502H.
5. Terminate the program.
Program:
Memory Machine
Label Mnemonics Operand Comments
Address Codes
Load first number from
4100 3A LDA 4500H
memory to A
4101 00 Low byte of 4500H
4102 45 High byte of 4500H
4103 4F MOV C, A Copy to C (store minuend)
4104 3A LDA 4501H Load second number to A
4105 01 Low byte of 4501H
4106 45 High byte of 4501H
4107 47 MOV B, A Store subtrahend in B
4108 79 MOV A, C Restore minuend to A
4109 90 SUB B A=A-B
411A 32 STA 4502H Store result in 4502H
411B 02 Low byte of 4502H
411C 45 High byte of 4502H
411D 76 HLT Halt program
Input and Output
Memory Address Values / Result
4500 5
4501 3
4502 2

Result:
The subtraction of two 8-bit numbers 05H and 03H is successfully done and the result
02H is stored in memory location 4502H.

You might also like