编程求两个自然数之间的所有自然数的平方和,这里有个源程序,输出为乱码,不知错在哪里,各位帮忙看看>先谢谢为过!!
DATAS SEGMENT
;此处输入数据段代码
INPUT1 DB 0AH,0DH,'PLEASE INPUT THE MIN NUMBER!$'
INPUT2 DB 0AH,0DH,'PLEASE INPUT THE MAX NUMBER!$'
M DB 4
DB ?
DB 4 DUP(0)
N DB 4
DB ?
DB 4 DUP(0)
SUM DW 10 DUP(0)
OSUM DB 100 DUP(?)
DATAS ENDS
STACKS SEGMENT PARA STACK 'STACK'
;此处输入堆栈段代码
STACK DB 100 DUP(?)
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
PUSH DS
XOR AX,AX
PUSH AX
MOV AX,DATAS
MOV DS,AX
PUSH DS
;此处输入代码段代码
LEA DX,INPUT1
MOV AH,09H
INT 21H
LEA DX,M
MOV AH,0AH
INT 21H
LEA DX,INPUT2
MOV AH,09H
INT 21H
LEA DX,N
MOV AH,0AH
INT 21H
MOV CX,N-M+1
MOV AX,0
MOV SUM,0
LEA DI,SUM
CLC
XXX:
CLD
MOV AL,M
MOV BL,M
MUL BL
MOV DX,[DI]
ADC AX,DX
AAA
MOV [DI],AX
INC M
INC DI
DEC CX
JNZ XXX;
;
;MOV SI,0
;MOV DI,0
CLC
MOV CX,SIZE SUM
JMP NEXT
NEXT: ;这个过程想进行ASCII码调整
LEA BX,SUM
LEA DX,OSUM
MOV AX,BX
ADC AX,0
AAA
MOV DX,AX
INC AX
INC BX
DEC CX
JCXZ NEXT
LEA DX,OSUM
MOV AH,09H
INT 21H
MOV AH,4CH
INT 21H
CODES ENDS
END START