8086汇编的求最大值,有个显示的bug,不知道dos下又没有更好的显示方式
assume cs:code
data segment
db 1,5,7,4,0,3
data ends
code segment
start:
mov ax,data
mov ds,ax
mov cx,5
mov bp,1
xor ax,ax
mov al,[0]
s:
mov bl,[bp]
call cmpar
loop s
call print
mov ax,4c00h
int 21h
s1: inc bp
jmp nex
s2: mov al,bl
inc bp
jmp nex
print:
add al,48
mov bx,ax
mov ax,0b800h
mov es,ax
mov al,bl
mov ah,02h
mov es:[140h+10],ax
inc bx
ret
cmpar:
cmp ax,bx
jnb s1
jb s2
nex: ret
code ends
end start