if in Assembly Language

 Take input from user and implement condition:
 If((var > 5 ) && (var < 9))
 {
 Print 1 according to the value of var
 }
 Else
 0



.model small
.stack

.code
mov ah,1h
int 21h

mov bl,al
cmp bl,'5'
jbe below
cmp bl,'9'
jae below
;print 1 according to the value of bl
mov dl,'1'
SUB BL,48
mov cx,bx
mov ah,2h
loop1:
int 21h
loop loop1
JMP EXIT

below:
MOV DL,'0';PRINT 0
MOV AH,2H
INT 21H

EXIT:
mov ah,4ch
int 21h
end

No comments:

Post a Comment