源程序:
DATA SEGMENT
RESULT DB 4 DUP(?)
DB 0DH,0AH,'$'
DATA ENDS
STACK SEGMENT STACK
DB 100 DUP(?)
STACK ENDS
CODE SEGMENT
ASSUME DS:DATA,SS:STACK,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
MOV CX,100
MOV AX,0
NEXT:
ADD AX,CX
LOOP NEXT
MOV DX,0
MOV BX,10D
DIV BX
ADD DL,30H
MOV RESULT[3],DL
MOV DX,0
DIV BX
ADD DL,30H
MOV RESULT[2],DL
MOV DX,0
DIV BX
ADD DL,30H
MOV RESULT[1],DL
ADD AL,30H
MOV RESULT[0],AL
MOV AH,09H
LEA DX,RESULT
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START
程序经过调试,可以正常运行。
屏幕显示:
5050