运行不了啊,求助求助
data segment
N DB 7 DUP(0)
MAX DB 0
MIN DB 10
M1 DB 0dh,0ah,'Input: $'
M2 DB 0DH,0AH, 'The final score is: $'
data ends
code segmentassume cs:code, ds:data
main proc far
begin:
push ds
mov ax,0
push ax
MOV AX,DATAMOV DS,AX
mov ah,9
mov dx,offset m1
int 21h
MOV BX,OFFSET N
MOV CX,7 ;输入7个数
NEXT:
MOV AH,7
INT 21H
CMP AL,'0'
JB NEXT
CMP AL,'9'
JA NEXT
CMP AL,'1'
JE BE_1
MOV DL,AL
MOV AH,2
INT 21H
SUB AL,30H
MOV [BX],AL
CALL MAX_MIN
JMP L1
BE_1: ;判断是1还是10
MOV AH,2
MOV DL,'1'
INT 21H
MOV AH,7
INT 21H
CMP AL,'0'
JE BE10
MOV AL,1
MOV [BX],AL
CALL MAX_MIN
JMP L1
BE10:
MOV AH,2
MOV DL,'0'
INT 21H
MOV AL,10
MOV [BX],AL
CALL MAX_MIN
L1:
INC BX
MOV AH,2 ;两数之间加一个空格显示
MOV DL,' '
INT 21H
LOOP NEXT
MOV AH,09
MOV DX,OFFSET M2
INT 21H
MOV CX,7
MOV AX,0
MOV BX,OFFSET N
SUM:
ADD AL,[BX]
INC BX
LOOP SUM ;求总和
SUB AL,MAX
SUB AL,MIN
MOV BL,5
DIV BL
CMP AL,10
JE ALL10 ;全为满分
PUSH AX ;处理小数
ADD AL,30H
MOV DL,AL
MOV AH,2
INT 21H
MOV AH,2
MOV DL,'.'
INT 21H
POP AX
MOV AL,AH
MOV BL,10
MUL BL
MOV BL,5
DIV BL
ADD AL,30H
MOV DL,AL
MOV AH,2
INT 21H
JMP R_MAIN
ALL10:
MOV AH,2
MOV DL,'1'
INT 21H
MOV DL,'0'
INT 21H
R_MAIN:
ret
main endp
;================
MAX_MIN PROC NEAR ;输入数据的同时找出最大和最小值
CMP AL,MAX
JB P1
MOV MAX,AL
P1:
CMP AL,MIN
JA R
MOV MIN,AL
R:
RET
MAX_MIN ENDP
;===================
code ends
end begin
data segment
N DB 7 DUP(0)
MAX DB 0
MIN DB 10
M1 DB 0dh,0ah,'Input: $'
M2 DB 0DH,0AH, 'The final score is: $'
data ends
code segmentassume cs:code, ds:data
main proc far
begin:
push ds
mov ax,0
push ax
MOV AX,DATAMOV DS,AX
mov ah,9
mov dx,offset m1
int 21h
MOV BX,OFFSET N
MOV CX,7 ;输入7个数
NEXT:
MOV AH,7
INT 21H
CMP AL,'0'
JB NEXT
CMP AL,'9'
JA NEXT
CMP AL,'1'
JE BE_1
MOV DL,AL
MOV AH,2
INT 21H
SUB AL,30H
MOV [BX],AL
CALL MAX_MIN
JMP L1
BE_1: ;判断是1还是10
MOV AH,2
MOV DL,'1'
INT 21H
MOV AH,7
INT 21H
CMP AL,'0'
JE BE10
MOV AL,1
MOV [BX],AL
CALL MAX_MIN
JMP L1
BE10:
MOV AH,2
MOV DL,'0'
INT 21H
MOV AL,10
MOV [BX],AL
CALL MAX_MIN
L1:
INC BX
MOV AH,2 ;两数之间加一个空格显示
MOV DL,' '
INT 21H
LOOP NEXT
MOV AH,09
MOV DX,OFFSET M2
INT 21H
MOV CX,7
MOV AX,0
MOV BX,OFFSET N
SUM:
ADD AL,[BX]
INC BX
LOOP SUM ;求总和
SUB AL,MAX
SUB AL,MIN
MOV BL,5
DIV BL
CMP AL,10
JE ALL10 ;全为满分
PUSH AX ;处理小数
ADD AL,30H
MOV DL,AL
MOV AH,2
INT 21H
MOV AH,2
MOV DL,'.'
INT 21H
POP AX
MOV AL,AH
MOV BL,10
MUL BL
MOV BL,5
DIV BL
ADD AL,30H
MOV DL,AL
MOV AH,2
INT 21H
JMP R_MAIN
ALL10:
MOV AH,2
MOV DL,'1'
INT 21H
MOV DL,'0'
INT 21H
R_MAIN:
ret
main endp
;================
MAX_MIN PROC NEAR ;输入数据的同时找出最大和最小值
CMP AL,MAX
JB P1
MOV MAX,AL
P1:
CMP AL,MIN
JA R
MOV MIN,AL
R:
RET
MAX_MIN ENDP
;===================
code ends
end begin