Re: Using xt's

Bernd Paysan <[email protected]> Fri, 16 Feb 2024 19:21:33 +0100
Newsgroups gmane.comp.lang.forth.gforth
Message-ID <2513232.KX7oQKdZxJ@liubei>
--nextPart9042604.cXerOTE6Ve
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="UTF-8"; protected-headers="v1"
From: Bernd Paysan <[email protected]>
To: gforth-mXXj517/[email protected]
Cc: Patrick Fitzpatrick <[email protected]>
Subject: Re: Using xt's
Date: Fri, 16 Feb 2024 19:21:33 +0100
Message-ID: <2513232.KX7oQKdZxJ@liubei>
MIME-Version: 1.0

Am Freitag, 16. Februar 2024, 18:48:19 CET schrieb Patrick Fitzpatrick:
> Hi gang,
> ;
>=20
> I haven't used execution tokens in many years (F-83 timeframe).
>=20
> What I want to do is build a jump table like this:
>=20
> create t 5 allot
>=20
> : t1 ." t1" cr
> : t2 ." t2 " cr ;
>=20
> '  t1 t 0 + !
> '  t2 t 1 + !
>=20
> Then to execute t2, I would:
>  t 1 + @ execute
>=20
> Is this correct?

Almost. You need to sprinkle in some CELLS, because the size of what ! stor=
es=20
is a cell, not 1.

I.e.

Create t 5 cells allot

=E2=80=A6

' t1 t 0 cells + !
' t2 t 1 cells + !

t 1 cells + @ execute

It is often more convenient to define t1 and t2 beforehand, and then

create t  ' t1 , ' t2 , ' t3 , ' t4 , ' t5 ,

=2D-=20
Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o id: kQusJzA;7*?t=3Duy@X}1GWr!+0qqp_Cn176t4(dQ*
https://net2o.de/

--nextPart9042604.cXerOTE6Ve
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part.
Content-Transfer-Encoding: 7Bit

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEERJ1NDqPQRwYnwBjr9y2Uk5MtoGcFAmXPp60ACgkQ9y2Uk5Mt
oGd9QA/9Erjw84DWhG953mbcAHkjnbtkZEDXsU4H6Xu5E0AD5zm1CVK01u0wnqMp
Aj4OkdoXMn6Mx0nLaXwsSUNs2Ikg8HhmBZy7JnHoC/IcRZ2Hspc3iOFKG8rW23ED
2yjaoFLXpGBKTmPnQrgRb4hBeMmJYo2zBeNi/qFDTSCOyOSmquHtwoEq8ZQIOku7
uYFRsQ8YwF381KNEm2vA2EnTF1UvkStd/NsVO07pZ1VhLSOj3ZpxriufxjHPnIYg
dkFuomiSZ3PiS/zIo/tbpN+XBRrmRx6Hj84F0pwKZb1m8CsTSRgTZwOZdhVh/x4O
wFI2/CAsU7vDiME8fR9xak6zZiY2oxI2AZToaLjKXpyLBqw2pgtMXPivqCB0a+nc
vwWDDr91Pmd0qnjHHuD2qdpIbkAQUtFyuivm8fu5fhdUsYvUQqnxA9RcUKhXy5e5
1MRZYFVIFH4PPawBktTlfakyC4GaiV4WjhjzUhrZPKXBT9US6pCh5RASDiM3IPkg
u1ufB3wFQQOnbu1xP6lfmL57Xob3KfxHWLvfqboFqnDVgalulIItmo0DKWY79viK
nUSx6t2elgQdhBa+gmupZcrZ7KDeqNoCY8QryjMlPP9XNCyamGT2B3Qisg+q1CiB
IoDzaum07KKB3J4NjMENdJsgsspPKEMf6VOIrxlVo52ps15BCHk=
=iFEQ
-----END PGP SIGNATURE-----

--nextPart9042604.cXerOTE6Ve--