Transfer block of N bytes from source to destination
Algorithm for Transfer block of N bytes
Step I : Initialize the data in the source memory and destination memory.
Step II : Initialize SI and DI with source and destination address.
Step III : Initialize CX register with the count.
Step IV : Initialize the direction flag to zero.
Step V : Transfer the data block byte by byte to destination.
Step VI : Decrement CX.
Step VII : Check for count in CX, if not zero goto step V else goto step VIII.
Step VIII : Display the bytes in destination location.
Step IX : Stop.
Transfer Block of N Bytes Code
.model small
.data
src_blk db 01, 02, 03, 04, 05, 06, 07, 08, 09, 0AH
dest_blk db 10 dup(?)
count dw 0AH
.code
mov ax, @data ; initialize data
mov ds, ax
mov es, ax
mov si, offset src_blk ; si to point to source block
mov di, offset dest_blk ; di to point to destination block
mov cx, count ; initialize counter
cld ; df=0
again : rep movsb ; transfer contents
mov di, offset dest_blk ; di to point to
; destination block
mov bh, 0Ah ; initialize counter
up: mov bl, [di] ; store result in bl
mov cx, 0204h ; Count of digits to be
displayed in
; ch and digits to be
mrolled in cl
l1: rol bl, cl ; roll bl so that msb comes
to lsb
mov dl, bl ; load dl with data to be
displayed
and dl, 0fh ; get only lsb
cmp dl, 09h ; check if digit is 0-9
; or letter A-F
jbe l12
add dl, 07h ; if letter add 37H
; else only add 30H
l12: add dl, 30h
mov ah, 02 ; Function 02 under
; INT 21H
int 21h
dec ch ; Decrement Count
jnz l1
dec bh ; decrement counter
inc di
mov ah, 02h ; display space
; between bytes
mov dl, ' '
int 21h
cmp bh, 00h ; repeat till all bytes
; are displayed
jne up
mov ah, 4ch ; normal termination
; to dos
int 21h
end


embroidery services says
Very nice blog post. I definitely appreciate this website.
Keep writing!