+ Reply to Thread
Results 1 to 2 of 2

Thread: move data from memory location to another

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    15

    move data from memory location to another

    I want an assembly program to move a block of 20 characters from one memory location (indicated by SI) to another location of the memory (indicated by DI).

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    19
    Code:
    .model small
    .data
    data1 db 'abcdefghijklmnopqrst'
    data2 db 20 (?)
    
    .code
    start:
    mov ax,@data
    mov ds,ax
    mov si,OFFSET data1  ; is used to make Pointer SI point to the first character in string data1 
    mov di,OFFSET data2  ; is used to make pointer DI point to the first character in string data2
    mov cx,20
    rep movsb ; mov sb operation is used to transfer memory location addressed by SI to memory location addressed by DI
                   ;Rep is repeat transfer operation as cx counter contain (as this example the transfer is repeat 20 times to transfer 20 character from data1 to data2 
    mov ah,4ch
    int 21h
    end start

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts