有如下的汇编程序段,请完成code段中的代码,实现将string1段和string2段中的数据拷贝到string3段中,并且将string3段中的数据输出到屏幕。
string1 segment
str1 db ‘welcome to $’
string1 ends
string2 segment
str2 db ‘quanzhou$’
string2 ends
string3 segment
str3 db 20 dup(0)
string3 ends
CODES SEGMENT
正确答案:
CODES SEGMENT
START:
mov ax,string1
mov ds,ax ;数据段设置为string1
mov ax,string3
mov es,ax ;辅助段设置为string3
mov bx,0
mov cx,11
s: mov al,[bx]
mov es:[bx],al
inc bx
loop s ;拷贝string1到string3
mov ax,string2
mov ds,ax ;数据段改变为string2
mov bx,0
mov cx,8
s1: mov al,[bx]
mov es:[bx+11],al
inc bx
loop s1 ;拷贝string2到string3
mov bx,0
mov cx,19
s2: mov dl,es:[bx]
mov ah,02
int 21h
inc bx
loop s2 ;将string3输出到屏幕
MOV AH,4CH
INT 21H
CODES ENDS
END START