START: LEA SI,DATA
MOV CX,200
CLD
LODSW
MOV MAX, AX
MOV MIN,AX
DEC CX
NEXT: LODSW
CMP AX,MAX
JG LARGER
CMP AX,MIN
JL SMALL
JMP GOON
LARGER: MOV MAX, AX
JMP GOON
SMALL: MOV MIN, AX
GOON: LOOP NEXT
HLT
START: LEA SI,DATA
MOV CX,200
CLD
LODSW
MOV MAX, AX
MOV MIN,AX
DEC CX
NEXT: LODSW
CMP AX,MAX
JG LARGER
CMP AX,MIN
JL SMALL
JMP GOON
LARGER: MOV MAX, AX
JMP GOON
SMALL: MOV MIN, AX
GOON: LOOP NEXT
HLT
START: LEA SI,DATA ;从DATA开始
MOV CX,200 ;总共200个
CLD ;设置SI自动增加
LODSW ;等价于MOV AX,WORD PTR [SI], INC SI, INC SI
MOV MAX,AX ;将DATA[0]赋值给MAX
MOV MIN,AX ;将DATA[0]赋值给MIN
DEC CX ;CX=CX-1=199
NEXT: LODSW ;等价于MOV AX,WORD PTR [SI], INC SI, INC SI
CMP AX,MAX ;AX和MAX比较
JG LARGER ;AX比MAX大,转LARGER
CMP AX,MIN ;AX和MIN比较
JL SMALL ;AX比MIN小,转SMALL
JMP GOON ;转GOON
LARGER: MOV MAX,AX ;MAX=AX
JMP GOON ;转GOON
SMALL: MOV MIN,AX ;MIN=AX
GOON: LOOP NEXT ;CX=CX-1,CX不是0,转NEXT
HLT ;CX是0,程序停止。MAX中是DATA[200]中的最大值,MIN是DATA[200]中的最小值