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 addr n — (compiling) P,C2,L0
Occurs in a colon-definition in form:
DO … LOOP
At run-time, LOOP selectively controls branching back to the corresponding DO based on the loop index and limit. The loop index is incremented by one and compared to the limit. The branch back to DO occurs until the index equals or exceeds the limit; at that time, the parameters are discarded and execution continues ahead
At compile-time. LOOP compiles (LOOP) and uses addr to calculate an offset to DO. n is used for error testing
NFA: 00738D C4 DB 0C4H
00738E 4C4F4F DB "LOO"
007391 D0 DB 'P'+80H
LFA: 007392 7C73 DW DO-5
CFA: 007394 3C28 LOOP: DW DOCOL ; :
PFA: 007396 CB67 DC6A DW THREE,QPAIR ; 3 ?PAIRS
00739A 0B6B DW COMP ; COMPILE
00739C EF21 DW XLOOP ; (LOOP)
00739E 4573 DW BACK ; BACK
0073A0 1725 DW SEMIS ; ;
xffccbcfb
NFA: 0021E6 86 DB 86H
0021E7 284C4F4F 50 DB "(LOOP"
0021EC A9 DB ')'+80H
LFA: 0021ED D021 DW ZBRAN-10
CFA: 0021EF F121 XLOOP: DW $+2
PFA: 0021F1 110100 LD DE,1
0021F4 2AFBFF XLOO1: LD HL,(RPP)
0021F7 7E LD A,(HL)
0021F8 83 ADD A,E
0021F9 77 LD (HL),A
0021FA 5F LD E,A
0021FB 23 INC HL
0021FC 7E LD A,(HL)
0021FD 8A ADC A,D
0021FE 77 LD (HL),A
0021FF 23 INC HL
002200 14 INC D
002201 15 DEC D
002202 57 LD D,A
002203 FA 0E 22 JP M,XLOO2
002206 7B LD A,E
002207 96 SUB (HL)
002208 7A LD A,D
002209 23 INC HL
00220A 9E SBC A,(HL)
00220B C3 13 22 JP XLOO3
00220E 7E XLOO2: LD A,(HL)
00220F 93 SUB E
002210 23 INC HL
002211 7E LD A,(HL)
002212 9A SBC A,D
002213 FA C4 21 XLOO3: JP M,BRAN1
002216 23 INC HL
002217 22FBFF LD (RPP),HL
00221A 03 INC BC
00221B 03 INC BC
00221C C3 E2 20 JP NEXT