Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macros: FP_OFF and FP_SEG

Status
Not open for further replies.

UmaGrama

Technical User
Sep 8, 2003
33
BR
Hi... I got this code from a tutorial though the two macros that is used in it cannot be found in the library dos.h which should had been. Here is the code, can anyone find a replacement or a suggestion I can make to go around this little problem?

--------------
//here it is:
#include <dos.h>
typedef struct
{
char page;
unsigned int offset;
unsigned int length;
}DMA_block;

void LoadPageAndOffset(DMA_block *blk, char *data)
{
unsigned int temp, segment, offset;
unsigned long foo;
segment = FP_SEG(data);
offset = FP_OFF(data);
blk-> (segment & 0xF000) >> 12;
temp = (segment & 0x0FFF) << 4;
foo = offset + temp;
if(foo > 0xFFFF)
blk->page++;
blk->offset = (unsigned int)foo;
}
-----------
What is strange is that I took a look in the Help Menu in Borland and there is a example using FP_OFF and FP_SEG but when I compile that example it gives me the same error that I get when I run my own prog.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top