d60ea4cb30
This comes with RS-modifying words. Also, this commit separates ";" from "EXIT", allowing EXIT to be used in definitions (was needed for RECURSE).
18 lines
417 B
Forth
18 lines
417 B
Forth
: H HERE @ ;
|
|
: -^ SWAP - ;
|
|
: ? @ . ;
|
|
: +! SWAP OVER @ + SWAP ! ;
|
|
: ALLOT HERE +! ;
|
|
: VARIABLE CREATE 2 ALLOT ;
|
|
: CONSTANT CREATE H ! DOES> @ ;
|
|
: , H ! 2 ALLOT ;
|
|
: C, H C! 1 ALLOT ;
|
|
: IF ['] (fbr?) , H 0 C, ; IMMEDIATE
|
|
: THEN DUP H -^ SWAP C! ; IMMEDIATE
|
|
: ELSE ['] (fbr) , 0 C, DUP H -^ SWAP C! H 1 - ; IMMEDIATE
|
|
: NOT IF 0 ELSE 1 THEN ;
|
|
: = CMP NOT ;
|
|
: < CMP 0 1 - = ;
|
|
: > CMP 1 = ;
|
|
: RECURSE R> R> 2 - >R >R EXIT ;
|