试编制一个汇编语言程序,求出首地址为DATA的10个无符号字数组中的最小偶数,把它存放在AX中。(注意:无符号数)
Data word 0141H, 0AE00H,07B4H, 0A508H, 0691H,
Word 0870H, 7542H, 0081H, 0916H, 0017H
DSEG SEGMENT
Data dw 0141H,0AE00H,07B4H,0A508H,0691H,0870H,7542H,0081H,0916H,0017H
DSEG ENDS
CSEG SEGMENT
ASSUME CS: CSEG, DS: DSEG
star:mov cx,10
mov bx,offset Data
and [bx],01h
jz next
inc bx
dec cx
cmp cx,0
jz done
jmp star
next:mov ax,[bx]
inc bx
and [bx],01h
jz aaaa
dec cx
cmp cx,0
jz done
aaaa:cmp ax,[bx]
ja bbbb
jmp next
bbbb:mov ax,[bx]
jmp next
done:RET
int 21h
CSEG ENDS
END star
要怎么改
------解决方案--------------------------------------------------------
star:mov cx,10
mov bx,offset Data
ccc:
cmp cx,0
jz done
TEST WORD PTR [BX], 1
jz next
inc bx
dec cx
jmp ccc
next:mov ax,[bx]
dddd:
cmp cx,0
jz done
dec cx
inc bx
TEST WORD PTR [BX], 1
jz aaaa
JMP dddd
aaaa:cmp ax,[bx]
ja bbbb
jmp dddd
bbbb:mov ax,[bx]
jmp dddd
done:RET
int 21h