X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=control.asm;h=81c4c724e384bcaa6b1ae1d3035619c8c6feae4b;hb=57e9b9cc817399bf2d27601e6a4d841ba2318c8c;hp=f46d7d4e552e97336a6b2c0a516611b3e40892ca;hpb=bf67023324b2a0c5723dd3167ef757209ba62e01;p=rrq%2Frrqforth.git diff --git a/control.asm b/control.asm index f46d7d4..81c4c72 100644 --- a/control.asm +++ b/control.asm @@ -146,17 +146,18 @@ p_ifagain_resolve: ;; Resolves all open branches for the preceding BEGIN and ;; optional several IFBREAK mov rax,rsp +p_end_scan: cmp qword [rax],0 je p_end_resolve add rax,8 - jmp p_end_DFA + jmp p_end_scan p_end_resolve: mov rax,qword [rax+8] ; address of BEGIN p_end_next: pop rbx cmp rbx,0 je p_end_ending - mov rcx,rax + mov rcx,qword [p_here_DFA] sub rcx,rbx mov qword [rbx-8],rcx jmp p_end_next @@ -164,4 +165,22 @@ p_end_ending: pop rbx next - + WORD p_again,'AGAIN',fasm,IMMEDIATE + ;; Compiling: ( a 0 * -- ) + ;; Lay out unconditional loop-back, then perform END action + mov rax,qword [p_here_DFA] + mov qword [rax],p_branch_CFA + mov qword [rax+8],0 + add rax,16 + mov qword [p_here_DFA],rax + mov rbx,rsp +p_again_loop: + cmp qword [rbx],0 + je p_again_resolve + add rbx,8 + jmp p_again_loop +p_again_resolve: + mov rbx,qword [rbx+8] + sub rbx,rax + mov qword [rax-8],rbx + jmp p_end_DFA