BUF DB 0,1,2,3,4,5,6,7,8,9
NUM DB 0
RES DB 3 DUP(?)
STR1 DB 'Please Input Number:','$'
STR2 DB 'The Result Is : ','$'
STR3 DB 'Continue … yes or not?','$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
BEGIN:MOV DX,OFFSET STR1
MOV AH,09H
INT 21H
INT 21H
SUB AL,30H
MOV CX,AX
LEA SI,BUF
MOV BL,BYTE PTR[SI]
ADD1:INC SI
ADD BL,[SI]
LOOP ADD1
LEA DX,STR2
MOV AH,09H
INT 21H
JGE NEXT
MOV DL,BL
ADD DL,30H
MOV AH,02H
INT 21H
JMP REPEAT
NEXT:MOV BH,0
MOV AX,BX
MOV BL,10
DIV BL
INC DI
INC NUM
CMP AL,0
JG NEXT
MOV CL,NUM
MOV CH,0 ;CX==NUM
PRINT:MOV DL,[DI]
ADD DL,30H
MOV AH,02H
INT 21H
DEC DI
LOOP PRINT
LEA DX,STR3
MOV AH,09H
INT 21H
MOV AH,0AH
MOV AH,02
INT 21H
CMP DX,'Y'
JZ BEGIN
MOV AH,4CH
INT 21H
CODE ENDS
END START
输出的结果有问题