(5)题目:
将a段和b段指的数据依次相加,将结果保存到c段中(其它描述略)
分析:先将a段数据复制到c段,之后b段数据与a段数据相加。
代码如下:
assume cs:code
a segment
db 1,2,3,4,5,6,7,8
a ends
b segment
db 1,2,3,4,5,6,7,8
b ends
c segment
db 0,0,0,0,0,0,0,0
c ends
code segment
start:mov ax,a
mov es,ax
mov ax,c
mov ds,ax
mov bx,0
mov cx,4
s1:mov ax,es:[bx]
mov [bx],ax
add bx,2
loop s1
mov ax,b
mov es,ax
mov bx,0
mov cx,4
s2:mov ax,es:[bx]
add [bx],ax
add bx,2
loop s2
mov ax,4c00h
int 21h
code ends
end start