forth: add word "UNTIL"
This commit is contained in:
parent
1df9c4fc1b
commit
587d1d0d69
@ -3,11 +3,12 @@
|
|||||||
: +! SWAP OVER @ + SWAP ! ;
|
: +! SWAP OVER @ + SWAP ! ;
|
||||||
: ALLOT HERE +! ;
|
: ALLOT HERE +! ;
|
||||||
: C, H C! 1 ALLOT ;
|
: C, H C! 1 ALLOT ;
|
||||||
: BEGIN H ; IMMEDIATE
|
|
||||||
: COMPILE ' ['] LITN EXECUTE ['] , , ; IMMEDIATE
|
: COMPILE ' ['] LITN EXECUTE ['] , , ; IMMEDIATE
|
||||||
|
: BEGIN H ; IMMEDIATE
|
||||||
: AGAIN COMPILE (bbr) H -^ C, ; IMMEDIATE
|
: AGAIN COMPILE (bbr) H -^ C, ; IMMEDIATE
|
||||||
|
: UNTIL COMPILE SKIP? COMPILE (bbr) H -^ C, ; IMMEDIATE
|
||||||
: NOT 1 SWAP SKIP? EXIT 0 * ;
|
: NOT 1 SWAP SKIP? EXIT 0 * ;
|
||||||
: ( BEGIN LITS ) WORD SCMP NOT SKIP? AGAIN ; IMMEDIATE
|
: ( BEGIN LITS ) WORD SCMP NOT UNTIL ; IMMEDIATE
|
||||||
( Hello, hello, krkrkrkr... do you hear me?
|
( Hello, hello, krkrkrkr... do you hear me?
|
||||||
Ah, voice at last! Some lines above need comments
|
Ah, voice at last! Some lines above need comments
|
||||||
BTW: Forth lines limited to 64 cols because of default
|
BTW: Forth lines limited to 64 cols because of default
|
||||||
|
@ -91,6 +91,7 @@ SKIP? f -- If f is true, skip the execution of the next atom.
|
|||||||
Use this right before ";" and you're gonna have a
|
Use this right before ";" and you're gonna have a
|
||||||
bad time.
|
bad time.
|
||||||
THEN I:a -- *I* Set branching cell at a.
|
THEN I:a -- *I* Set branching cell at a.
|
||||||
|
UNTIL f -- *I* Jump backwards to BEGIN if f is *false*.
|
||||||
|
|
||||||
*** Parameter Stack ***
|
*** Parameter Stack ***
|
||||||
DROP a --
|
DROP a --
|
||||||
|
Loading…
Reference in New Issue
Block a user