您的位置:首页 > 其它

实训汇编语言设计——找出两个数组中相同的整数

2007-12-21 14:21 489 查看
找出A,B中相同的整数,存入C中

datarea segment
a dw 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
b dw 2,4,6,8,10,20,21,22,23,24,25,26,27,28,29,1,3,5,7,9
c1 dw 15 dup(0)
datarea ends
prognam segment
main proc far
assume ds:datarea, cs:prognam
start:
;set up stack to retuan
push ds
sub ax,ax
push ax
;set DS register to current segment
mov ax,datarea
mov ds,ax
mov es,ax

;main part of the prognam goes here
cld
lea di,b
mov cx,15
mov si,0
mov bx,0
next:
push di
push cx
mov ax,a[si]
mov cx,20
repnz scasw
je setc
jmp loop1
setc:

mov c1[bx],ax
add bx,2
loop1:
add si,2
pop cx
pop di
loop next

ret
main endp
prognam ends
end start
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐