title: 8086 assembly - how to add 2 bytes whose sum will be larger than a byte
body: <p>Ok so the question is simple. If i have 2 random bytes, say 150 (a[0]) and 215(b[0]) and i want to add them. obviously their sum won't fit in a byte so if i add them i will get an overflow. I've tried storing one of the bytes in al and doing a cbw, so that i would have the same quantity only represented on the word ax, and add the second byte to that, but there's something i'm failing to understand since it doesn't work. Here is a sample code:   </p>
  
  <pre><code>data segment
    a db 150,182,211
    b db 215,214,236
  data ends
  
  code segment
  start:
    mov ax,data
    mov ds,ax
  
    lea si,a          ; these 2 shouldn't be here since i realised eventually that
                      ; i could use
    lea di,b          ; a constant for memory addressing and not necessarily a
                      ; a register
    mov ax,0000
    mov bl,a[0]
    mov al,b[0]
    cbw
    adc bx,ax      ; so this didn't work out well
  
    mov ax,0000
    mov al,a[0] 
    cbw            ; convert one of the bytes into a word
    mov cx,ax      ; and save it in cx
    mov al,b[0]    
    cbw            ; also convert the other byte into the word ax
    add ax,cx      ; add the two words
                   ; and that also failed
  </code></pre>