title: 8086 how to reverse a byte in a register
body: <p>How can I reverse a register value at byte level?</p>
  
  <pre><code>mov al,12  -----&gt; how can i reverse al value
  to 21
  </code></pre>
  
  <p>Here's what I have tried  :</p>
  
  <pre><code>mov bx,4321      ;i want to make bx 1234
  
  mov cl,04          ;cl for rotation value
  
  xchg bh,bl          ; now bx will 2143  
  
  mov al,bh         ;moving 21 to al
  
  rol al,cl             ; rotate al 4 times  to left now al is 12`
  
  mov bh,al      ; bh is 12 setuped ,time for bl
  
  ;---------------------------
  mov al,bl   ;moving lower byte  43 to al
  
  rol al,cl     ; rotate 4 times to left now al will 34
  
  mov bl,al      ; moving 34 to bl  
  </code></pre>
  
  <p>Now <code>bx</code> must contain a reversed number 1234; the problem was the number is in hex that is 10e1h or 4321.</p>
  
  <p>When I reverse it is 1e01h but this value is not expressing 1234.</p>
  
  <p>1234 is 04d2. The value I am getting is 7681d.</p>