8086中通用寄存器之间的区别 [英] differences between general purpose registers in 8086

查看:86
本文介绍了8086中通用寄存器之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在8086中,此结构是正确的:

In 8086 this structure is correct:

mov bh,[bx]

但这是不正确的:

mov bh,[cx]

我不知道为什么.我认为通用寄存器(AX,BX,CX,DX,SP,BP,SI和DI)是可以用于任何目的的寄存器,并且BX用于基地址或CX用于计数器的声明只是一个约定,它们完全没有区别.但是看来我错了.你能解释原因吗?这些寄存器之间的确切区别是什么?(例如,为什么我不能将基地址保存在cx寄存器中?)

I don't know why. I think that the general purpose registers (AX, BX, CX, DX, SP, BP, SI and DI) are registers that we can use for any purpose and the statement that BX is for base address or CX is for counter is just a convention and they don't differ at all. But it seems that I'm wrong. Can you explain the reason? And what is the exact difference between these registers? (For example why can't I save the base address in cx register?)

推荐答案

在8086上,仅以下寻址模式可用:

On the 8086, only the following addressing modes are available:

[bx]       [bx + foo]
[foo]      [bp + foo]
[si]       [si + foo]
[di]       [di + foo]
[bx + si]  [bx + si + foo]
[bx + di]  [bx + di + foo]
[bp + si]  [bp + si + foo]
[bp + di]  [bp + di + foo]

其中 foo 是一些值.请注意,不存在涉及 cx 的寻址模式,因此 [cx] 不是有效的内存操作数.

where foo is some value. Note that no addressing mode involving cx exists, so [cx] is not a valid memory operand.

寄存器ax,cx,dx,bx,sp,bp,si和di称为<通用寄存器>,因为它们可以在所有通用指令中作为操作数进行访问.这与专用寄存器(例如es,cs,ss,ds(段寄存器),ip(指令指针)或标志寄存器)相反,后者只能通过为此目的而专门制作的指令才能访问.

The registers ax, cx, dx, bx, sp, bp, si, and di are called general purpose registers because they are accessible as operands in all general-purpose instructions. This is in contrast to special-purpose registers like es, cs, ss, ds (segment registers), ip (the instruction pointer) or the flags register which are only accessible with special instructions made just for this purpose.

如您所见,并非所有通用寄存器都可用作存储器操作数的索引寄存器.注册代码时必须牢记这一点.

As you see, not all general purpose registers can be used as index registers for memory operands. This has to be kept in mind when registrating your code.

除此限制外,还有一些指令对固定寄存器进行隐式操作.例如,循环指令专门在 cx 上运行,而32位imul专门在 dx:ax 上运行.如果您想有效地使用这些说明,请牢记每个通用寄存器的建议用途.

In addition to this restriction, there are some instructions that implicitly operate on fixed registers. For example, the loop instruction exclusively operates on cx and a 32-bit imul operates exclusively on dx:ax. If you want to make effective use of these instructions, it is useful to keep each general purpose register's suggested purpose in mind.

这篇关于8086中通用寄存器之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆