From: Matthias T. <mt...@we...> - 2008-03-09 17:10:55
|
Christian Berger wrote: > Am Freitag 07 März 2008 17:22:08 schrieb Matthias Trute: >> Hi, >> >>> Now my big question is, how do I redirect the output of the forth system >>> to the emit_tv word? >> just do >> >> ' your-emit is emit > > Thanks, that works fine, but how can I change that permanently? similiar: amforth defines a deferred word named turnkey which is executed whever the controller starts up. The default turnkey is defined in the application/words/turnkey.asm file and sets up the serial line, turns the interrupts on and prints the version number. You turnkey action may look like -------------- : my-turnkey ( now your code goes here ) ; ' my-turnkey is turnkey --------------- And the default turnkey action is changed to yours. Be aware that the default turnkey action is not saved, you may need to re-flash the eeprom (turnkey is a EEPROM based DEFER word). >> The IS/DEFER is based upon a forth200x standard see >> >> http://www.forth200x.org/deferred.html for the >> details. > > Unfortunately I know far to little about Forth to understand that. Its a elegant way to do vectored execution. Traditional forth would express it like the first amforth versions: A variable named '<something> and a word named <something> that reads the content of the variable '<something> and executes the XT stored there. ------ old variable 'something : something 'something @ execute ; ' a-word 'someting ! something ------- new RDEFER something ' a-word IS something something --------- afterwards something will execute a-word when called. The RDEFER is used to express that the XT vector is stored in RAM. Other possibilities are EDEFER (for EEPROM) and UDEFER (for the user area). An IDEFER would use a flash cell. The IS is always the same, for all deferred words. Note that the DEFER/IS words are almost lowercase and need to be loaded from the file lib/defer.fs since the core system contains the runtime words only ;=) Bye Matthias |