|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
data segment
str1 db 'what is your name?',0ah,0dh,'$'
cn EQU $-str1
str2 EQU str1+cn-5 ; 定义str2单元
data ends
code segment
assume ds:data,cs:code,es:data
start:mov ax,data
mov ds,ax
mov es,ax ; 段寄存器初始化
mov dx,OFFSET str1
mov ah,09h
int 21h ; 显示字符串
mov si,OFFSET str1 ; di指向原字符串首单元
mov di,OFFSET str2 ; si指向目表位置首单元
mov cx,cn ; 循环次数送cx
add si,cn-1 ; si指向原串末单元
add di,cn-1 ; di指向目标位置末单元
std ; df=1
rep movsb ; 重复传送
mov dx,OFFSET str2
mov ah,09h
int 21h ; 显示字符串
mov ah,4ch
int 21h ; 返回DOS
code ends
end start |
|