题目描述:从键盘输入一系列以$为结束符的字符串,然后对其中的非数字字符字数统计,并显示结果。
分析:循环输入,遇到$符号结束,每输入一个字符判断是否为非数字字符。
代码:
code segment assume cs:code start: mov cx,0 mov ax,0 input: mov ah,01h int 21h cmp al, 24H ;$字符的ASCII码 jz next cmp al,30H jb L1 cmp al,39H ja L1 jmp input L1: inc cx jmp input next: mov dl,0dh mov ah,02h int 21h mov dl,0ah mov ah,02h int 21h mov dx,cx add dx,30h mov ah,02h int 21h mov ax,4C00H int 21h code ends end start