In said:
Stone said:
Maybe this is a question,which is about far and near.
I remember that I learn far and near in real mode of X86,but seems
that they have the application in protect mode.Can anybody give me
some instances where the keyword of far and near is applied?
[Off-Topic]
The near pointer is a pointer that has a smaller range than
that of a far pointer. The far pointer required more memory
and instructions to use, but it could be used to access
a larger memory space.
Not only off-topic, but incorrect, too: both near and far pointers could
be used to access up to 64 KB of memory, they had exactly the same range,
because the segment part of a far pointer was fixed. To get pointer
arithmetic to work on all 32 bits of a pointer, you needed a huge pointer.
They were slower, but they didn't expose the programmer to the segmented
nature of the architecture: using a long index, you could scan the whole
address space of the machine in a purely linear manner (the compiler took
care of the dirty details).
The difference between a near pointer and a far pointer was that the
near pointer could cover the 64 KB of the default (code or data) segment
while the far pointer could cover 64 KB anywhere in the machine's address
space. Pointer comparisons between far pointers have always been a gray
area (I believe it was common to assume same segment and only examine the
offsets).
The idea stems from relative and absolute addressing. In the
early days of 8 bit processors, processors would use 8-bit
signed values as offsets relative to the program counter
to designate addresses. Anything farther required 16 bits,
or two fetches. Thus acessing things closer was always
faster and required less code & memory.
This is entirely unrelated to 8086 and near vs far pointers.
Please ignore any kind of questions, topical or not, when you have no
correct output to provide.
Dan