Path: utzoo!attcan!uunet!mcvax!philmds!leo
From: leo@philmds.UUCP (Leo de Wit)
Newsgroups: comp.sys.atari.st
Subject: Re: MWC & large arrays -- help!
Message-ID: <541@philmds.UUCP>
Date: 1 Jul 88 08:36:42 GMT
References: <734@cacilj.UUCP> <46700008@hcx2> <411@brambo.UUCP> <767@lakesys.UUCP> <2921@tekig5.TEK.COM> <5327@batcomputer.tn.cornell.edu>
Reply-To: leo@philmds.UUCP (Leo de Wit)
Organization: Philips I&E DTS Eindhoven
Lines: 18

In article <5327@batcomputer.tn.cornell.edu> braner@tcgould.tn.cornell.edu (braner) writes (amongst other things):
>I think the original question was _not_ naive:  why would one need
>a _structure_ (rather than an array) that is more than 32K in size?
>That's what many 68000 compilers cannot handle:  structure fields
>that are offset more than 32K from the beginning of the structure.
>That's because a field in a structure is accessed by adding an offset
>(a constant calculated at compile time) to the base address.  On the
>68000, the obvious, compact, efficient method is to use the indexed
>addressing mode, but that limits you to an offset of +-32K.

Maybe it is good to mention that exactly the same goes for actual
parameters and automatic variables; most compilers use a frame pointer
register (link register , typically A6) to index from. The link
instruction itself also takes a offset of +-32K. So if you can avoid it,
don't put big arrays or other variables on the stack (there's an other
danger with huge stacks: it can run into your heap).

         Leo.