24 位地址和 24 位算术与 24 位地址与 16 位地址的地址算术之间的区别?

Difference between 24bit addresses and 24bit arithmetic vs 24 bit address with address arithmetic of 16 bit address?

我在 c167 文档中找到了关于指针算术的注释。 有两个宏_huge和_shuge.

引自 Doku:

_huge or _shuge. Huge data may be anywhere in memory and you can

also reference it using a 24 bit address. However, address arithmetic is

done using the complete address (24 bit). Shuge data may also be

anywhere in memory and you can also reference it using a 24 bit address.

However, address arithmetic is done using a 16 bit address.

那么_huge和_shuge的用法有什么不同呢? 在我的理解中,指针的算法是使用起始地址的偏移量

目前我理解的示例:

&a[0] + 1 where one element of a is int32 &a[0] gives me the address of the first element thi s would be equal to 0x1234211 + 32Bit for example.**

考虑到上面的注释是否有区别,_huge 和 _shuge 有什么区别?

此致

在这个PDF的第17页(标记为第7页)中有倾斜的解释:https://www.tasking.com/support/c166/c166_user_guide_v4.0.pdf

By default all __far pointer arithmetic is 14-bit. This implies that comparison of __far pointers is also done in 14-bit. For __shuge the same is true, but then with 16-bit arithmetic.This saves code significantly, but has the following implications:

• Comparing pointers to different objects is not reliable. It is only reliable when it is known that these objects are located in the same page.

• Comparing with NULL is not reliable. Objects that are located in another page at offset 0x0000 have the low 14 bits (the page offset) zero and will also be evaluated as NULL.

换句话说,_shuge 指针的最低 16 位以上的位将被忽略,除非取消引用它们。您可能还注意到 _shuge 指针具有 16 位对齐,这意味着它们的最低 4 位始终为零,因此在比较或减法时只需要考虑 12 位。

Huge 用于(好?)旧的 8086 系列模式寻址。这些是具有 24 位地址总线的 16 位处理器。完整地址由段(16 位)地址和偏移量(同样为 16 位)给出,公式如下:

linear_address = segment * 16 + offset

2个_huge地址之间的差异是通过首先将两者转换为24位线性地址并减去该值来计算的,而对于_shuge一个地址,段和偏移量分别被减去。

示例 0010:1236 - 0011:1234 如果计算为 _huge0001:0002 则为 0000:0012 (18) _shuge