Hello, Bonjour to all,
I have a nice (short and compact) Forth written in 1983 by the Brazilian
Professor Antônio Costa for the TRS80 and later for the ZX-81 by Tomas Löw
http://www.zx81.megahospedagem.com.br/msprog.htm
look at "Forth Autor: Tomas Löw Edição 39 - Dezembro 1984 "
It works fine on both emulators VB81_XuR and eightyone.
When I have something like
: word
begin action condition? until
;
I am trying to implement the word RECURSE, similar to
: word
action condition?
if exit
then
RECURSE
;
I am looking for a definition of RECURSE in Forth-79.
My first try was
: RECURSE
CONTEXT @[EMAIL PROTECTED]
@[EMAIL PROTECTED]
DUP
c@[EMAIL PROTECTED]
+ 5 + *N *WHILE END,
; IMMEDIATE
Where *WHILE is the compilation adress of WHILE - *N *WHILE put the adress
of *WHILE on the stack and the definition of END, is
: END,
, HERE - c,
; IMMEDIATE
However it don't work with
: factorial ( n -- n! )
dup 1 > if dup 1- recurse * then
;
Any Idea ?
Thank you and sorry for my poor english.


|