Re: A89: kernel/no stub


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

Re: A89: kernel/no stub




> > A Kernel is a program that provides functions to other programs or even
> >  directly runs other programs.  All operating systems (Windows, Linux,
> >  MacOS) all have a Kernel.  It is the base of the operating system that
> does
> >  what software wants it to do.  I think the purpose of having any sort of
> >  kernel on a TI-89 at all is to provide easier, faster access to commonly
> >  used functions in the calculators (vs the applications having to do
> >  everything themselves, although libraries sure help).
> >  I hope this helps (and is right?)
>
> I'm not understanding how the kernel will allow faster access to certain
> functions...what do you mean?  How do you make the 'applications do
> everything themselves'?  What functions in the kernel need to be called which
> if not done from the program code will dissallow it from being used by the
> ti???

Functions in libraries can take input data in registers, as well as return them
in registers (C functions only return them in a0/d0). This can make them faster,
as well as easier to integrate into your own program flow.
C functions can also use registers but I've yet to see this functionality on a
TI calc. Although TI-GCC library probably uses it all over the place without you
seeing it =)

> Also, what is the deal with the nostub (and what exactly is stub :)???

A stub is a small piece of code located in the very beginning of a
Fargo/DoorsOS/whatever program that calls functions the kernel installed in a
safe place on the calc (usually at the very end/top of memory). These functions
make the program ready to run by relocating it, i.e. by adding the start address
of the program file to all absolute jumps/subroutine calls. This is how these
programs can use libraries even though they (and the program itself) has been
moved around in memory.

Incidentally (sp?), it's also what makes multitasking a pain in the *ss, since
you can't move anything in memory once it has begun executing...

A "nostub" program is generally speaking a program using TI:s design. It still
relocates, but only internally, since all external functions it can call are in
the calcs ROM already. These programs can be moved around without any problem
(well, internal registers stored in registers and variables can still cause
trouble). You can still use a library-like structure, but you have to do it all
in the program (like I did).

--
 / Niklas Brunlid
Check out Prosit for the TI-89 / TI-92+ at http://prosit.ticalc.org
Random PQF Quote follows:

No one was avoiding him, it was just that an apparent random Brownian
motion was gently moving everyone away.
        -- (Terry Pratchett, Reaper Man)





References: