A82: Re: Re: Assembly-82 Digest V1 #643


[Prev][Next][Index][Thread]

A82: Re: Re: Assembly-82 Digest V1 #643




It has been dones before, and looking at the source for these programs is
probably the easiest way to do this. The only program which does
derelocation which has source code available is vertigo. The source code can
be hard to read since the same source code is used for several different
calcs, but if you look in the TI82 sections you should be able to find the
needed information.

To derelocate yuor program you have to do the following:
Find addr, and length of your program
Exchange bytes between current location of program, and original location
resize the homescreen buffer to 0 bytes

When you resize variables in the RAm you have to take into account that the
var you are resizing might be located before you program, which means that
you program will be moved before the function does a ret. Since Y-var are
created on start up, they will normally always be located before you
program, which means that instead of calling the function you need to push
and addresse, and then jump to the function (you need to adjust the addr you
push). The problem with this is that if you program is not moved due to some
error, the return addr will not be valid, which means that unless you are
able to handle this too your program will crash. One way of doing this is to
use the build in error handler, which gives you an easy way to catch errors
that the system normally would handle, but this requires that the function
you call supports the error handler. Another method to handle this is to
move some of your code to a fixed location (text mem, graph mem etc), and
let that handle the call, and adjust the return of the call based on the
result of the function.

Dines
----- Original Message -----
From: Doug Torrance <profzoom@hotmail.com>
To: <assembly-82@lists.ticalc.org>
Sent: Thursday, January 21, 1999 2:08 PM
Subject: A82: Re: Assembly-82 Digest V1 #643


>
>Thanks for the information!  One thing I need to know, however, before I
>can implement this, is how to derelocate my program.  Has this already
>been documented, or can someone explain how it is done?
>
>Thanks
>Doug
>
>>>Asumming that you know how to derelocate your program accesing vars is
>>>actually fairly easy. Y-Vars are normal variables, so they can all be
>>>located using the normal search function listed in 82rom (The tokens
>are
>>>listed in 82var). The search functions returns a pointer to the data
>stored
>>>in y1, so accesing it is no problem. To write a new equation resize
>the
>>used
>>>var to the size of the new equations, and copy the data there. (All
>YVars
>>>are created at start up, and should there for always be present in the
>>RAM).
>>>
>>>DInes
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>