Thank you very much for all your help. I only wish there was documentation available on
how to add words. Maybe I should make a tutorial and send it to the person in charge of
the OpenBIOS website.
On Feb 24, 2010, at 6:00 AM, openbios-request(a)openbios.org wrote:
Date: Wed, 24 Feb 2010 10:13:23 +0000
From: Mark Cave-Ayland <mark.cave-ayland(a)siriusit.co.uk>
To: The OpenBIOS Mailinglist <openbios(a)openbios.org>
Subject: Re: [OpenBIOS] Help with local variables
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
G 3 wrote:
Hi, I am working on implementing local variable
support in OpenBIOS. I
have done a lot of research on the issue, but there are a few issues I
still need help resolving.
-Does Openbios context switch when a word is called? This is when all
the registers are saved into a stack frame, so the currently executing
word can use them.
I think you are looking too low a level here - all of this is handled
automatically by the Forth engine.
-Could someone give me a tutorial on how to add c
functions to forth and
make them accessible to the interpreter. I want to be able to add words
to the dictionary and be able to use them from the command line.
The easiest way to look at this is to look at one of the existing
primitive words such as DOCOL. But in short:
- Add the new word to the end of the wordnames array in kernel/bootstrap.c
- Add the C function name to the end of the words array in
- Add the C function to kernel/internal.c
- Would anyone know which register on the PowerPC
would be good for
using as a stack pointer for a new local variable stack? I think r13 is
free and a possible candidate.
Again, you're looking at too low a level here. What I believe you need
to do is create a word that adds a new dictionary to the search list at
the start of the function, much in the same way that a package instance
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
t: +44 870 608 0063
Sirius Labs: http://www.siriusit.co.uk/labs