我想在程序集8086中编写一个子程序,它将两个数组作为参数。 我该怎么做? 这是我的代码,直到现在:
mov dl,[arr1]
mov dh, [arr2]
call adding
这是我的子程序:
adding proc
push ax
push bx
push cx
mov [arrx],dl
mov [arry],dh
mov cx, duplen
mov bx, cx ; point to lest significant digit!
dec bx
next_digit:
; add digits:
mov al, arrx[bx]
adc al, arry[bx]
; this is a very useful instruction that
; adjusts the value of addition
; to be string compatible
aaa
mov sum[bx], al
dec bx
loop next_digit
pop cx
pop bx
pop ax
ret
它出了什么问题?
答案 0 :(得分:0)
而不是
mov dl,[arr1]
mov dh, [arr2]
call adding
使用类似
的内容mov si,arr1
mov di,arr2
call adding
在子程序中
clc ;You forgot this !!!
next_digit:
; add digits:
mov al,[si+bx]
adc al,[di+bx]
aaa
mov sum[bx],al
dec bx
loop next_digit