int 21h code ends end start
从键盘输入一系列字符(以回车符结束),并按字母、数字及其它字符分类计数,最后显示出这三类的计数结果。
参考程序: data segment
s db ? ;统计字符 d db ? ;统计数字 o db ? ;统计其它字符code segment assume cs:code,ds:data start: mov ax,data mov ds,ax lop: mov ah,1 int 21h cmp al,0dh jz disp cmp al,30h jb other cmp al,39h
16 / 18
cmp al,41h jb other cmp al,5ah jbe str cmp al,61h jb other cmp al,7ah jbe str jmp lop other:inc o jmp lop shu: inc d jmp lop str: inc s jmp lop disp: mov dl,0ah mov ah,2 int 21h mov dl,0dh mov ah,2
17 / 18
int 21h mov dl,s or dl,30h mov ah,2 int 21h mov dl,d or dl,30h int 21h mov dl,o or dl,30h int 21h mov ah,4ch int 21h code ends end start
18 / 18
相关推荐: