Mzsmunna
10/16/2019 - 9:04 AM

INPUT


.MODEL SMALL
.STACK 100H
.DATA
     I DB ' INPUT: $'
     N DB 'ENTER THE NO OF BIT: $' 
     O DB ' OUTPUT: $' 
    
     VAR DB 30H
     VAR3 DB 30H  
     VAR1 DB 00000000B 
     VAR2 DB ' '
     
.CODE

MAIN PROC
     
    MOV AX,@DATA
    MOV DS,AX
    
   MOV BL,VAR1     
INPUT:
    JMP INPUT2
INPUT2:
    ADD VAR3,1H    
    MOV AH,1
    INT 21H    
    AND AL,0FH    
    OR BL,AL
    SHL BL,1
    
    CMP VAR,39H
    JE INPUT3
    
    JMP INPUT
    
INPUT3:

       
     
CMP1:
    ADD VAR,1H
    CMP VAR,DL 
     
    MOV AH,1
    INT 21H
    
     
    
    
       
   MOV BL,VAR1
   JMP L_CMP 
    
   ; MOV CL,0
    
L_CMP: 
   
    ADD VAR,1H
    CMP VAR,DL
    JGE EXIT
        
    SHL BL,1
    JC ONE
    JNC ZERO
    
ONE:
 
MOV AH,2
MOV DX,'1'
INT 21H 
JMP L_CMP

ZERO:
MOV AH,2
MOV DX,'O'
INT 21H
JMP L_CMP

EXIT:
     
    MOV AH,4CH
    INT 21H
    
    MAIN ENDP

END MAIN