far Pointers
Pointers to far objects are stored using four bytes (32 bits). The bytes are stored little endian or low to high order. The first word contains the 14-bit memory offset (bits 14 and 15 are always 0). The second word contains the page number (or segment number for function pointers). The memory address is calculated as follows:
Variable Address = (Page * 0x4000L) + Offset
Function Address = (Segment * 0x10000L) + Offset
A far pointer is stored in memory at a word boundary as follows:
| | Address+0 | Address+1 | Address+2 | Address+3 |
|---|
| Contents | Offset (LSB) | Offset (MSB) | Page (LSB) or Segment (LSB) | Page (MSB) or Segment (MSB) |
A far pointer can access objects up to 16K in size in any memory area. Objects larger than 16K must be accessed using huge or xhuge pointers.
Related Knowledgebase Articles