DATAS SEGMENT
ORG 3000H
DATA DB 23H,22H,43H,4H,90H,22H,1H,0EAH
MAX DB 0
MIN DB 0
DATAS ENDS
STACKS SEGMENT
DB 100 DUP(0)
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
MOV SI,OFFSET DATA
MOV CX,OFFSET MAX
SUB CX,OFFSET DATA
MOV BL,[SI];MAX
MOV BH,BL;MIN
DEC CX
K: INC SI
MOV AL,[SI]
CMP AL,BL;BL最大值
JL AG
MOV BL,AL
AG: CMP AL,BH;BH最小值
JG N
MOV BH,AL
N: LOOP K
MOV [MAX],BL
MOV [MIN],BH
INT 3
MOV AH,4CH
INT 21H
CODES ENDS
END START