gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using xt's


From: Anton Ertl
Subject: Re: Using xt's
Date: Fri, 16 Feb 2024 19:21:56 +0100

On Fri, Feb 16, 2024 at 11:48:19AM -0600, Patrick Fitzpatrick wrote:
> Hi gang,
> ;
> 
> I haven't used execution tokens in many years (F-83 timeframe).
> 
> What I want to do is build a jump table like this:
> 
> create t 5 allot
> 
> : t1 ." t1" cr
> : t2 ." t2 " cr ;
> 
> '  t1 t 0 + !
> '  t2 t 1 + !
> 
> Then to execute t2, I would:
>  t 1 + @ execute
> 
> Is this correct?

Not quite.  Each xt consumes a cell, so you have to do

create t 5 cells allot

and later use

1 cells +

instead of

1 +

to get to the place for t2

- anton



reply via email to

[Prev in Thread] Current Thread [Next in Thread]