Итак, вопрос простой. Если у меня есть 2 случайных байта, скажем, 150 (a [0]) и 215 (b [0]), и я хочу их добавить. очевидно, их сумма не поместится в байт, поэтому, если я добавлю их, я получу переполнение. Я попытался сохранить один из байтов в al и выполнить cbw, чтобы у меня было то же количество, представленное только в слове ax, и добавить к нему второй байт, но есть что-то, что я не могу понять, так как это не работает. Вот пример кода:
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