Discussion Forum

passing 64k boundary

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Johan Schuld
Posted
6-Jan-2005 22:05 GMT
Toolset
C51
New! 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.
Read-Only
Author
Keil Reinhard
Posted
7-Jan-2005 09:04 GMT
Toolset
C51
New! RE: passing 64k boundary
Take a look to:
http://www.keil.com/support/docs/2269.htm
http://www.keil.com/support/docs/2800.htm

Next Thread | Thread List | Previous Thread Start a Thread | Settings