[OpenBIOS] problem with strings

shon at soc-soft.com shon at soc-soft.com
Thu May 12 15:45:08 CEST 2005

Forth word "begin-package" takes three strings as input

begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- )

With the current implementation, arg-str will be overwritten. So I think
number of pockets should be increased to three.


-----Original Message-----
From: Stefan Reinauer [mailto:stepan at openbios.org]
Sent: Thursday, May 12, 2005 1:12 PM
To: openbios at lists.openbios.org
Subject: Re: [OpenBIOS] problem with strings

* shon at soc-soft.com <shon at soc-soft.com> [050512 09:10]:
> 0 >   ok
> 0 > " hi" " hello" " bye" " welcome"  ok
> 8 > .s <8> 4005810c 2 4005800c 5 4005810c 3 4005800c 7
>  ok
> 8 >
> Above the strings " hi" and " bye" are stored at the same
> address(0x4005810c) and  also " hello" and " welcome" are stored at
> same address(0x4005800c).This means that the first two strings " hi"
> " hello" are overwritten and therefore lost. Strings defined using '
> ' also show the same behavior.

The words reading strings from the interpreter into memory are using a
"pockets" implementation with two alternating string buffers. This means
if you want to put more than two strings on the stack without touching
them in between you need to create a copy of those strings.
Think of it as a temporary string buffer.

> Is this an intended behavior? Please verify the same.Q

It is indeed intended, since many forth engines do this the same way.
If it is not sufficient, you can raise the number of pockets in
forth/bootstrap/bootstrap.fs. Go look for:
      \ pockets implementation for

If you have some reasonable sample code that needs more pockets rather
than becoming overly complex, we can raise the number of pockets in the
official tree.


OpenBIOS                 http://openbios.org/
Mailinglist:       http://www.openbios.org/mailman/listinfo
Free your System - May the Forth be with you

The information contained in this e-mail message and in any annexure is
confidential to the  recipient and may contain privileged information. If you are not
the intended recipient, please notify the sender and delete the message along with
any annexure. You should not disclose, copy or otherwise use the information contained
in the message or any annexure. Any views expressed in this e-mail are those of the
individual sender except where the sender specifically states them to be the views of
SoCrates Software India Pvt Ltd., Bangalore.

OpenBIOS                 http://openbios.org/
Mailinglist:       http://lists.openbios.org/
Free your System - May the Forth be with you

More information about the OpenBIOS mailing list