Path: utzoo!attcan!uunet!wuarchive!usc!jarthur!nntp-server.caltech.edu!rknop From: rknop@nntp-server.caltech.edu (Robert Andrew Knop) Newsgroups: comp.sys.cbm Subject: Re: HELP: Assembly - Address Maintenance for code overlaying Message-ID: <1990Dec10.192057.1239@nntp-server.caltech.edu> Date: 10 Dec 90 19:20:57 GMT References: <2373.27637c31@iccgcc.decnet.ab.com> Organization: California Institute of Technology, Pasadena Lines: 34 lockemer@iccgcc.decnet.ab.com writes: >I am writing a program in assembly which will need to load different sections >of code into the same areas of memory. These sections will have multiple >routines in them. Does anyone have any suggestions... on how to access >the routines from the main code (such as using labels somehow) so... I do not >have to manually keep track of where each routine ends up any time it is >reassembled? I am writing this on a 128 using MERLIN 128. You could always use the GEOS/VLIR trick, which is include a jump table at the beginning of the overlay module (the section of code that has multiple sets of routines loaded into it). For example, if you had three routines, the beginning of the overlay module would look like Overlay_start: jmp routine1 jmp routine2 jmp routine3 Then, whenever you want to access these routines from your main code (the code that is always memory resident), you would put in a statment like jsr Overlay_Start+(n-1)*3 where n is the number of the routine (1, 2, or 3). As long as every overlay module starts at the same place in memory (the location Overlay_Start), and as long as you don't change that location, you can move the routnes in the overlay module around, and only need to recompile that module; recompiling that module will create the correct jump table, but the location of the jump table is the same, so that no changes need to be made to the routine that accesses the jump table. -Rob Knop rknop@juliet.caltech.edu