找出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
本文介绍了一段使用汇编语言实现的程序,该程序能够找出两个数组中的相同整数,并将这些整数存入第三个数组中。通过使用循环、条件跳转等基本汇编指令,实现了对数组的有效遍历与比较。
6025

被折叠的 条评论
为什么被折叠?



