Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .MODEL SMALL
- .DATA
- M1 DB 'Type a character :','$'
- M2 DB 0AH,0DH,'The ASCII Code of '
- C1 DB ?,' In Binary is :','$'
- M3 DB 0AH,0DH,'The number of 1 bit is '
- C2 DB ?,'$'
- .CODE
- MAIN PROC
- MOV AX,@DATA ;Initialize DS
- MOV DS,AX
- MOV AH,9
- LEA DX,M1
- INT 21H
- MOV AH,1 ;read the character
- INT 21H
- MOV BL,AL
- MOV C1,AL ;store the character
- MOV AH,9
- LEA DX,M2
- INT 21H
- MOV BH,0
- MOV CX,8
- MOV AH,2
- L1: SHL BL,1 ;display content of BL
- JC L2
- MOV DL,'0'
- INT 21H
- JMP L4
- L2: MOV DL,'1'
- INT 21H
- INC BH
- L4: LOOP L1
- ADD BH,30H ;convert to char.
- MOV C2,BH
- MOV AH,9
- LEA DX,M3
- INT 21H
- MOV AH,4CH
- INT 21H
- MAIN ENDP
- END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement