Hi Danny,
Regarding:
> I don't think this is correct. My understanding is:
> - "Small" uses short intra-segment jumps and long inter-segment jumps.
> - "Smart" uses short intra-segment jumps only when jumping backwards (or
> forwards within a routine) and long inter-segment jumps.
> - "Large" uses long jumps everywhere.
>
> If you only have one segment, all jumps are intra-segment.
>
> You can use the "Small" code model in multi-segment applications if you
> don't let your segments get too big.
>From "Targeting Palm OS":
<snip>
SMALL MODEL
-----------
This model uses relative addressing (a 16-bit address) for all function
calls.
Small Model is best for small code resources and applications (under 32K),
or for code resources and applications in which all segments are under 32K.
SMART MODEL
-----------
When one function calls another function and the linker is sure they're in
the same segment, this model uses relative addressing (a 16-bit address).
Otherwise, it uses absolute addressing (a 32-bit address).
LARGE MODEL
-----------
This model uses absolute addressing (a 32-bit address) for all function
calls.
Large Model is useful when you have a source file that generates more than
32K
of code, or when the linker generates an out-of-range link error.
</snip>
If the above snip is correct:
- In SMALL model, you may have to rearrange the order of the functions in a
single segment hich is larger than 32K in order to keep all intra-segment
jumps less than 32K in size (caught by the linker). Of course, this is not
an issue if you keep segments smaller than 32K. And, you cannot have a
multi-segment app at all.
- In SMART model, you may still have to rearrange the order of the functions
in a single segment which is larger than 32K in order to keep all
intra-segment jumps less than 32K in size (caught by the linker). But, you
can now have multiple segments and all inter-segment jumps are "long"
(multiple jumps to get there...they are not direct 32-bit jumps).
- In LARGE model, you never have to rearrange the order of the functions in
a single segment which is larger than 32K. All jumps to all functions,
intra-segment and inter-segment, are "long" (multiple jumps to get there).
So far in my experience, the above snip has always proven correct. Is there
more to the story?
Thanks.
-----Steve Jackson
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/