what is a far pointer
Answer Posted / lalit kumar
Far pointers have a size of 4 bytes. They store both the
segment and the offset of the address the pointer is
referencing. A far pointer has an address range of 0 - 1M
bytes. It is important to understand that an addressing
range of 1M does not remove the 640K barrier from the
program. It means that the pointer can address the upper
memory area (641 - 1M) which typically contains video
memory, ROM and anything else that may be loaded high.
1: A far pointer can be incremented and decremented using
arithmetic operators. When a far pointer is incremented or
decremented ONLY the offset of the pointer is actually
incremented or decremented. The segment is never incremented
by the arithmetic operators. This means that although a far
pointer can address up to 1Mb of memory, it can only be
incremented through 64Kb and the offset will start at zero
again without changing the value of the segment. This is
referred to as "wrapping" the pointer
(e.g. 0F3E:FFFF + 1 = 0F3E:0000).
2:When a far pointer is decremented from zero it will wrap
the other way and become 64K.
3:Far pointers are not unique. It is possible to have two
far memory addresses that have different segments values and
different offset values that address the same memory
location e.g. 0777:2222 has an absolute address of
07770 + 2222 = 09992 and 0999:0002 has an absolute address
of 09990 + 0002 = 09992. When relational operators are used
on far pointers only the offsets are compared. For example:
if we let a = 0777:2222 and let b = 0999:0002 then a == b
would return false because this is equivalent to 2222 ==
0002 which is in fact false. In other words relational
operators will only work on far pointers if the segment
values of the pointers being compared are the same.
Is This Answer Correct ? | 3 Yes | 5 No |
Post New Answer View All Answers
How do I round numbers?
What will be the outcome of the following conditional statement if the value of variable s is 10?
What is a void * in c?
What is the difference between procedural and functional programming?
Do you have any idea about the use of "auto" keyword?
what are enumerations in C
How can you convert integers to binary or hexadecimal?
What is external variable in c?
What is scanf_s in c?
What is a const pointer?
difference between Low, Middle, High Level languages in c ?
number of times a digit is present in a number
Does free set pointer to null?
How can I use a preprocessorif expression to ?
What is use of pointer?