用汇编语言比较三个位数的大小,如果三个数相等 输出等号,如果三个不同 按从大到小的顺序输出,急用 !!
原先写过一个类似的,你可以参考一下,
题目:1试编写一个汇编语言程序,要求从键盘接收三个16进制数,并根据对三个数的比较显示出如下信息:
(1)如果三个数都不相等则显示ALL NOT EQU;
(2)如果三个数有两个数相等则显示TWO EQU;
(3)如果三个数都相等,则显示ALL EQU。
程序:
data segment
string1 db 16 dup(?)
string2 db 16 dup(?)
string3 db 16 dup(?)
string4 db 'ALL NOT EQU'
string5 db 'TWO EQU'
string6 db 'ALL EQU'
data ends
code segment
main proc far
assume ds:data,cs:code
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov cx,16
mov bx,0
loop1: mov ah,1
int 21h
mov string1[bx],al
inc bx
loop loop1
mov dl,0ah
mov ah,2
int 21h
mov dl,0dh
mov ah,2
int 21h
mov cx,16
mov bx,0
loop2: mov ah,1
int 21h
mov string2[bx],al
inc bx
loop loop2
mov dl,0ah
mov ah,2
int 21h
mov dl,0dh
mov ah,2
int 21h
mov cx,16
mov bx,0
loop3: mov ah,1
int 21h
mov string3[bx],al
inc bx
loop loop3
mov dx,0
mov di,data
mov ds,di
mov es,di
mov cx,16
cld
lea si,string1
lea di,string2
repe cmpsb
jne a
jmp jiajiayi
a: mov cx,16
cld
lea si,string1
lea di,string3
repe cmpsb
jne b
jmp z
b: mov cx,16
cld
lea si,string2
lea di,string3
repe cmpsb
jne shuchu
jmp y
jiajiayi:
inc dx
jmp a
y: add dx,1
jmp shuchu
z: inc dx
jmp shuchu
shuchu: cmp dx,0
je shuchu0
cmp dx,1
je shuchu1
cmp dx,2
je shuchu2
shuchu0:mov dl,0ah
mov ah,2
int 21h
mov dl,0dh
mov ah,2
int 21h
mov cx,11
mov bx,0
loop10: mov dl,string4[bx]
mov ah,2
int 21h
inc bx
loop loop10
jmp exit
shuchu1:mov dl,0ah
mov ah,2
int 21h
mov dl,0dh
mov ah,2
int 21h
mov cx,7
mov bx,0
loop11: mov dl,string5[bx]
mov ah,2
int 21h
inc bx
loop loop11
jmp exit
shuchu2:mov dl,0ah
mov ah,2
int 21h
mov dl,0dh
mov ah,2
int 21h
mov cx,7
mov bx,0
loop12: mov dl,string6[bx]
mov ah,2
int 21h
inc bx
loop loop12
jmp exit
exit: ret
main endp
code ends
end start