Important: The information in this document is obsolete and should not be used for new development.
Bypassing MC68000 Addressing Limitations
68K compilers typically generate PC-relative instructions for intrasegment references. This restricts the size of segments to 32 KB because the PC-relative instructions on the MC68000 processor use a 16-bit offset. Similarly, references to addresses expressed as offsets from the address stored in A5 are also limited to 16-bit offsets on the MC68000 processor.Since references to the jump table are expressed as positive offsets from A5, this effectively limits the size of the jump table to 32 KB. References to global variables are expressed as negative offsets from A5, so the size of the global data area is limited to 32 KB as well.
In the past, the Resource Manager used to limit resources to 32 KB, so 16-bit offsets were guaranteed to be sufficient.
Table 10-1 summarizes existing MPW solutions to these limitations. The sections that follow provide detail on how to implement these solutions. The section "32-Bit Everything" (page 10-17) describes a mechanism that allows you to remove all three limits. Which solution you choose depends on the specific needs of your program.
In general, it is recommended that if you need to remove only one of the limits, you use the solution given for that limit. If you need to remove two or more limits, the 32-bit everything solution is probably your best choice.
- Note
- Other development environments may use different methods to work around the 16-bit addressing limitations.
Table 10-1 Classic 68K runtime architecture limits and solutions
Problem Solution Restrictions and
effect on performanceGlobals > 32 KB SC/SCpp -model farData
optionNo restrictions. Code is bigger. Must link with -model far
option.Use assembly language for 32-bit references No restrictions. Segment > 32 KB SC/SCpp -bigseg
optionRestricted to single-segment C programs running on 68020 and or higher CPU. ILink -br 68k
optionNo restrictions. ILink -br 020
optionProgram must run on a 68020 or higher. Jump table > 32 KB ILink -wrap
optionNo restrictions. It decreases memory available for global data. Everything > 32 KB See the section "32-Bit Everything" (page 10-17). No restrictions. Code is up to 30% bigger.
Subtopics
- Increasing Global Data Size
- Increasing Segment Size
- Increasing the Size of the Jump Table
- 32-Bit Everything