DATASG SEGMENT
BUFF DB 80 DUP(?)
COUNT DW 0
DATASG ENDS
EXTRASG SEGMENT
KEY DB 'computer'
EXTRASG ENDS
CODESG SEGMENT
MAIN PROC FAR
ASSUME CS:CODESG,DS:DATASG,ES:EXTRASG
START:
PUSH DS
XOR AX,AX
PUSH AX
MOV AX,DATASG
MOV DS,AX
MOV AX,EXTRASG
MOV ES,AX
MOV CX,0
MOV SI,0
INPUT:
MOV AH,1
INT 21H
CMP AL,'$'
JE CNT
MOV BUFF[SI],AL
INC COUNT
ADD SI,1
JMP INPUT
CNT:
CMP COUNT,8
JL EXIT
LEA BX,BUFF
MOV DX,COUNT-7
MOV AX,0
COMP:
CLD
LEA DI,KEY
MOV SI,BX
MOV CX,8
REPE CMPSB
JNZ NEXT
INC AX
NEXT:
INC BX
DEC DX
JNZ COMP
;ADD AL,30H
;MOV DL,AL
;MOV AH,02H
;INT 21H
;JMP EXIT
MOV CX,100D
CALL DEC_DIV
MOV CX,10D
CALL DEC_DIV
MOV CX,1D
CALL DEC_DIV
EXIT: RET
MAIN ENDP
;-------------------------------------------------------------
DEC_DIV PROC NEAR
MOV DX,0
DIV CX
MOV BX,DX
MOV DL,AL
ADD DL,30H
MOV AH,02H
INT 21H
MOV AX,BX
RET
DEC_DIV ENDP
CODESG ENDS
END START
我的这个是字符串统计程序,但是我的结果总是比真实值大一,我实在找不出那里有错误,所以恳请各位高手帮帮忙