This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

64K boundaries on DS80C400

While executing the following code:

 char far * buf;
 buf=FARRAY(char, 0x8FFF0);
 printf("%p\r\n",buf);
 buf+=0x100;
 printf("%p\r\n",buf);
I get the following result printed:
x:08fff0
x:0800f0
Obviously, the MSB of the pointer is not updated. Why? Is this a known bug in C51?
Settings: device DS80C400, C51 v7.50, Memory Model Large (variables in XDATA), contiguous mode 16M, 'far' memory type support - checked.

Parents
  • Hello!
    0x100UL does the trick and now MSB of buf pointer is updated to 0x09.
    But consider more complicated example:

    typedef struct a{
     char x[0x100];
     char y[0x100];} struct_a;
    
    ..........................
    
     struct_a far * buf;
     buf=FARRAY(struct_a, 0x8FFF0);
     printf("%p\r\n",buf);
     printf("%p\r\n",buf->y);
    
    I get it again:
    x:08fff0
    x:0800f0
    

    What can you advice in such a case when structure is crossing 64K boundary?
    By the way I've already found the note in the "C51 User's guide":

    The absolute addressed object cannot cross a 64KB segment boundary. For
    example, you cannot access a long array that has 10 elements and starts at
    address 0xFFF8.

    Is that note still valid for the Dallas chips with true 24-bit DPTR's? I suspect yes... :(

Reply
  • Hello!
    0x100UL does the trick and now MSB of buf pointer is updated to 0x09.
    But consider more complicated example:

    typedef struct a{
     char x[0x100];
     char y[0x100];} struct_a;
    
    ..........................
    
     struct_a far * buf;
     buf=FARRAY(struct_a, 0x8FFF0);
     printf("%p\r\n",buf);
     printf("%p\r\n",buf->y);
    
    I get it again:
    x:08fff0
    x:0800f0
    

    What can you advice in such a case when structure is crossing 64K boundary?
    By the way I've already found the note in the "C51 User's guide":

    The absolute addressed object cannot cross a 64KB segment boundary. For
    example, you cannot access a long array that has 10 elements and starts at
    address 0xFFF8.

    Is that note still valid for the Dallas chips with true 24-bit DPTR's? I suspect yes... :(

Children