[OpenBIOS] Help with local variables

Programmingkid programmingkidx at gmail.com
Thu Feb 25 16:45:35 CET 2010


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 at openbios.org wrote:

> Message: 5
> Date: Wed, 24 Feb 2010 10:13:23 +0000
> From: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>
> To: The OpenBIOS Mailinglist <openbios at openbios.org>
> Subject: Re: [OpenBIOS] Help with local variables
> Message-ID: <4B84FBC3.4040108 at siriusit.co.uk>
> 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 
> kernel/primitives.c
> 
> - 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 
> does.
> 
> 
> HTH,
> 
> Mark.
> 
> -- 
> Mark Cave-Ayland - Senior Technical Architect
> PostgreSQL - PostGIS
> Sirius Corporation plc - control through freedom
> http://www.siriusit.co.uk
> t: +44 870 608 0063
> 
> Sirius Labs: http://www.siriusit.co.uk/labs

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20100225/067b4ba4/attachment.htm>


More information about the OpenBIOS mailing list