The 68000 core of the Dragonball processors requires 2 and 4 byte objects to
be aligned to an even address. It does not require 4 byte objects to be
aligned on 4 byte boundaries. Therefore, if you put all your 2 and 4 byte
objects first, followed by 1 byte objects and variable length objects, you
won't have any alignment problems. Since some processors do require 4 byte
objects to be aligned on 4 byte boundaries, it's probably wise to put your 4
bytes objects first, but the Dragonball won't care if you mix up your 2 and
4 byte objects.

Note that if you define a struct for the fixed size portion of your record,
and somehow mistakenly put a 1 byte object in the wrong place, the C
compiler will add padding after it in order to keep the following objects on
an even alignment. Of course, this is wasting a byte in each of your
records, so it is best avoided.

Something else you might need to know is that the 68000 core uses a
different byte endianness than Intel processors used in most PCs. When the
68000 core stores a 2 or 4 byte integer at an address, it puts the most
significant byte first. For more on endianness, see for example,
http://mindprod.com/endian.html
-- 
Peter Epstein

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to