09-Write an ALP in 8086 to perform NON-OVERLAPPED Block Transfer (Using CLD)

.model small

disp macro msg
 mov ah,09h
 lea dx,msg
 int 21h
endm



.data
   msg1 db 10,13,10,13,"The non-overlapping array is:$"
   msg2 db 10,13,10,13,"Enter 5 characters:$"
   src db 05 dup(0)
   dest db 05 dup(0)
   cnt db 00

.code
   main:
      mov ax,@data
      mov ds,ax
      mov es,ax

      lea SI,src
      lea DI,dest

      disp msg2
      up:
         mov ah,01h
         int 21h
         mov [SI],al
         inc SI
         inc cnt
         cmp cnt,05
         jne up
      disp msg1
      lea SI,src
   

      CLD
      mov cx,0005h
      rep movsb

      lea SI,src

      mov cnt,00
      l1:
        mov dl,[SI]
        mov ah,02h
        int 21h
        inc SI
        inc cnt
        cmp cnt,0AH
        jne l1
      mov ah,4ch
      int 21h
   end main
end

----------------------------------------------OUTPUT---------------------------------------------------


D:\tasm\BIN>edit nov2.asm

D:\tasm\BIN>tasm nov2.asm
Turbo Assembler  Version 4.1  Copyright (c) 1988, 1996 Borland International

Assembling file:   nov2.asm
Error messages:    None
Warning messages:  None
Passes:            1
Remaining memory:  451k


D:\tasm\BIN>tlink nov2.obj
Turbo Link  Version 7.1.30.1. Copyright (c) 1987, 1996 Borland International
Warning: No stack

D:\tasm\BIN>nov2


Enter 5 characters:Hello

The non-overlapping array is:HelloHello
D:\tasm\BIN>

Previous
Next Post »

Disqus Shortname

Comments system