Re: [NTLK] Developers: Calling Arbitrary ROM Functions

From: Paul Guyot (pguyot_at_kallisys.net)
Date: Thu Aug 18 2005 - 18:23:51 PDT


Le 19 ao=FBt 05 =E0 08:31, Jake Bordens a =E9crit :

> Does anyone know how to call an arbitrary function in ROM? For
> example, there is a function at 0x12345 and I know its function
> prototype. How might I go about calling it from C++ code.
>
> The compiler is more restrictive than I'm used to. Normally I'd just
> cast a constant long value to a function pointer. However, the
> Newton C++ tools don't apparently allow this.
>
> Alternatively, Is there a way to tell the Linker where to find a
> function by its memory location?
>
> Thanks for any insight.

What we usually do is to write some assembly language source file =20
that actually does the work.
Check Eckhart's Blunt source code for example.

You should be aware that there are three classes of functions:
- functions that are exported through the public and patch jump =20
tables. These must be called via the public jump table and (nearly) =20
all of them are available in some .o library provided with Newton C++ =20=

Tools, they are part of either DDK or Newton Includes APIs.
- functions that are exported through the patch jump tables only. =20
These must be called via this jump table. The actual address depends =20
on the Newton ROM (it's different between versions but also between =20
the eMate, the MP2100D, the MP2100 US and the Dr Watson).
- functions that are not exported at all. I doubt that you really =20
need to call these functions. There are very rare and are only found =20
in the micro-kernel.

You need to write assembly language glue for the second class of =20
functions. This means either making a package for each ROM (what =20
Eckhart did with Blunt) or check the ROM version before calling the =20
function.

Paul
--=20
Ministre ultrapl=E9nipotentiaire en disponibilit=E9.
Mobile. Sans baignoire fixe.
http://www.kallisys.com/
http://www-poleia.lip6.fr/~guyot/

-- 
This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries
Official Newton FAQ: http://www.chuma.org/newton/faq/
WikiWikiNewt for all kinds of articles: http://tools.unna.org/wikiwikinewt/


This archive was generated by hypermail 2.1.5 : Thu Aug 18 2005 - 18:30:01 PDT