我的程序错在哪里? 高手教我
;该程序的功能是从键盘输入一系列字符(以回车符结束),并按字母、数;字及其他字符分类计数,最后显示出这三类的计数结果。
datarea segment
count dw 0,0,0 ;分别存放字母、字母和其他字符的个数
datarea ends
code segment
main proc far
assume cs:code,ds:datarea
start:push ds
sub ax,ax
push ax
mov ax,datarea
mov dx,ax
next: mov ah,01 ;判断是否为字母
int 21h
cmp al,0dh
jz exit
cmp al,5ah
jg other
cmp al,41h
jl shuzi
add count[0],1
shuzi:cmp al,39h ;判断是否为数字
jg other
cmp al,31h
jl other
add count[1],1
other:add count[2],1 ;其他字符的个数加1
jmp next
mov si,0
exit: mov bx,count[si] ;打印输出count的内容,为16进制
mov ch,4
rotate: mov cl,4
rol bx,cl
mov al,bl
and al,0fh
add al,30h
cmp al,3ah
jl printit
add al,7h
printit: mov dl,al
mov ah,2
int 21h
dec ch
jnz rotate
add si,1
cmp si,2
jnz exit
ret
main endp
code ends
end start
编译连接运行 都没有错误
可是结果不对 没有达到题目的要求 到底是哪里出错?
好心的高手帮我看看 3Q!!!