DATA SEGMENT
A DB 1,2,3,4,5,6,7,9,8
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LEA BX,A
MOV AX,0000
MOV CL,09
L1:CMP AL,BYTE PTR[BX]
JNC L2
MOV AL,BYTE PTR[BX]
L2:INC BX
DEC CL
CMP CL,00
JNZ L1
MOV DL,AL
LEA BX,A
MOV AX,0000
MOV CL,09
L3:CMP BYTE PTR[BX],DL
JZ L4
CMP AL,BYTE PTR[BX]
JNC L4
MOV AL,BYTE PTR[BX]
L4:INC BX
DEC CL
CMP CL,00
JNZ L3
MOV AH,4CH
INT 21H
CODE ENDS
END START
;OUTPUT:->
;-g cs:0037
;
;AX=0008 BX=0009 CX=0000 DX=0009 SP=0000 BP=0000 SI=0000 DI=000
;DS=0BAC ES=0B9C SS=0BAC CS=0BAD IP=0037 NV UP EI PL ZR NA PE NC
;0BAD:0037 B44C MOV AH,4C