汇编语言编写的输出三个数的最大和最小(原创)
2009-12-28 13:45 java线程例子 阅读(264) 评论(0) 编辑 收藏 举报;AX store the big number
;cx store the small number
datarea segment
x dw 50H
y dw 59H
z dw 51H
a1 db 'the big number:'
b1 db 'the samll number:'
datarea ends
prognam segment
main proc far
assume cs:prognam,ds:datarea
start:
push ds
sub ax,ax
push ax
mov ax,datarea
mov ds,ax
mov bx,0
mov ax,x[bx]
cmp ax,y[bx]
jb above ;x<y
mov cx,y[bx]
a: cmp ax,z[bx] ;x>y
jb above1 ;y<z
jae below
above: mov ax,y[bx]
mov cx,x[bx]
jmp a
above1: mov ax,z[bx]
jmp printit
below: cmp cx,z[bx]
jb printit
mov cx,z[bx]
printit:
mov bx,ax
mov di,cx
mov si,0h
mov cx,15
mov ah,02
l1:
mov dl,a1[si]
int 21h
inc si
loop l1
mov ax,bx
mov dl,al
mov ah,2
int 21h
mov dl,0Dh ;回车
int 21h
mov dl,0Ah ;换行
int 21h
mov si,0h
mov cx,17
mov ah,02
l2:
mov dl,b1[si]
int 21h
inc si
loop l2
mov cx,di
mov dl,cl
mov ah,2
int 21h
ret
main endp
prognam ends
end start