如何用两个16位寄存器组成20位地址?
IAPX88可以处理1兆字节内存(20位寻址),现在我的问题是我们如何使用两个16位寄存器来制作20位地址。请举个例子。
IAPX88 can deal with 1 mega byte memory(20 bit addressing), now my question is how we make a 20 bit address by using two 16 bit registers.please give an example.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
IAPX88 物理地址是通过获取段寄存器、将其左移 4 位并添加偏移寄存器来计算的。
例如,代码执行的内存中的物理地址是
(CS<<4)+IP
,其中CS是代码段,IP是指令指针。您可以在Intel 8086 维基百科页面上获取详细信息。
IAPX88 physical addresses are computed by taking the segment register, shifting it to the left 4 bits, and adding the offset register.
For example, the physical address in memory that code executes is
(CS<<4)+IP
where CS is the Code Segment and IP is the Instruction Pointer.You can get details on the Intel 8086 wikipedia page.
我们可以使用移位加法来做到这一点。我们处理 2 个地址:逻辑地址表示为两个 16 位地址,物理地址是实际的 20 位地址。
请记住,由于我们处理的是十六进制,因此每个数字代表 4 位。
例如,我们想要使用两个 16 位地址来表示地址:
7 2 3 A 5
,我们可以使用两个地址:7 2 3 A
和0 0 0 5。
首先,我们将第一个地址左移四位:
7 2 3 A 0
,称为基址。然后,我们添加第二个地址:
0 0 0 5
,称为偏移。此操作的结果是一个新的 20 位地址:
7 2 3 A 5
。如果我们的基址是代码段开头的
CS
,偏移量是指令指针IP
,则我们可以将前面的操作描述如下:(CS << 4) + IP
注:我们可以使用许多 16:16 位逻辑地址来描述任何 20 位物理地址,但每 2 个逻辑地址将只有一个物理地址。
We can do this using shifted addition. we deal with 2-addresses: the logical address which is represented as two 16-bit addresses and the physical address which is the actual 20-bit address.
Remember that, since we are dealing with hexadecimals, each number represents 4 bits.
e.g. we want to represent the address:
7 2 3 A 5
using two 16-bit addresses, we can do using the two addresses:7 2 3 A
and0 0 0 5
.First, we shift the first address by four bits to the left:
7 2 3 A 0
which is called the base.Then, we add the the second address:
0 0 0 5
which is called the offset.The result of this operation is a new 20-bit address:
7 2 3 A 5
.If our base is the the
CS
which is the start of the code segment and our offset is the instruction pointerIP
, we can describe the previous operation as follows:(CS << 4) + IP
Note: we can describe any 20-bit physical address using many 16:16-bit logical addresses, but each 2-logical addresses will have only one physical address.