Shop OBEX P1 Docs P2 Docs Learn Events
Is there a way to force HUB memory alignment? — Parallax Forums

Is there a way to force HUB memory alignment?

dnaddordnaddor Posts: 26
edited 2008-04-04 00:41 in Propeller 1
Hi everyone.

I have several graphic tiles in DAT sections. Each tile is 16 longs (64 bytes). I am using the lower 6 bits of pointers for something else, so I want to force the first block to be at a hub address that is a multiple of 64. In other words, I need to reserve between 0 and 63 bytes to force the first block to be at the correct spot.

Right now, I'm putting the tiles as the very first DAT block at the very beginning of my program, and then putting a long 0,0,0 in front. According to [noparse][[/noparse]F8], my graphic tiles start at hub memory address $0040, so the code works. But I'm concerned that the IDE might rearrange how it lays out the hub memory, or that an IDE update will change where the data lives.

Is there a better way to do this? Something like ORG (($ + 63) & 63), but for hub memory?

Thanks!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-04 00:37
    There's not a good way to do this.· If you don't use the high end of hub ram, you can copy your tiles to there before using them.· That way you can align them as you need to do.· There are other copy options.· For example, you can allocate an extra 63 or 64 bytes at the beginning of·your DAT section and (again) copy the tile data to the nearest 64 byte boundary.· A LONGMOVE is very fast and would have to be done only once during initialization.
  • dnaddordnaddor Posts: 26
    edited 2008-04-04 00:41
    Hi Mike.

    I love the extra 63 byte idea. The program can figure out how far to move the data, and just move it at initialization.

    Thanks for the quick reply.
Sign In or Register to comment.