Assembly 为什么 data 是 076C
2023-02-21 本文已影响0人
Rinaloving
为什么 data 是 076CH
1. 代码段
assume cs:codecs,ds:datasg
datasg segment
dw 013aH
datasg ends
codecs segment
mov ax, datasg
mov bx, 0
mov ds, ax
;mov bx,[0]
mov bx,[bx]
;mov bx, 0006H
add ax, bx
codecs ends
end
2. 说明
-
为什么不是 DS 中的 075CH
QQ截图20230222114651.png -
《汇编语言》(王爽),92页有说明
QQ截图20230222140718.png
QQ截图20230222140801.png - 这就是 ds 为什么是 076CH(10H)的原因
mov bx, [0] 与 mov bx, [bx] 为什么不一样
- mov bx, [0] 指向的是 0000H, mov bx, [bx] 指向的是 013aH (我们预设的值,bx 被我们提前设置为了 0)
-
书中的解释
QQ截图20230222141436.png -
写成 mov bx, [bx] , 我们就能拿到 ds:0000 处的值 013aH,并送入BX 寄存器中(如下图)
QQ截图20230222143319.png -
写成 mov bx, [0],可以看出,被当作值了,不理解呢。
QQ截图20230222145736.png -
mov bx, ds:[0],换成这种写法,这下就对了,所以一定要注意
QQ截图20230222150058.png
-