From: Matthias T. <mt...@we...> - 2007-03-12 07:58:20
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hans, > I need to create a lookup table in Flash which will be used to > translate decimal digits to 7 segment display digits. >=20 > In a RAM-based forth, I could write something like >=20 > table constant -2 allot > 63 , 6 , 91 , 79 , 102 , 109 , 125 , 7 , 127 , 111 , >=20 > This would (as far as I understand) a base pointer table that pointed > to the 63, with the other values following. Your code initializes a constant named -2 with the value the word table leaves (or your base value is at least char T). After that it will allocate an unknown amount of space in RAM and finally compiles the values into the dictionary > How would I do this with amforth? As far as I can read from the > source code, allot acts on the heap (RAM) pointer. Is there something > equivalent to allot that acts on the current dictionary pointer? You have to set the dp manually (with e@ and e!) > I would be willing to waste one byte for each entry in the table and us= e > 16 bits for each, but i=B4d like to easily access the base pointer of > the table. a quick solution would be > create table ok > 1 , 2 , 3 , 4 , 5 , 6 , ok > 1 table + i@ . 1 ok > 2 table + i@ . 2 ok > 6 table + i@ . 6 ok > Bye Matthias -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) iD8DBQFF9QgVLo3irIddFw4RAg7LAKCRsRMkSPkQPUhc20tbS6TDhj9OvgCgvAO7 +AdlHdBspr32EXMw7NRXYBs=3D =3Dikw9 -----END PGP SIGNATURE----- |