stack segment stack
db 256 dup(0)
stack ends
data segment
ary1 db 1,2,3,4,5,6,7,8,9,10
count1 equ $-ary1
sum1 dw ?
ary2 db 10,11,12,13,14,15,16,17,18
count2 equ $-ary2
sum2 dw ?
data ends
main segment
assume cs:main,ds:data,ss:stack
start proc far
push ds
xor ax,ax
push ax
mov ax,data
mov ds,ax
mov ax,count1
push ax
lea ax,ary1
push ax
call far ptr sum1
mov ax,count2
push ax
lea ax,ary2
push ax
call far ptr sum2
ret
start endp
main ends
proce segment
assume cs:proce
sum procfar
mov bp,sp
mov cx,[bp+6]
mov bx,[bp+4]
xor ax,ax
adn:add al,[bx]
adc ah,0
inc bx
loop adn
mov [bx],ax
ret 4
sum endp
proce ends
end start
------解决方案--------------------
sum1 sum2 都改成sum,功能是把ary1串的值相加,结果存放sum1,ary2串的值相加,结果存入sum2.