figForth Word - +LOOP
Some parts of this page/site are currently incomplete & will be updated asap
Other parts will change continually so use “Refresh” in your browser !!
There is extensive use of “Tooltips” text to support learning which do
not seem to render on a Smartphone
+LOOP n1 — (run) addr n2 — (compile) P,C2
Used in a colon-definition in the form:
DO … n1 +LOOP
At run-time, +LOOP selectively controls branching back to the corresponding DO based on n1, the loop index and the loop limit. The signed increment n1 is added to the index and the total compared to the limit.
The branch back to DO occurs until the new index is equal to or greater than the limit (n1>0), or until the new index is equal to or less than the limit (n1<0). Upon exiting the loop, the parameters are discarded and execution continues ahead.
At compile time, +LOOP compiles the run-time word (+LOOP) and the branch offset computed from HERE to the address left on the stack by DO. n2 is used for compile tine error checking
0073A2 C5 B 3247 DB 0C5H 0073A3 2B4C4F4F B 3248 DB “+LOO” 0073A7 D0 B 3249 DB ‘P’+80H 0073A8 8D73 B 3250 DW LOOP-7 0073AA 3C28 B 3251 PLOOP: DW DOCOL 0073AC CB67 DC6A B 3252 DW THREE,QPAIR ; 3 ?PAIRS 0073B0 0B6B B 3253 DW COMP ; COMPILE 0073B2 2922 B 3254 DW XPLOO ; (+LOOP) 0073B4 4573 B 3255 DW BACK ; BACK 0073B6 1725 B 3256 DW SEMIS