好的,所以问题很简单。如果我有 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