I forgot to mention it could also affect the relocatability of your code,
like moving forth code from flash memory to sram memory.

On Mon, Feb 2, 2026 at 5:29 PM John Sarabacha <[email protected]> wrote:

> Hi Tristan,
> This gives me more confidence in the code base and saves me time
> investigating further.
> Have you tried this in sram (your own user created word) rather than flash
> resident code.
> The flash resident code won't manifest this problem but the user created
> words could.
> Anyway I will now be releasing my version of dict_secs words (with
> relative addressing) and it
> will be updated further when the AmForth codebase is more stable.
>
> Thanks for getting back to me on this,
> John S
>
>
>
> On Mon, Feb 2, 2026 at 3:49 PM <[email protected]> wrote:
>
>> Hi John,
>>
>> There is no issue with nesting or recursion and the design choice to
>> branch to an address, rather than to an offset.
>>
>> |F=./fac.f
>> |S|    1|: factorial ( n -- n! )
>> |S|    2|    dup 2 < if        \ base case: if n < 2, return 1
>> |S|    3|        drop 1
>> |S|    4|    else
>> |S|    5|        dup 1-        \ compute n-1
>> |S|    6|        recurse       \ recursive call: factorial(n-1)
>> |S|    7|        *             \ multiply n * factorial(n-1)
>> |S|    8|    then ;
>>
>> > 10 factorial u.
>> 3628800  ok
>>
>> There are situations nowadays where relative branches would make things
>> easier, but I'm unconvinced these situations really existed on the
>> target hardware in 2007. However, it is 2026 not 2007, and so is it
>> worth looking at again? Certainly, and since AmForth is an open source
>> project, we all have that opportunity.
>>
>> Best wishes,
>> Tristan
>>
>> On 2026-02-02 18:30, John Sarabacha wrote:
>> > Hi  Everyone,
>> > There is an issue (or a lack of a useful feature) in the Amforth
>> > distribution (32 bit riscv & arm, since they share the same secondary
>> > hand
>> > compiled words), I have made the adjustments to the secondary words
>> > (which
>> > I have not released yet, as I am verifying its impact). I suspect these
>> > are
>> > causing some of your tests to fail. This revolves around the use of
>> > BRANCH
>> > and CONDBRANCH primary words and the addresses they are using, they
>> > should
>> > be relative addresses and not absolute addresses specified in
>> > .word(...)
>> > after the BRANCH or CONDBRANCH. If there is no nesting or recursion
>> > involving these words then no problem, but then you are limiting what
>> > you
>> > can do.
>> >
>> > Hope this helps,
>> > John S
>> >
>> > _______________________________________________
>> > Amforth-devel mailing list for http://amforth.sf.net/
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/amforth-devel
>>
>>
>> _______________________________________________
>> Amforth-devel mailing list for http://amforth.sf.net/
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>>
>

_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
[email protected]
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to