1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-08 22:38:05 +11:00
collapseos/apps/forth/core.fth
Virgil Dupras fb54fd51af forth: implement THEN in Forth
Also, add "," and "C,"
2020-03-12 13:52:27 -04:00

13 lines
285 B
Forth

: ? @ . ;
: +! SWAP OVER @ + SWAP ! ;
: ALLOT HERE +! ;
: VARIABLE CREATE 2 ALLOT ;
: CONSTANT CREATE HERE @ ! DOES> @ ;
: , HERE @ ! 2 ALLOT ;
: C, HERE @ C! 1 ALLOT ;
: THEN DUP HERE @ SWAP - SWAP C! ; IMMEDIATE
: NOT IF 0 ELSE 1 THEN ;
: = CMP NOT ;
: < CMP 0 1 - = ;
: > CMP 1 = ;