实在找不出错误的原因,,^_^
程序很简单,,是定义十个分数,从中找出各个阶段的数,,但我返回就会出错
date segment
a db 76,69,84,90,73,88,99,63,100,80
s6 db 0 ;60~69
s7 db 0
s8 db 0
s9 db 0
s10 db 0
crlf db 13,10,'$'
date ends
code segment
main proc far
assume cs:code,ds:date
start:
mov ax,date
mov ds,ax
call sort
mov cx,5
lea si,s6
go_on:
mov dl,ds:[si]
add dl,30h
mov ah,02h
int 21h
lea dx,crlf
mov ah,09h
int 21h
inc si
loop go_on
mov ax,4c00h
int 21h
main endp
sort proc near
mov dx,10
lea si,a
mov cx,10
next:
cmp byte ptr [si],69
jbe add_s6
cmp byte ptr [si],79
jbe add_s7
cmp byte ptr [si],89
jbe add_s8
cmp byte ptr [si],99
jbe add_s9
jmp add_s10
add_s6:
inc s6
dec dx
cmp dx,0
jb exit
inc si
jmp next
add_s7:
inc s7
dec dx
cmp dx,0
jb exit
inc si
jmp next
add_s8:
inc s8
dec dx
cmp dx,0
jb exit
inc si
jmp next
add_s9:
inc s9
dec dx
cmp dx,0
jb exit
inc si
jmp next
add_s10:
inc s10
dec dx
cmp dx,0
jb exit
inc si
jmp next
exit:
ret
sort endp
code ends
end start