注释一下这个程序
请大家看看这个程序,然后详细注释一下,在线等...DATAS SEGMENT
array dw 0005,0007h,0089h,0054h,0087h,0045h,0047h,0004h,0032h,0010h;此处输入数据段代码
position dw ?
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
push ds
sub ax,ax
push ax
MOV AX,DATAS
MOV DS,AX
mov cx,10
dec cx
loop1:
mov di,cx
mov bx,0
loop2:
mov ax,array[bx]
cmp ax,array[bx+2]
jle continue
xchg ax,array[bx+2]
mov array[bx],ax
continue:
add bx,2
loop loop2
mov cx,di
loop loop1
xor cx,cx
mov cx,10
mov si,0
display:
xor di,di
mov di,cx
xor bx,bx
mov bx,array[si]
mov ch,4
rotate:mov cl,4
rol bx,cl
mov al,bl
and al,0fh
add al,30h
cmp al,3ah
jl print
add al,7h
print:
mov dl,al
mov ah,2
int 21h
dec ch
jnz rotate
;输出空格
call space
add si,2
xor cx,cx
mov cx,di
dec cx
jnz display
call crlf
;接受要查找的数字
xor bx,bx
getnumber:
mov ah,1
int 21h
sub al,30h
jl display1
cmp al,10d
jl add_to
sub al,27h
cmp al,0ah
jl display1
cmp al,10h
jge display1
add_to:
mov cl,4
shl bx,cl
mov ah,0
add bx,ax
jmp getnumber
;显示刚刚输入的数字
display1:
call rotat
call space
xor cx,cx
mov cx,10
mov si,0
search:
cmp bx,array[si]
mov position,si
je found
add si,2
dec cx
jnz search
notfound:
mov al,78
mov dl,al
mov ah,2
int 21h
jmp exit
found:
xor bx,bx
mov bx,position
call rotat
;此处输入代码据段代码
exit:
MOV AH,4CH
INT 21H
;此子程序用来回车和换行
crlf proc near
mov dl,0ah
mov al,2
int 21h
mov dl,0dh
mov ah,2
int 21h
ret
crlf endp
;此子程序用来循环移位显示16位二进制
rotat proc near
mov ch,4
rotate2:
mov cl,4
rol bx,cl
mov al,bl
and al,0fh
add al,30h
cmp al,3ah
jl print2
add al,7h
print2:
mov dl,al
mov ah,2
int 21h
dec ch
jnz rotate2
ret
rotat endp
; 此子程序用来显示空格
space proc near
mov al,32
mov dl,al
mov ah,2
int 21h
ret
space endp
CODES ENDS
END START