"Marcel Hendrix" <mhx@[EMAIL PROTECTED]
> a écrit dans le message de news:
96001732203559@[EMAIL PROTECTED]
> <Montesquiou> writes Re: The word RECURSE
> [..]
>>> Maybe you want to define
>
>>> : cell+ 2+ ;
>>> : nfa>cfa count $1F and + cell+ ;
>
>> As it is an old compiler things are different. The layout of the words
is
>
>> DEFB N Name Length Field
>> DEFM "XXX" Name Field
>> DEFW NN Link Field
>> DEFW NN Code Field
>> DEFD Data Parameter Field
>
>> Therefore fetching the NLFA gives the length.
>
> I was just pointing out that
> 1. CELL+ will ease porting your ZX81 code to a 32bit or 64bit platform
> easily,
> 2. the compiler will toggle bits in N sometimes ( $1F AND )
> 3. "COUNT +" is shorter than "dup c@[EMAIL PROTECTED]
1+ +".
>
> -marcel
>
>
On my Z81 I did a definition of count as to follow
: count (adr1---adr2 n) dup 1+ swap c@[EMAIL PROTECTED]
;
: last current @[EMAIL PROTECTED]
@[EMAIL PROTECTED]
; (BTW I found it called ENTRY in my Brazilian
compiler)
Then your
: cell+ 2+ ;
hex
: nfa>cfa count $1F and + cell+
: recurse last nfa>cfa , ; immediate
: factorial dup 1 > if dup 1 - recurse * then ;
decimal
5 factorial .
120 OK
Thank you Marcel.
>
>