Path: utzoo!utgpu!water!watmath!clyde!bellcore!faline!thumper!ulysses!andante!mit-eddie!ll-xn!ames!pasteur!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!unido!uklirb!kirchner
From: kirchner@uklirb.UUCP
Newsgroups: comp.sys.atari.st
Subject: Re: MWC & large arrays -- help!
Message-ID: <2536@uklirb.UUCP>
Date: 11 Jul 88 08:33:56 GMT
References: <521@philmds.UUCP>
Organization: University of Kaiserslautern, W-Germany
Lines: 33

Hello,
just from a code-generator-writers point of view:

THERE IS ABSOLUTELY NO REASON TO LIMIT LOCAL OR GLOBAL OR ANY OTHER
MEMORY STRUCTURE TO 64K IN THE 68000.

I once wrote the generator for Pascal-SC ( the one with those
unique features for numeric applications, but a good pascal anyway -:) ),
and since numerics deal with large matrices etc. I had to access all
memory I could get. C uses the same access mechanisms as pascal, so
the same could be done there.

And this is how I did it:

All local variables and the globals also are accessed via an address-
register. Let me call them Al and Ag. As expected variables with
offset <32k are accessed via offs16(Al), or offs16(Ag).

If the offset does not fit into 16 bits, I generate:

       movea.l     Al,Ax          ; Ax is a scratch register
       adda.l      #offs32,Ax     ; now Ax points to the variable
       move.l      (Ax),Dx        ; access it.

Now remember: the address in Ax can be reused for subsequent accesses to the
same variable, and it can be used with a 16-bit-offset to access other
variables which are 'near' the first one. So with a little optimization
ALL memory can be accessed with only little overhead, which must not be paid
when variables are 'near' the Al/Ag anyway.

( I would not like to write a codegenerator in the same way for an 8086/-286 )

R. Kirchner