汇编的问题(请给个完整程序)

来源:百度知道 编辑:UC知道 时间:2024/05/05 17:27:36
从键盘输入并回显若干字符(不超过100个)。将这些字符按照ASCII码由小到大顺序显示;统计其中数字字符、字母字符及其它字符的个数,并作如下显示:
DIGIT: <数字字符个数>
LETER:<字母字符个数>
OTHER:<其它字符个数>
有流程图更好!谢谢

键盘输入字符串,以回车结束
data segment
string1 db 'please input the string,press enter for end.$'
buffer db 100,?,100 dup (?)
string2 db 'the number of the digity is:$'
string3 db 'the number of the char is:$'
string4 db 'the number of the others is:$'
string5 db 'the sorted string is:$'
digity db 0
char db 0
other db 0
data ends

code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax

mov ah,09h
lea dx,string1
int 21h
call crlf

lea dx,buffer
mov ah,0ah
int 21h
call crlf

lea bx,buffer
mov cl,[bx+1]
mov ch,0
push cx
dec cx
loop1: mov di,cx
mov bx,offset buffer+2
loop2: mov al,[bx]
cmp al,[bx+1]
jbe continue
xchg al,[bx+1]
mov [bx],al
continue: add bx,1
loop loop2
mov cx,di
loop loop1
pop cx