What is the difference between far and huge pointers? |
Answer
This near, far & huge pointers comes only in DOS or other, which have only less memory accessible.
In DOS only 1 Mb ( 10,48,580 Bytes) of memory is accessible. Any of these memory location are accessed using CPU registers. Under DOS the CPU registers are only 16 bits long. Therefore, the minimum value present in a CPU register is 0, and maximum is 65,535. If we want to access more than 65,535 ? how to ? We can do this by - using two registers ( Segment & Offset ). Here memory is divided into 64 Kb locations or chunks.
C Program will allocate 64KB (only one segment) memory for data Part (dynamic memory allocation, Local variables).
by using 16 bit we can access that memory thats called near pointer(16 bit pointer).
suppose we need more than 64KB memory to a program / we want to access a particular memory location (in TSR Program)
at the time we need 32 bit pointer. through 32 bit pointer we can access any segment and offset address.
The Main Difference between Far and Huge Pointer is
Far pointers are not Normalized. Ex: TSR Programs use Far Pointers
Huge pointers are Normalized.
I think by this u can have brief idea about near, far & huge pointers.
According to my knowledge far pointers are mainly used to build I/O commands.Such as you can write "printf" function by useing far pointer
void main() { char far *vdu=0xB8000000; *(vdu+2)='a'; }
If you run this program in C,you can see "a" in the DOS screen
There are 2 blocks of memory above the 640KB RAM of 64KB each. The first 32KB are used by MA, rest by CGA/EGA/VGA. The "far" pointer is used to access the VDU memory directly. Hence the displaying functions or output functions are not required.
|
|
|
First answer by ID1039534106. Last edit by Redbeard. Contributor trust: 1621 [recommend contributor]. Question popularity: 185 [recommend question]
|
Research your answer: |
Can you answer other questions about software and apps?
|
|

