bp 寄存器在基于索引中不起作用

bp register doesn't work in based index

这是我编写的代码,用于以相反的顺序将数据从一个数组移动到另一个数组。

data segment
arr1 db 10h,20h,30h,40h
arr2 db 4 dup(0)
cnt dw 04h
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
lea si,arr1
lea di,arr2
mov cx,cnt
mov bp,cx
mov bx,00h
back:
mov dl,[si][bx]
mov [di+bp-1],dl
dec bp

上面这行代码(bp 寄存器)没有加载我希望使用基于索引寻址的内存。

inc bx
loop back
mov ah,4ch
int 21h
code ends
end start

您可能必须在索引地址前加上 ds:,因为 bp 索引地址的默认段是堆栈段 ss

mov ds:[bp+di-1], dl