On Mon, 8 Jun 2020 11:58:15 +0100 tur bine <mailbox....@gmail.com> wrote:
> Hi just wished to expand my knowledge base with forth, the stack > pointer increases during runtime and does not decrease unless using > certain commands if etc, can somebody explain what happens when sp > and thus the stack gets full please > Thank you Your program will crash! AmForth, certainly on the AVR, makes no run-time checks on stack bounds. In the firing line are: the return stack (RP), the Terminal Input Buffer (TIB), any variables ALLOTed, User Variables (UP), etc. The Forth approach is that it's up to you to test your words as you write them for offending behaviour. The Forth development environment also makes this dead easy. For example to test '+' type: 3 2 + . . The first dot prints the answer of 5. The second dot THROWs error 4 as the stack has under-flowed. Thus you have proven '+' uses two items from the stack and leaves just one. '?stack' checks the Computation Stack only and is part of 'interpret' which is taking what you typed and executing it a word at a time. -- Regards, Martin Nicholas. E-mail: reply-2...@mgn.org.uk (Address will be valid throughout 2020). _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel