mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-08 22:58:08 +11:00
a8e573c84a
Big one. This allows us to write higher order words directly in Forth, which is much more convenient than writing post-immediate (see "NOT" structure in diff if you want to see what I mean) structures in ASM. These structures can then be written to ROM (rather than loaded in RAM for definitions loaded at run-time). That's quite a bit of tooling that was added, 2 compilations stages, but I think it's well worth it.
10 lines
192 B
Forth
10 lines
192 B
Forth
: ? @ . ;
|
|
: +! SWAP OVER @ + SWAP ! ;
|
|
: ALLOT HERE +! ;
|
|
: VARIABLE CREATE 2 ALLOT ;
|
|
: CONSTANT CREATE HERE @ ! DOES> @ ;
|
|
: NOT IF 0 ELSE 1 THEN ;
|
|
: = CMP NOT ;
|
|
: < CMP 0 1 - = ;
|
|
: > CMP 1 = ;
|