Sunday, January 16, 2022

write a program that interchanges the corresponding elements of two arrays.

 INCLUDE C:\IRVINE\IRVINE32.INC

.386

.STACK 4096

EXITPROCESS PROTO,DWEXITCODE:DWORD

.DATA

                                                  

array1 DWORD 1,7,1,5,3

array2 DWORD 4,7,3,1,2

str1  BYTE "So Array After Swaping is: ",0

.CODE

MAIN PROC 

mov edx,OFFSET str1

call WriteString

call crlf

mov edx,OFFSET array1

mov ebx,OFFSET array2

mov esi,0

mov edi,0

mov ecx,5

l1:

mov eax,array1[esi]

mov ebx,array2[edi]

mov edx,eax

mov eax,ebx

call WriteInt

add esi,4

add edi,4

loop l1

mov esi,0

mov edi,0

mov ecx,5

call crlf

l2:

mov eax,array1[esi]

mov ebx,array2[edi]

mov edx,eax

mov ebx,edx

call WriteInt

add esi,4

add edi,4

loop l2


INVOKE EXITPROCESS,0

MAIN ENDP

END MAIN

No comments:

Post a Comment