2017-05-13 16:52:40
.MODEL SMALL
.STACK 100H
.DATA
.CODE
PROMPT_1 DB'ENTER THE NO OF BIN FORM(MAX 16 DIGIT):$'
PROMPT_2 DB'THE GIVEN NO IN ORIGINAL BIT PATTERN:$'
PROMPT_3 DB'THE GIVEN NO IN REVERSE BIT PATTERN:$'
CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
LEA DX,PROMPT_1
MOV AH,9
INT 21H
CALL READ_BIN_NUMBER
CALL NEXT_LINE
LEA DX,PROMPT_2
MOV AH,9
INT 21H
CALL DISPLAY_NIN_NUMBER
CALL NEXT_LINE
LEA DX,PROMPT_3
MOV AH,9
INT 21H
CALL REVERSE_BIT_PATTERN
CALL DISPLAY_NIN_NUMBER
MOV AH,4CH
INT 21H
MAIN ENDP
NEXT_LINE PROC
PUSH AX
PUSH DX
MOV AH,2
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H
POP DX
POP AX
RET
NEXT_LINE ENDP
READ BIN_NUMBER: PROC
MOV CX,16
XOR BX,BX
MOV AX,1
@LOOP_1:
INT 21H
CMP AL,0DH
JE END
AND AL,0FH
SHL BX,1
OR BL,AL
LOOP @LOOP_1
END:
RET
READ BIN_NUMBER ENDP
DISPLAY_BIN_NUMBER PROC
PUSH BX
MOV AH,2
@LOOP_2:
SHL BX,1
JL ONE
MOV DL,30H
JMP DISPLAY
@ONE:
MOV DL,31H
@DISPLAY:
INT 21H
LOOP @LOOP_2
POP BX
RET
DISPLAY_BIN_NUMBER
REVERSE_BIT_PATTERN PROC
PUSH DX
MOV CX,16
MOV DX,BX
@LOOP_3
SHL BX,1
SHR DX,1
JNC @ZERO
OR BX,1
@ZERO:
OR BX,0
LOOP @LOOP_3
POP DX
RET
REVERSE_BIT_PATTERN ENDP
END MAIN
 
 
 
 
 
 
 
 
 
Invalid Email or Password