高手请留步!菜鸟提问!
我想编一个统计学生成绩的程序,并且想输出结果,但程序错误,请问是怎么回事?谢谢!下面是程序:(主体来源网络)
DATA SEGMENT
SCORE DB 78,64,29,91,84,67,92,100,54,66
COUNT EQU 10
RESULT DB 6 DUP (?)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
MAIN PROC FAR
PUSH DS
XOR AX,AX
PUSH AX
MOV AX,DATA
MOV DS,AX
START: MOV CX,COUNT
MOV AH,0
MOV BX,0
MOV DX,0
MOV SI,OFFSET SCORE
LOP: MOV AL,[SI]
CMP AL,60
JB FAIL
CMP AL,70
JB CHA
CMP AL,80
JB ZHONG
CMP AL,90
JB LIANG
YOU: INC AH ;
JMP DONE
LIANG: INC BH
JMP DONE
ZHONG: INC BL
JMP DONE
CHA: INC DH
JMP DONE
FAIL: INC DL
DONE: INC SI
LOOP LOP
MOV DI,OFFSET RESULT
MOV [DI],AH
MOV [DI+1],BH
MOV [DI+2],BL
MOV [DI+3],DH
MOV [DI+4],DL
MOV CX,COUNT
MOV DX,0
MOV SI,OFFSET SCORE
LOP1: MOV AL,[SI]
MOV AH,0
ADD DX,AX
INC SI
LOOP LOP1
MOV AX,DX
MOV BL,COUNT
DIV BL
MOV DI,OFFSET RESULT
MOV [DI+5],AL
MOV SI,OFFSET RESULT
MOV CX,6
LOP2:MOV AX,02H
MOV DL,[SI]
INT 21H
INC SI
LOOP LOP
RET
MAIN ENDP
CODE ENDS
END MAIN
[[it] 本帖最后由 向往阳光623 于 2008-4-18 09:22 编辑 [/it]]