Re: Using xt's
Anton Ertl <anton-eMTcDWn+JWX/RkxMZTRrOJdqbFPxfnh/@public.gmane.org> Fri, 16 Feb 2024 19:21:56 +0100
| Newsgroups | gmane.comp.lang.forth.gforth |
|---|---|
| Message-ID | <[email protected]> |
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