0% found this document useful (0 votes)
36 views

Subtraction of Two 16 Bit Numbers

The document describes an assembly language program that subtracts two 16-bit numbers. It stores the result in the DIFF label and stores the borrow value in the DIFF+2 label. The program loads the first number into the AX register, subtracts the second number from it, stores the result in DIFF, sets AX to 0, adds the carry to get the borrow value and stores it in DIFF+2. The aim is achieved by obtaining the subtraction of two 16-bit numbers.

Uploaded by

api-26685949
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Subtraction of Two 16 Bit Numbers

The document describes an assembly language program that subtracts two 16-bit numbers. It stores the result in the DIFF label and stores the borrow value in the DIFF+2 label. The program loads the first number into the AX register, subtracts the second number from it, stores the result in DIFF, sets AX to 0, adds the carry to get the borrow value and stores it in DIFF+2. The aim is achieved by obtaining the subtraction of two 16-bit numbers.

Uploaded by

api-26685949
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Adam’s Engineering College, Paloncha

ECE Department –MPI LAB

Experiment No.: 3 Year : III/IV B.Tech II Semester


Page 1 of 1

SUBTRACTION OF TWO 16-BIT NUMBERS

Aim: - To write an assembly language program for


subtraction of two 16-bit numbers.

Registers: - AX

Description: - Two 16-bit numbers are subtracted


and the result is stored in DIFF and BARROW is stored
in DIFF+2.

Ports:- None.

DATA SEGMENT

FIRST DW ?
SECOND DW ?
DIFF DW 2 DUP(0)
DATA ENDS

CODE SEGMENT
ASSUME CS: CODE, DS: DATA
START:
MOV AX, FIRST
SUB AX, SECOND
MOV DIFF, AX
MOV AX, 00
ADC AX, 00
MOV DIFF+2, AX

CODE ENDS
END START

Result: Subtraction of two 16-bit numbers is obtained.

Lab in-charge HOD, ECE

You might also like