Assembler-transfer string1 in the data segment to string2 in the additional segment

data segment
string1 db ‘assembly language’
data ends
extra segment
string2 db 17 dup(?)
extra segment
code segment
    assume cs:code,ds:data,es:extra
    push ds
    xor ax,ax
    push ax
    mov ax,data 
    mov ds,ax
    mov ax,extra
    mov es,ax
    lea si,string1
    lea di,string2
    mov cx,17
    rep movsb
code ends
    end start

Then you can view the contents of the data segment and the additional segment under the -u command plus the -d command, and finally you can see that the character string is transferred from the data segment to the additional segment.


Leave a Reply

Your email address will not be published.