Thanks, Michael. This helps a lot. Also thank Matthias for me when you get a chance. I don't want to clog up his email any further.
Regards, -wis -----Original Message----- From: Michael Kalus [mailto:mi-ka...@t-online.de] Sent: Saturday, February 02, 2013 2:54 AM To: Everything around amforth Subject: Re: [Amforth] inner interpreter operation. Hi Wis. Since Matthias is bussy, maybe I can help out. Am 31.01.2013 um 21:37 schrieb Macomson, Wis: > I'm new to this and I'm trying to understand the amForth inner > interpreter. There are a couple of clarifications in the "amforth > Documentation, Release 5.1-wip,January 26, 2013" that would help a > lot. > > To wit: > > (p. 9) EXECUTE > > Q: When is EXECUTE, um, executed? I'm not clear on what this is used > for. ( xt -- ) EXECUTE If you put an execution token xt on the stack, you may EXECUTE that. It is used in the interpreter: Parse input stream for a forth word (word means "string of ascii characters delimited by blanks", find that word in dictionary, get its xt on stack and then execute it. Investigate ACCEPT and INTERPRET in the source code. > (p. 9) NEXT > [ . . . ] > This last step finally jumps to the machine code pointed to by the X > scratch pad register. > > Q: To be clear, the machine code jumps to NEXT when it has completed. > Correct? That is correct. 'Low level' forth machine code continues execution of forth on 'high level' that way. > (p. 9) EXIT > The code for EXIT (aka UNNEST) is the forth word EXIT in the > dictionary. It reads the IP from the return stack and jumps to NEXT. > The return stack pointer is incremented by 2 (1 flash cell). > > Q: I think EXIT pops the top of the return stack into the IP. That > way, the second step of NEXT gets the correct value. Correct? So it is. If stack grows 'down' an increment by 2 drops one item - on a 8Bit machine with a 16Bit virtual forth machine on it. > > (p. 9) DO_DOES > This code is the runtime part of the forth word DOES> . It pushes the > current address of the MCU IP register onto the returnstack and jumps > to DO_DOES. DO_DOES gets that address back, saves the current IP and > sets the forth IP to the address it got from the stack. > Finally it continues with NEXT. > > Q. Is this effectively a subroutine call? Yes. (I think so.) It is used to define words, that create words of the same class. For exeample VARIABLE is such a word. You may create variables that all work the same. VARIABLE Y0 VARIABLE X12 VARIABLE MOON Such words are also called "defining words". VARIABLE defines a new forth word, that has one cell of ram to hold an item. When this word is executed, it puts the address of its ram cell on stack - that is the 'subroutine' part of it. Michael > > Thanks for any light you can shed. > > ---------------------------------------------------------------------- > -------- > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics Download AppDynamics Lite > for free today: > http://p.sf.net/sfu/appdyn_d2d_jan > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amforth-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/amforth-devel ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_jan _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel