Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to perform an exchange of elements of two arrays

Posted By: Sienna Hughes     Category: Assembly Language     Views: 4922

Write a program to perform an exchange of elements of two arrays.

Code for Program to perform an exchange of elements of two arrays in Assembly Language

DATA SEGMENT
A DB 1,2,3,4,5
B DB 6,7,8,9,10
DATA ENDS
CODE SEGMENT
      ASSUME DS:DATA,CS:CODE
START:
      MOV AX,DATA
      MOV DS,AX
      MOV CX,0000
      MOV CL,05
      LEA BX,A
      LEA SI,B
   L1:MOV DH,BYTE PTR[BX]
      MOV DL,BYTE PTR[SI]
      MOV BYTE PTR[BX],DL
      MOV BYTE PTR[SI],DH
      MOV DH,BYTE PTR[BX]
      MOV DL,BYTE PTR[SI]
      INC BX
      INC SI
      DEC CL
      CMP CL,00
      JNZ L1
      MOV AH,4CH
      INT 21H
CODE ENDS
END START

;OUTPUT:->
;-D DS: 0000 L5
;0BA8:0000  01 02 03 04 05
;-D DS: 0005 L5
;0BA8:0000                 06 07 08-09 0A
;-D DS: 0000 L5
;0BA8:0000  06 07 08 09 0A
;-D DS: 0005 L5
;0BA8:0000                 01 02 03-04 05

  
Share: 


Didn't find what you were looking for? Find more on Program to perform an exchange of elements of two arrays Or get search suggestion and latest updates.

Sienna Hughes
Sienna Hughes author of Program to perform an exchange of elements of two arrays is from London, United Kingdom.
 
View All Articles

 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!