100% found this document useful (1 vote)
3K views2 pages

Exp - No: 16-Bit Subtraction Date: Aim

This document describes a 16-bit subtraction assembly language program. It provides the aim, apparatus, algorithm, flowchart, program code, manual calculation, input and output addresses and data, and result. The program takes two 16-bit numbers as input from different memory locations, subtracts one from the other, stores the borrow or carry, and stores the 16-bit result in a separate memory location.

Uploaded by

Raja Patel
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
100% found this document useful (1 vote)
3K views2 pages

Exp - No: 16-Bit Subtraction Date: Aim

This document describes a 16-bit subtraction assembly language program. It provides the aim, apparatus, algorithm, flowchart, program code, manual calculation, input and output addresses and data, and result. The program takes two 16-bit numbers as input from different memory locations, subtracts one from the other, stores the borrow or carry, and stores the 16-bit result in a separate memory location.

Uploaded by

Raja Patel
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/ 2

EXP.

NO: 16-BIT SUBTRACTION


DATE:

AIM:

To learn to write an assembly language program for subtracting two sixteen bit numbers

APPARATUS REQUIRED:
 8085 Microprocessor kit,
 Power supply

ALGORITHM:

1. Start the program.


2. Enter the inputs in different memory location.
3. Subtract the result in one memory location.
4. Store the carry in another memory location.
5. Stop the program.

FLOWCHART:

START

Get the 1stnumber

Get the2ndnumber

Subtract the 2nd number

If
Borrow
=1

Store
Storethe
theborrow
carry

Store the result

STOP
PROGRAM:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS


4100 AF START XRA A ;Clear the accumulator
4101 2A LHLD 4300H ;Copy the contents of ;4300 H
4102 00
4103 43
4104 EB XCHG ;Exchange the content in ;DE to HL register
4105 2A LHLD 4302 H ;Load the HL register ;memory location 4302
4106 02
4107 43
4108 7B MOV A,E ;Copy the contents of A in ;E
4109 95 SUB L ;Subtract the E with ;accumulator
410A 6F MOV L, A ;Copy the contents of A to ;L
410B 7A MOV A, D ;Copy the contents of D to ;H
410C 9C SBB H ;Subtract B with ;accumulator
410D 67 MOV H, A ;Copy the contents of H to ;A
410E 22 SHLD 4304 H ;Content of HL register ;moves to 4305
410F 04
4110 43
4111 76 STOP HLT ; Stop the execution.

MANUAL CALCULATION:

DATA 1= 6A 19 H
DATA 2 =5C 15 H (-)

SUM = 0E 04 H

ADDRESS DATA
Input
4300 19 H (LSB OF DATA 1)
4301 6A H (MSB OF DATA 1)
4302 15 H (LSB OF DATA 2)
4303 5C H (MSB OF DATA 2)

Output
4304 04 H (LSB OF SUM)
4305 0E H (MSB OF SUM)

RESULT:

Thus the subtraction of two 16-bit numbers using assembly language program is performed
and the output is verified.

You might also like