Code:
; Largest
.MODEL SMALL
.STACK 100H
.DATA
LARGE DB ?
NUM1 DB 06H
NUM2 DB 02H
.CODE
MOV AX , @DATA ; Initializing Data Segment
MOV DS , AX
MOV AL , NUM1 ; Load data to AL
CMP AL , NUM2 ; if num1 > num2 then cf=0 zf=0 sf=0
; if num1 < num2 then cf=1 zf=0 sf=1
; if num1 = num2 then cf=0 zf=1 sf=0
JNC NEXT
MOV BL , NUM2
MOV LARGE , BL
JMP EXIT
NEXT: MOV LARGE , AL
EXIT:
MOV AH , 4CH ;Intrupt for Exit
INT 21H
END
Ouput:
; Largest
.MODEL SMALL
.STACK 100H
.DATA
LARGE DB ?
NUM1 DB 06H
NUM2 DB 02H
.CODE
MOV AX , @DATA ; Initializing Data Segment
MOV DS , AX
MOV AL , NUM1 ; Load data to AL
CMP AL , NUM2 ; if num1 > num2 then cf=0 zf=0 sf=0
; if num1 < num2 then cf=1 zf=0 sf=1
; if num1 = num2 then cf=0 zf=1 sf=0
JNC NEXT
MOV BL , NUM2
MOV LARGE , BL
JMP EXIT
NEXT: MOV LARGE , AL
EXIT:
MOV AH , 4CH ;Intrupt for Exit
INT 21H
END