想出来了
;定义三个字数组a,b,c ,比较a[i]与b[i]的大小,;若<则使c[i]置0,若>则使c[i]置1, 若=则使c[i]置2
DATAS SEGMENT
a dw 1,4,4,6
b dw 2,3,5,6
m dw 4 dup(?)
;此处输入数据段代码
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
mov es,ax
lea si,m
mov bp,si
lea si,a
lea di,b
sub di,si
shr di,1
mov cx,di
mov dx,0
s:
lea si,a
lea di,b
add si,dx
add di,dx
mov ax,word ptr[si]
mov bx,word ptr[di]
cmp ax,bx
jl ok
jg okk
mov si,bp
mov word ptr[si], 2
inc bp
inc bp
inc dx
inc dx
inc di
inc di
loop s
jmp next
ok:
mov si,bp
mov word ptr[si], 0
inc bp
inc bp
inc dx
inc dx
inc di
inc di
loop s
okk:
mov si,bp
mov word ptr[si], 1
inc bp
inc bp
inc dx
inc dx
inc di
inc di
loop s
next:
MOV AH,4CH
INT 21H
CODES ENDS
END START