代码实现
STACK1 SEGMENT STACK
DW 256 DUP(?)
STACK1 ENDS
DATA SEGMENT
NUM DB 05H,07H,5CH,03H,08H
MAX DB ?
MIN DB ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:MOV AX,DATA
MOV DS,AX
MOV CX,0004H
MOV SI,OFFSET NUM
MOV BH,[SI]
MOV BL,[SI]
INC SI
A1:MOV AL,[SI]
INC SI
CMP BH,AL
JAE A2
MOV BH,AL
A2:CMP BL,AL
JBE A3
MOV BL,AL
A3:LOOP A1
MOV SI,OFFSET MAX
MOV [SI],BH
MOV [SI+1],BL
CALL SHOW
INC SI
CALL SHOW
MOV AX,4C00H
INT 21H
SHOW PROC NEAR
MOV AL,DS:[SI]
AND AL,0F0H
MOV CL,4
SHR AL,CL
CMP AL,0AH
JB C2
ADD AL,07H
C2: ADD AL,30H
MOV DL,AL
MOV AH,02H
INT 21H
MOV AL,DS:[SI]
AND AL,0FH
CMP AL,0AH
JB C3
ADD AL,07H
C3: ADD AL,30H
MOV DL,AL
MOV AH,02H
INT 21H
RET
SHOW ENDP
CODE ENDS
END START