title: Swapping low hex digit of one number with high hex digit of another, using bitwise operations
body: <p>I'm trying to do something that's supposed to be simple but it's hell on earth.</p>
  <p>I have this data segment:</p>
  <pre><code>    dseg segment
  A DB 12H
  B DB 34H
  
  dseg ends
  </code></pre>
  <p>The thing I need to do is to take the '2' from the '12' and exchange it with the '3' at the '34' meaning that in the end of the program it should be like this:</p>
  <pre><code>A DB 13H
  B DB 24H
  </code></pre>
  <p>I know how to split the digits but I can't figure out how to make the exchange happen.</p>
  <pre><code>START:  MOV AX,DSEG
      MOV DS,AX
      MOV ES,AX
      
      mov ax,0
      mov cx,0
      mov bl,10H
      mov al,A
      div bl
      mov dx,ax
      mov ax,0
      mov al,B
      div bl
      
      endhere:
      mov ah,4ch
      int 21h
  </code></pre>
  <p>Picture of the registers after the above commands:
  <a href="https://i.stack.imgur.com/moovc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/moovc.png" alt="my registers" /></a></p>