title: Assembly : Convert 8 bit binary number to hexadecimal number
body: <p>I need to write assembly program on tasm that needs to take for input: an 8 bit binary number and the output should be : hexadecimal representation of the same number.
  example:
  10010110 ->96
  10110100 ->B4
  Since i am very new in assembly,i don't have any idea from where i can start with solving that kind of problem.</p>
  
  <p>edit : 
  Here is my basic idea of how the program should be structured: </p>
  
  <pre><code>.MODEL SMALL
  
  .STACK 100H
  
  .DATA
    PROMPT_1  DB  'Enter the binary number : $'
    PROMPT_2  DB  0DH,0AH,'The number of 1 bits is : $'
    HEX_MAp   DB  '1,2,3,4,5,6,7,8,9,A,B,C,D,E,F' 
    HEXA     DB      ?
  .CODE
  MAIN PROC
   MOV AX, @DATA                ; initialize DS  
   MOV DS, AX
  
   LEA DX, PROMPT_1             ; load and display PROMPT_1   
   MOV AH, 9
   INT 21H
  
   XOR BX, BX                   ; clear BX 
   MOV CX, 16                   ; initialize loop counter
   MOV AH, 1                    ; set input function
  </code></pre>
  
  <p>/
  Ok,so after we load the <code>PROMT_1</code> variable which contains our binary number we need to separate it in 2 nibbles
  (lets assume that our input is always correct 8 bit input)
  i've found some guidence with google which states:</p>
  
  <p>Imagine that you already have a binary number stored in register <code>ah</code> for exapmple 10101100 </p>
  
  <pre><code>mov al, ah 
  shr al, 4 
  </code></pre>
  
  <p>so we have in <code>al</code> 00001010 
  this is the first digit in hex form, if it's less thatn 10 you just output it in dec form, otherwise output the character (A, B, C, D, E, F) </p>
  
  <p>next do the same with other 4 digits </p>
  
  <pre><code>mov al, ah 
  shl al, 4 
  shr al, 4 
  </code></pre>
  
  <p>so we have in <code>al</code> 00001100 
  and output the result</p>
  
  <p>/</p>
  
  <pre><code>MOV AH, 4CH                  ; return control to DOS
  INT 21H
  MAIN ENDP
  END MAIN
  </code></pre>
  
  <p>I need some guidance for the correct implementation here(i'm really not in the assembly syntax just yet,also the logic of the language is very untypical for me)</p>