.MODEL SMALL .STACK 100H .DATA MSG1 DB 'ENTER THE NO IN BIN FORM (MAX 8 BIT): $' MSG2 DB 'THE GIVEN NUMBER IN ORIGINAL BIT PATTERN: $' MSG3 DB 'THE GIVEN NUMBER IN REVERSE BIT PATTERN: $' .CODE MAIN PROC MOV AX,@DATA MOV DS,AX LEA DX,MSG1 MOV AH,9 INT 21H CALL READ_BIN_NUMBER CALL NEXT_LINE LEA DX,MSG2 MOVAH,9 INT 21H CALL DISPLAY_BIN_NUMBER CALL NEXT_LINE LEA DX,MSG3 MOV AH,9 INT 21H CALL REVERSE_BIT_PATTERN CALL DISPLAY_BIN_NUMBER MOV AH,4CH INT 21H MAIN ENDP NEXT_LINE PROC PUSH AX PUSH DX ,OV AH,2 MOV DL,0DH INT 21H MOV DL,0AH INT 21H POP DX PO AX RET NEXT_LINE ENDP READ_BIN_NUMBER PROC MOV CX,16 XOR BX,BX MOV AH,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 CX,16 MOV AH,2 @LOOP_2: SHL BX,1 JC @ONE MOV DL,30H JMP @DISPLAY @ONE: MOV DL,31H @DISPLAY: INT 21H LOOP @LOOP_2 POP BX RET DISPLAY_BIN_NUMBER ENDP REVERSE_BIT_PATTERN PROC PUSH DX MOV CX,16 MOV DX,BX XOR BX,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