[OpenBIOS] Concatenating strings
Programmingkid
programmingkidx at gmail.com
Wed Sep 1 16:57:58 CEST 2010
On Sep 1, 2010, at 6:00 AM, openbios-request at openbios.org wrote:
> Message: 5
> Date: Tue, 31 Aug 2010 20:11:30 -0400
> From: Tarl Neustaedter <tarl-b2 at tarl.net>
> To: The OpenBIOS Mailinglist <openbios at openbios.org>
> Subject: Re: [OpenBIOS] Concatenating strings
> Message-ID: <4C7D9A32.2070300 at tarl.net>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> On 2010-8-31 8:06 PM, Programmingkid wrote:
>> Could someone provide me with a code example on how to combine two strings
>> together in forth please. Here is my attempt. For some reason it doesn't
>> work. Any help would be great.
>
> The below takes two strings of the form (addr len), allocates a chunk of
> memory for them, and concatenates them into that allocated memory, returning
> addr len.
>
> : $cat2 ( $1 $2 -- $3 )
> 2 pick over + dup >r alloc-mem >r
> 2swap tuck r@ swap move ( $2 $1-len )
> r@ + swap move ( )
> r> r>
> ;
Thank you very much Tarl. This word should be added to OpenBIOS.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20100901/0f56784a/attachment.html>
More information about the OpenBIOS
mailing list