Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!asuvax!ukma!seismo!dimacs.rutgers.edu!rutgers!cbmvax!carolyn From: carolyn@cbmvax.commodore.com (Carolyn Scheppner - CATS) Newsgroups: comp.sys.amiga.programmer Subject: Re: Help with language writing Message-ID: <21759@cbmvax.commodore.com> Date: 20 May 91 23:28:44 GMT References: <1991May20.134453.15378@Daisy.EE.UND.AC.ZA> Reply-To: carolyn@cbmvax.commodore.com (Carolyn Scheppner - CATS) Distribution: all Organization: Commodore, West Chester, PA Lines: 59 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.My question is this,do I >save my sources as ascii text and compile them everytime I load the text back >in again,or is there some method of using indirect addressing within >secondarys? The problem with ascii text files is if I want to create whole >dictionarys which emulate another language which would take pretty long to >compile. > >Does anyone know how JPForth or any other Forth does it? > >Please Note : I am using assembly code to produce the language. > >Thanks in Advance. > >Myron 8-> There are probably hundreds of way to do it. The basic concept is that you cannot use absolute memory locations on the Amiga. I gather the table is NOT compiled with your code (that's what you are trying to avoid). So you can not use PC relative addressing like lea.l label(PC),a0 ; gets current address of label move.l label(PC),d0 ; get longword AT current address of label However, you can use base register addressing (which is faster on the 68000 than absolute addressing) Load your table and put its base address in a register like A5. A5 won't get trashed by any system routines (unless you use it to pass an argument but few functions use A5 for arg). Write your program to reference everything in the loaded piece off of the base register. For example: lea.l label(a5),a0 ; gets current address of label move.l label(a5),d0 ; get longword AT current address of label jsr label(a5) ; jump to sub AT current addr of label -- ========================================================================== Carolyn Scheppner -- Tech. Mgr. CATS - Commodore Amiga Technical Support PHONE 215-431-9180 {uunet,rutgers}!cbmvax!carolyn carolyn@commodore.com Oh I'm a numberjack and I'm OK, I code all night and I work all day... ==========================================================================