Advertisement
alamin54017

ASCII to binary & how many 1 bits in Assembly language

Dec 13th, 2019
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. include "emu8086.inc"
  2. .model small
  3. .stack 100h
  4. .code
  5. main proc
  6.     print "Enter a character: "
  7.     mov ah,1
  8.     int 21h
  9.     mov bl,0h
  10.     printn
  11.     print "Here the ASCII to Binary is: "
  12.     mov cl,0
  13.     top:
  14.     cmp cl,8
  15.     je exit
  16.     Rol al,1
  17.     jnc zero
  18.     jc one
  19.     jmp exit
  20.    
  21.     zero:
  22.     print "0"
  23.     inc cl
  24.     jmp top
  25.    
  26.     one:
  27.     print "1"
  28.     inc cl
  29.     inc bl
  30.     jmp top
  31.    
  32.     exit:
  33.     printn
  34.     print "Here the 1-bits has: "
  35.     add bl,30h
  36.     mov ah,2
  37.     mov dl,bl
  38.     int 21h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement