Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!asuvax!ukma!widener!news.cs.indiana.edu!rutgers!cbmvax!chrisg From: chrisg@cbmvax.commodore.com (Chris Green) Newsgroups: comp.sys.amiga.programmer Subject: Re: Help with language writing Message-ID: <21765@cbmvax.commodore.com> Date: 21 May 91 13:28:30 GMT References: <1991May20.134453.15378@Daisy.EE.UND.AC.ZA> Reply-To: chrisg@cbmvax.commodore.com (Chris Green) Distribution: all Organization: Commodore, West Chester, PA Lines: 24 In article <1991May20.134453.15378@Daisy.EE.UND.AC.ZA> mlaidlaw@Daisy.EE.UND.AC.ZA (Mike Laidlaw) writes: > >Help! > >I'm writing a Forth-like language and am stuck.My problem is this,when >creating secondarys using the outer interpreter (editor) I am using absolute >memory jumps to primitives or other secondarys.I then save the dictionary to >disk as a straight memory dump.When I next load my language,AllocMem gives >me memory starting at a different address thus when I load my program,all the >absolute calls are incorrect thus my program bombs. JForth uses a variety of techniques for this. When generating a call to another routine, they use a 16 bit relative branch to get to it, if possible. If not, they generate a JSR xxx(A4) where A4 is a register that points 32k into the image. If even this doesn't reach, then they generate a jsr absolute to the target address, and add this address to an internal list of absolute addresses which must be relocated at load time. -- *-------------------------------------------*---------------------------* |Chris Green - Graphics Software Engineer - chrisg@commodore.COM f | Commodore-Amiga - uunet!cbmvax!chrisg n |My opinions are my own, and do not - killyouridolssonicdeath o |necessarily represent those of my employer.- itstheendoftheworld r *-------------------------------------------*---------------------------d