dos 调用问题,我想做一键盘输入,屏幕显示的累加器,但是编译总是达不到正确结果
程序如下MLENGTH=128
DSEG SEGMENT
BUFF DB MLENGTH
DB ?
DB MLENGTH DUP(0)
MESS0 DB 'PLEASE INPUT :$'
MESS1 DB 'X=$'
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG
START :MOV AX,DSEG
MOV DS,AX
MOV DX,OFFSET MESS0
CALL DISPMESS
MOV DX,OFFSET BUFF
MOV AH,0AH
INT 21H
CALL NEWLINE
MOV CX,0
MOV CL,BUFF+1
MOV SI,OFFSET BUFF+2
MOV AL,[SI]
SUB AL,30H
MOV AH,0
CALL MULTI
MOV SI,OFFSET BUFF+3
MOV AL,[SI]
SUB AL,30H
MOV AH,0
ADD AX,BX
CALL MULTI
MOV DX,BX
MOV SI,OFFSET BUFF+4
MOV AL,[SI]
MOV AH,0
ADD AX,DX
MOV CX,AX
MOV AX,0
AGAIN:ADD AX,CX
LOOP AGAIN
COK: MOV DX,OFFSET MESS1
CALL DISPMESS
CALL DISPAL
CALL NEWLINE
MOV AX,4C00H
INT 21H
DISPAL PROC NEAR
MOV CX,5
MOV DL,10
DISP1: DIV DL
XCHG AH,AL
ADD AL,30H
PUSH AX
XCHG AH,AL
MOV AH,0
LOOP DISP1
MOV CX,5
DISP2 : POP DX
CALL ECHOCH
LOOP DISP2
RET
DISPAL ENDP
DISPMESS PROC NEAR
MOV AH,9
INT 21H
RET
DISPMESS ENDP
ECHOCH PROC NEAR
MOV AH,2
INT 21H
RET
ECHOCH ENDP
NEWLINE PROC
PUSH AX
PUSH DX
MOV DL,0DH
MOV AH,2
INT 21H
MOV DL,0AH
MOV AH,2
INT 21H
POP DX
POP AX
RET
NEWLINE ENDP
MULTI PROC
PUSH AX
PUSH BX
ADD AX,AX
MOV BX,AX
ADD AX,AX
ADD AX,AX
ADD BX,AX
POP BX
POP AX
RET
MULTI ENDP
CSEG ENDS
END START