求助
大家帮忙看看吧,为什么我统计成绩<60和>100的初值不是零呢???其他的都是啊...输入:人数,学号(6位)041258,成绩(4位)085.5
拜托啦~
;***************************************************************************
data segment
message1 db 'please input the number of the students:',13,10,'$'
message2 db 'number',13,10,'$'
message3 db 'grades',13,10,'$'
message4 db '<60 60+ 70+ 80+ 90+ 100+',13,10,'$'
temp db 0
contr db 0
number db 500 dup(?)
s5 db 0
s6 db 0
s7 db 0
s8 db 0
s9 db 0
s10 db 0
data ends
;****************************************************************************
code segment
;----------------------------------------------------------------------------
main proc far
assume cs:code,ds:data
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
lea dx,message1
mov ah,09h
int 21h
mov ah,01h
int 21h
sub al,30h
mov cx,al
and cx,00ffh
mov temp,cx
xor si,si
input:
mov contr,0
mov ah,09h
lea dx,message2
int 21h
stdnum:
mov ah,01h
int 21h
mov number[si],al
inc si
inc contr
cmp contr,6
jnz stdnum
mov ah,09h
lea dx,message3
int 21h
mov contr,0
stdgrade:
mov ah,01h
int 21h
cmp al,2eh
jz stdgrade
mov number[si],al
inc si
inc contr
cmp contr,4
jnz stdgrade
loop input
mov s5,0
mov s6,0
mov s7,0
mov s8,0
mov s9,0
mov s10,0
lea dx,message4
mov ah,09h
int 21h
xor cx,cx
mov cx,temp
xor si,si
mov si,6
compare:
mov dl,number[si]
cmp dl,'0'
jnz ten
mov dl,number[si+1]
cmp dl,'6'
jl five
cmp dl,'7'
jl six
cmp dl,'8'
jl seven
cmp dl,'9'
jl eight
jmp nine
ten:
add s10,1
jmp short change_addr
nine:
add s9,1
jmp short change_addr
eight:
inc s8
jmp short change_addr
seven:
inc s7
jmp short change_addr
six:
inc s6
jmp short change_addr
five:
inc s5
change_addr:
add si,10
loop compare
add s5,46
mov dl,s5
mov ah,02
int 21h
add s6,30h
mov dl,s6
mov ah,02
int 21h
add s7,30h
mov dl,s7
mov ah,02
int 21h
add s8,30h
mov dl,s8
mov ah,02
int 21h
add s9,30h
mov dl,s9
mov ah,02
int 21h
add s10,30h
mov dl,s10
add dl,30h
sub dl,2eh
mov ah,02
int 21h
ret
main endp
code ends
;------------------------------------------------------------------------------
end start