[Previous]
[Contents]
[Next]

FP_OFF()

obtain the offset of a far pointer value

Synopsis:

#include <i86.h>
unsigned FP_OFF( void __far *far_ptr );

Description:

The FP_OFF() macro can be used to obtain the offset portion of the far pointer value given in far_ptr.

Returns:

The offset portion of the pointer value.

Examples:

#include <stdio.h>
#include <i86.h>

char ColourTable[256][3];

void main()
  {
    union REGPACK r;
    int i;

    /* read block of colour registers */
    r.h.ah = 0x10;
    r.h.al = 0x17;
#if defined(__386__)
    r.x.ebx = 0;
    r.x.ecx = 256;
    r.x.edx = FP_OFF( ColourTable );
    r.w.ds = r.w.fs = r.w.gs = FP_SEG( &r );
#else
    r.w.bx = 0;
    r.w.cx = 256;
    r.w.dx = FP_OFF( ColourTable );
#endif
    r.w.es = FP_SEG( ColourTable );
    intr( 0x10, &r );

    for( i = 0; i < 256; i++ ) {
      printf( "Colour index = %d "
          "{ Red=%d, Green=%d, Blue=%d }\n",
          i,
          ColourTable[i][0],
          ColourTable[i][1],
          ColourTable[i][2] );
    }
  }

Classification:

Intel

Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

Caveats:

FP_OFF() is a macro.

See also:

FP_SEG(), MK_FP(), segread()


[Previous]
[Contents]
[Next]