本文介绍了8086-为什么我们不能移动即时数据到段寄存器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在8086汇编编程,我们只能在数据加载到一个段章,第一次加载到通用寄存器,然后我们从这个根章的段寄存器的举动。

in 8086 assembly programming, we can only load a data into a segment reg by, first loading it into a general purpose register and then we have move from this gen reg to the segment register.

我们为什么不能直接加载呢?有没有什么特别的理由不来允许这种?

why can we load it directly?is there any special reason for not to allowing this?

和是什么 MOV AX,5000H MOV AX,[5000H] 确实<$ C的区别$ C> [5000H] 意味着memmory位置5000H conent?

And what is the difference in mov ax,5000h and mov ax,[5000h] does [5000h] means conent in memmory location 5000h?

推荐答案

请记住,汇编语言(任何组件)的语法只是写机code人类可读的方式。你可以在机器code做什么的规则取决于处理器的电子产品是如何设计的,而不是什么汇编语法,可以很容易地支持。

Remember that the syntax of assembly language (any assembly) is just a human-readable way to write machine code. The rules of what you can do in machine code depend on how the processor's electronics were designed, not on what the assembler syntax could easily support.

所以,仅仅因为它看起来像你可以写 MOV DS,[5000H] ,并在概念上它似乎并不像有一个原因,你不应该能够做到这一点,它的的确确是有没有通过该处理器可以从一个内存位置的内容加载段寄存器的机制?

So, just because it looks like you could write mov DS, [5000h] and that conceptually it doesn't seem like there is a reason why you shouldn't be able to do it, it's really about "is there a mechanism by which the processor can load a segment register from a memory location's content?"

在8086组件的情况下,我想,其原因很简单,就是工程师只是没有创造一个电动的路径,可以从存储I / O数据线养活一个信号,即写段寄存器中的线

In the case of 8086 assembly, I figure that the reason is simply that the engineers just didn't create an electric path that could feed a signal from the memory I/O data lines to the lines that write to the segment registers.

为什么呢?我有几种说法,但没有权威的知识。

Why? I have several theories, but no authoritative knowledge.

最有可能的原因很简单,简化了设计中的一个:它需要额外的布线和门要做到这一点,这是一种罕见的足够的操作(这是70的),它不值得在芯片中的房地产。这并不奇怪; 8086已经去舷外允许任何正常寄存器被连接到ALU(算术逻辑单元),它允许任何寄存器被用作累加器。我敢肯定,这是不便宜的事情。当时大多数处理器只允许一个寄存器(​​的累加器)用于这一目的。

The most likely reason is simply one of simplifying the design: it takes extra wiring and gates to do that, and it's an uncommon enough operation (this is the 70's) that it's not worth the real estate in the chip. This is not surprising; the 8086 already went overboard allowing any of the normal registers to be connected to the ALU (arithmetic logic unit) which allows any register to be used as an accumulator. I'm sure that wasn't cheap to do. Most processors at the time only allowed one register (the accumulator) to be used for that purpose.

这也可能是允许的段寄存器写入读取内存导致的几个奇怪的边缘案件是很难得到正确的电路。毕竟,段寄存器写入可能被用于寻址源操作数。

It's also possible that allowing a segment register to be written from a memory read resulted in several weird edge cases that were hard to get right in the circuitry. After all, the segment register to be written might be used to address the source operand.

至于括号,则是正确的。比方说,内存位置5000H包含数4321h。 MOV AX,5000H 会将值5000H到斧头,而 MOV AX,[5000H] 意味着把4321h到斧头。从本质上讲,括号像在 * 指针运算符℃。

As far as the brackets, you are correct. Let's say memory position 5000h contains the number 4321h. mov ax, 5000h puts the value 5000h into ax, while mov ax, [5000h] means putting 4321h into ax. Essentially, the brackets act like the * pointer operator in C.

只是要强调的是,集是什么机器code可以做一个理想化的抽象,你要注意,这两个变化并不用不同的参数相同的指令,但完全不同的运算codeS。他们可以使用 - 说 - MOV 第一和 MVD (移动直接寻址的内存)为第二个运算code,但他们必须决定该括号语法更容易为程序员记住。

Just to highlight the fact that assembly is an idealized abstraction of what machine code can do, you should note that the two variations are not the same instruction with different parameters, but completely different opcodes. They could have used - say - MOV for the first and MVD (MoVe Direct addressed memory) for the second opcode, but they must have decided that the bracket syntax was easier for programmers to remember.

这篇关于8086-为什么我们不能移动即时数据到段寄存器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 17:13