问题描述
- 用汇编实现统计空格个数 2C
- 用汇编实现输入一串字符串,统计其中空格、数字、大写字母、小写字母的个数。代码调试时没问题,但在DOS界面运行时输出乱码,求各位大神指导,哪里出错
DATA SEGMENT
BUFFER DB 10?10 DUP(?)
COUNT DB 4 DUP(?)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODEDS:DATA
START: MOV AXDATA
MOV DSAX
MOV AH10
INT 21H
LEA BXBUFFER+1
MOV CL[BX]
MOV CH0
ONE: ADD BX1
MOV AL[BX]
CMP AL20H
JNE L2
L1: INC COUNT[0]
JMP TWO
L2: CMP AL39H
JA L3
INC COUNT[1]
JMP TWO
L3: CMP AL5AH
JA L4
INC COUNT[2]
JMP TWO
L4: INC COUNT[3]
TWO: LOOP ONE
THREE: MOV CX4
MOV SI0
MOV AH02H
EXIT: MOV DL0DH
INT 21H
MOV DL0AH
INT 21H
MOV DLCOUNT[SI]
ADD DL30H
INT 21H
INC SI
LOOP EXIT
MOV AX4C00H
INT 21H
CODE ENDS
END START