- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
8086 program to determine subtraction of corresponding elements of two arrays
In this program we will see how to subtract the contents of two different arrays.
Problem Statement
Write 8086 Assembly language program to subtract the contents to corresponding elements which are stored in two different arrays
Discussion
In this example there are two different arrays. The arrays are stored at location 501 onwards and 601 onwards. The size of these two arrays are stored at offset location 500. We are taking the array size to initialize the counter, then by using loops we are subtracting the elements one by one
Input
Address | Data |
---|---|
… | … |
500 | 04 |
501 | 09 |
502 | 03 |
503 | 08 |
504 | 06 |
… | … |
601 | 04 |
602 | 01 |
603 | 02 |
604 | 03 |
… | … |
Flow Diagram
Program
MOV SI, 500 ;Point Source index to 500 MOV CL, [SI] ;Load the array size into CL MOV CH, 00 ;Clear Upper half of CX INC SI ;Increase SI register to point next location MOV DI, 601 ;Destination register points to 601 L1: MOV AL, [SI] ;Load A with the data stored at SI SUB AL, [DI] ;Subtract DI element from AL MOV [SI], AL ;Store AL to SI address INC SI ;SI Point to next location INC DI ;DI Point to next location LOOP L1 ;Jump to L1 until the counter becomes 0 HLT ;Terminate the program
Output
Address | Data |
---|---|
… | … |
500 | 04 |
501 | 05 |
502 | 02 |
503 | 06 |
504 | 03 |
… | … |
- Related Articles
- 8086 program to determine sum of corresponding elements of two arrays
- 8086 program to determine product of corresponding elements of two array elements
- 8086 program to determine modulus of first array elements corresponding to another array elements\n
- 8086 program to determine cubes of numbers in an array of n numbers
- 8086 program to determine squares of numbers in an array of n numbers
- Comparing corresponding values of two arrays in JavaScript
- 8086 program to determine largest number in an array of n numbers
- Program to find uncommon elements in two arrays - JavaScript
- Java Program to Find Common Elements Between Two Arrays
- PHP program to calculate the repeated subtraction of two numbers
- Golang Program to find the common elements from two arrays
- Golang Program to find the uncommon elements from two arrays
- Golang Program to find the Distinct elements from two arrays
- C++ Program to find the common elements from two arrays
- Applying a custom function to each corresponding element of two arrays using JavaScript

Advertisements