汇编程序,求高手帮帮忙修改下
主要实现功能:(1) 有9名评委,每个评委给分范围为0~10(整数):由键盘输入;
(2) 9名评委给分中,去掉一个最高分和一个最低分,剩余7名评委的平均分即为参赛者的得分(精确到小数点后二位,不考虑四舍五入);
(3) 将最后得分在光标位置处显示出来。
好像有问题,不知道怎么修改,高手们支支招啊,急啊。
DATA SEGMENT
MARK DB 7 DUP (?)
MAX DB 0
MIN DB 10
MAXN DB ?
MINN DB ?
SUM DB ?
H DB ?
L DB ?
STR1 DB 'Please input grade ','$'
STR2 DB 0DH,0AH,'$'
STR3 DB '(0~10)','$'
STR4 DB 'Wrong number','$'
STR5 DB 'Fanal grade','$'
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV CL,0H
ROL1: CALL INPUT ;调用input
CMP CL,7H ;循环7次输入
JL ROL1
CALL DIVV ;求平均
CALL OUTPUT ;输出结果
MOV AH,01H ;暂定屏幕
INT 21H
MOV AX,4C00H
INT 21H
OUTPUT PROC NEAR ;结果输出函数output
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV DX,0C23H
MOV AH,2
INT 10H
MOV AH,9H
LEA DX,STR5
INT 21H
MOV DX,0D27H
MOV AH,2
INT 10H
CMP L,0AH
JZ NEXT4
ADD L,30H
MOV AL,L
MOV BL,4H
MOV CX,1
MOV AH,9
INT 10H
JMP NEXT5
NEXT4: MOV DX,0D26H
MOV AH,2
INT 10H
MOV AL,31H
MOV BL,4H
MOV CX,1
MOV AH,9
INT 10H
MOV AL,30H
MOV BL,4H
MOV CX,1
MOV AH,9
INT 10H
NEXT5: MOV DX,0D28H
MOV AH,2
INT 10H
MOV AL,'.'
MOV BL,4H
MOV CX,1
MOV AH,9
INT 10H
MOV DX,0D29H
MOV AH,2
INT 10H
ADD H,30H
MOV AL,H
MOV BL,4H
MOV CX,1
MOV AH,9
INT 10H
POP DX
POP CX
POP BX
POP AX
RET
OUTPUT ENDP
DIVV PROC NEAR ;求平均函数DIVV
PUSH AX
PUSH BX
PUSH CX
PUSH DX
CALL ADDD ;调用求和函数
MOV AL,SUM
CBW
MOV CL,5
DIV CL
MOV L,AL
SHL AH,1
MOV H,AH
POP DX
POP CX
POP BX
POP AX
RET
DIVV ENDP
ADDD PROC NEAR ;求和函数ADDD
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV SUM,0
MOV CX,0
MOV AH,0
ROL5: CMP AH,5
JZ EXIT4
CMP CL,7
JZ EXIT3
INC CL
CMP CL,MAXN
JZ ROL5
CMP CL,MINN
JZ ROL5
MOV SI,CX
DEC SI
MOV AL,MARK[SI]
ADD SUM,AL
INC AH
JMP ROL5
EXIT4: MOV MINN,7
EXIT3: POP DX
POP CX
POP BX
POP AX
RET
ADDD ENDP
INPUT PROC NEAR ;input函数
PUSH AX
PUSH BX
PUSH DX
INC CL ;cl自加1,计数一次
CALL OUTPUT1 ;调用output1输出提示信息
ROL4: CALL INPUT1
CMP BX,0AH
JBE NEXT1
MOV AH,9H
LEA DX,STR4
INT 21H
CALL OUTPUT2
JMP ROL4
NEXT1: CALL OUTPUT2 ;换行output2
CMP BL,MAX
JL NEXT2
MOV MAX,BL
MOV MAXN,CL
NEXT2: CMP BL,MIN
JG NEXT3
MOV MIN,BL
MOV MINN,CL
NEXT3: MOV CH,0H
MOV SI,CX
DEC SI
MOV MARK[SI],BL ;将输入存入数据区
POP DX
POP BX
POP AX
RET
INPUT ENDP
INPUT1 PROC NEAR ;将十进制输入转化为实际数值
PUSH AX
PUSH CX
PUSH DX
ROL3: MOV BX,0
ROL2: MOV AH,1
INT 21H
CMP AL,0DH
JZ EXIT2
SUB AL,30H
JL EXIT1
CMP AL,9
JG EXIT1
XCHG AL,BL
MOV CL,10
MUL CL
ADD BL,AL
JMP ROL2
EXIT1: MOV AH,9H
LEA DX,STR4
INT 21H
CALL OUTPUT2
JMP ROL3
EXIT2: POP DX
POP CX
POP AX
RET
INPUT1 ENDP
OUTPUT1 PROC NEAR ;output1函数
PUSH AX
PUSH BX
PUSH DX
MOV AH,9H
LEA DX,STR1
INT 21H
MOV DL,CL
ADD DL,30H
MOV AH,02H
INT 21H
MOV AH,9H
LEA DX,STR3
INT 21H
CALL OUTPUT2
POP DX
POP BX
POP AX
RET
OUTPUT1 ENDP
OUTPUT2 PROC NEAR ;output2函数,回车换行
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV AH,9H
LEA DX,STR2
INT 21H
POP DX
POP CX
POP BX
POP AX
RET
OUTPUT2 ENDP
CODE ENDS
END START