passing 64k boundary

Hi,

I'm working on a project that will have an array that will cross the 64k boundary (and may even be larger then 64k.

Of course, the problems comes when adding something like 100 when it points to fff0

It's easy to identify when the pointer is going to cross the boundary so I created a simple workaround

UCHAR8 *pblk;
UCHAR8 *oldpblk;
ULONG_32 address;

// let's say pblk is pointing to 0x1fff0;

oldpblk = plbk;
pblk = pblk + 100;
if(pblk < oldpblk)
{
// passed a 64k boundary
address = (ULONG_32)pblk;
address = address + 0x10000; // add 64k
pblk = (UCHAR8*)address;
}

and it works fine, but somehow I have the feeling that I'm trying to kill a fly with a sledgehammer :)

Oh,. i'm using a DS5250 in contiguous (24bit) mode. and pblk is in "far" but isnt always.

More questions in this forum