Write an assembly program to COPY A BLOCK OF DATA FROM ONE MEMORY TO ANOTHER

Write an assembly program to COPY A BLOCK OF DATA FROM ONE MEMORY TO ANOTHER
title copy a block of data from one memory to another
dosseg
.model small
.stack 100H
.code
main proc
mov ax, @data ; initialize ds register
mov ds, ax
mov SI, offset array1 ; source index
mov di, offset array2 ; destination index
mov cx, 06H ; for 6 data ie cx is implicit counter
BACK: mov al, [SI] mov [di], al ; move [di], [si] inc si
inc di
loop BACK ; loop always looks for counter cx
mov ax, 4C00H ; return to DOS
int 21H ; interrupt
main endp
.data
array1 db 01, 02, 03, 04, 05, 06
array2 db 6 dup (?) ; or dup(0) to initialize
result db?
end main
Visit our download section to download free simulators/ emulators and other essential engineering softwares or join the free update newsletters now.

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top