Monday, August 13, 2012

If else condition in Assembly

.MODEL SMALL
.STACK 100H

.DATA
 MSG1 DB 0AH,0DH,'YES$'
 MSG2 DB 0AH,0DH,'NO$'
 
.CODE
MAIN PROC

 MOV AX,@DATA
 MOV DS,AX
 
 MOV AH,1
 INT 21H
 CMP AL,'Y'
 JE YES
 LEA DX,MSG2
 MOV AH,9
 INT 21H
 JMP EXIT
 
 YES:
  LEA DX,MSG1
  MOV AH,9
  INT 21H
  
 EXIT:
  MOV AH,4CH
  INT 21H
 
 MAIN ENDP
END MAIN

No comments:

Post a Comment