From: Enoch <ix...@ho...> - 2013-02-16 18:56:20
|
Rafael Gonzalez <ast...@ya...> writes: > Hi, If you want to do a variable jump vector table, that is fine > > If you jump vector table has a known size, you' may also use forth200x structures for field names. > That is the approach of forths like VFX Forth for its I/O vectors (GENIO drivers) Not sure if lib/forth200x/structures.frt is ready for Flash based fields. We should be mindful that the AVR implements Harvard archtecture unlike our PC's von Neumann's. > > > For something more sophisticated as Finite State Machines you may want to have a look at > http://galileo.phys.virginia.edu/classes/551.jvn.fall01/fsm2.htm > > > Paper explaining it at > http://galileo.phys.virginia.edu/classes/551.jvn.fall01/fsm.html For the above mentioned reason we rarely can copy code verbatim. Hence, the need to create our own tried & tested library. Thanks, Enoch. > Greetings > Rafael > > > > ________________________________ > De: Enoch <ix...@ho...> > Para: amf...@li... > Enviado: Sábado 16 de febrero de 2013 18:47 > Asunto: [Amforth] Code snippet > > Hi, > > Excuse me folks, while I am a (very) experienced embedded programmer > Forth for me is a new experience. So here's another joy discovery. The > old Forth sage tell us to use decision tables rather than case and > nested if-s, so here's my "sling" for your review that I use in the > implementation of a state machine: > > \ sling table generator, doc via example: > > \ : first ." first" ; > \ : second ." second" ; > \ : third ." third" ; > \ ' third ' second ' first sling shot > \ > \ 1 shot → second ok > \ -1 shot → ok > > : sling create ( i × xt -- ) > depth , begin depth while , repeat > does> ( n -- ? ) > over over @i U< > if 1+ + @i execute > else 2drop > then > ; > > Cheers, Enoch. > > > ------------------------------------------------------------------------------ > The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, > is your hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials, tech docs, > whitepapers, evaluation guides, and opinion stories. Check out the most > recent posts - join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel > ------------------------------------------------------------------------------ > The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, > is your hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials, tech docs, > whitepapers, evaluation guides, and opinion stories. Check out the most > recent posts - join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |