问题描述
我的下一个code:
mov ax,@data
mov ds,ax
为什么我不能写就这样?
Why I can not write just like this?
mov ds,@data
所有的源:
.MODEL small
.STACK 100h
.DATA
HelloMessage DB 'Hello, world',13,10,'$'
.CODE
.startup
mov ax,@data
mov ds,ax
mov ah,9
mov dx,OFFSET HelloMessage
int 21h
mov ah,4ch
int 21h
END
感谢您!
推荐答案
您不能,因为指令集不包含的指令来做到这一点。这仅仅是在x86的众多特质之一。
You can't, because the instruction set doesn't contain an instruction to do that. It is just one of the many idiosyncrasies of the x86.
这样的限制是汇编语言还算正常。大多数架构包含一些特殊处理(例如处理器状态字)一些寄存器,虽然通常比x86架构要少。
These kind of restrictions are fairly normal for assembly languages. Most architectures contain some registers that are treated specially (for example the processor status word), though usually fewer than the x86 architecture.
不提供所有可能的移动的指令的原因是为了减少指令集的大小,以使一个指令需要更少的内存。总体来说是更有效地做到这一点很少需要在两个步骤中移动。
The reason to not provide an instruction for all possible moves is to reduce the size of the instruction set, so that an instruction takes less memory. Overall it is more efficient to do moves that are rarely needed in two steps.
这篇关于汇编MOV问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!