On 19Oct18 19:32, Matthias Trute wrote: > Am Freitag, den 19.10.2018, 14:46 +0200 schrieb Tristan: > > Hello Martin, > > > > Very intriguing, just when I am away from my machine so I can’t test > > things out! > > > > If I remember correctly, the default Amforth avr build uses (rx,tx) > > interrupts to handle the serial prompt. If at the serial prompt I > > type in the word -int and “all” -int did was to issue the assembler > > cli instruction I should lose my serial prompt. I can’t check now but > > if the serial prompt does not disappear then there is other machinery > > at work. > > It depends. Serial send (TX) is since long not interrupt driven. It > works even with disabled interrupts. Receiving is usually interrupt > driven, but can be configured to a polling code. It has 2 advantages: > smaller code and works almost always. The disadvantage is, that > characters may be lost if they arrive too fast. > > The non-avr platforms are all non-interrupt based. > > Matthias > > PS: nice discussions this week :=) > > > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amforth-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/amforth-devel
Hello Matthias, Martin, Martin's original post raised the question whether @ ! +! 2@ 2! d+! should disable interrupts on the AVR8 (bracketing with cli and sei). I am particularly interested as to whether the words @ ! +! could indeed be interrupted within AmForth. After trying to use 1ms for a purpose it was not suited to, I re-read http://amforth.sourceforge.net/TG/AVR8.html and tried to form a picture of how AmForth handled interrupts. This is what I settled on based on my reading of the sections "Inner Interpreter", "NEXT", "Interrupts" from "Core System" in the link above. 'The inner interpreter checks for set interrupt flags in the "space" between forth words. An interrupt service routine can only be executed by the inner interpreter. If the inner interpreter finds a set interrupt flag, it executes the associated interrupt service routine (which will not be interrupted) and clears the interrupt flag before moving on to execute the next forth word. As forth words usually comprise of other forth words this is a recursive process until the inner interpreter finds a word written in assembler. Such a word will not contain any "space" in which the inner interpreter can check for set interrupt flags. Consequently, that assembler word will always run uninterrupted. After the execution of the assembler word, there is once again "space" and the process repeats. Should an interrupt flag be set whilst the assembler word is being executed, the execution of an associated interrupt routine is deferred until after the execution of the assembler word and so is not lost.' Is my simplistic picture correct? Or can the assembler words @ ! +! indeed be interrupted from within AmForth? Best wishes, Tristan _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel