本文介绍了存储器中的变量未由存储更新为该符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我运行emu8086时,此结果返回给我0 ..为什么?
When I run the emu8086, this result(ans) return to me 0 ..Why ?
data segment
ans dw ?
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
mov ax,@data
mov dx,ax
mov ax,2
mov bl,2
mul bl
mov ans,ax
mov ax, 4c00h
int 21h
ends
end start
推荐答案
mov ax,@data
mov dx,ax
这部分代码必须设置DS
段寄存器.
您打错了字,而是写了DX
!
This part of the code must setup the DS
segment register.
You made a typo and wrote DX
instead!
mov ax, @data
mov ds, ax
由于此错误,AL
* BL
乘法(4)的结果仍由mov ans,ax
写入内存中,但未将其写入数据段 .它覆盖了ProgramSegmentPrefix的第一个单词,因为这是DS
所指向的位置.
Because of this error, the result of your AL
* BL
multiplication (4) was still written in memory by mov ans,ax
but it didn't make it to the data segment. It overwrote the first word of the ProgramSegmentPrefix because that was where DS
was pointing at.
这篇关于存储器中的变量未由存储更新为该符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!