1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-24 14:28:06 +11:00

Restore DOES> section in usage guide

I removed it because it was redundant with Starting Forth, but
I directly reference it in the dictionary, so well...
This commit is contained in:
Virgil Dupras 2020-05-03 20:24:54 -04:00
parent e375562a9f
commit a96b5f1dec
3 changed files with 18 additions and 2 deletions

View File

@ -12,5 +12,5 @@ Contents
4 Number literals 6 Compilation vs meta-comp.
8 Interpreter I/O 11 Signed-ness
14 Addressed devices
14 Addressed devices 17 DOES>

16
blk/017 Normal file
View File

@ -0,0 +1,16 @@
DOES>
Used inside a colon definition that itself uses CREATE, DOES>
transforms that newly created word into a "does cell", that is,
a regular cell ( when called, puts the cell's addr on PS), but
right after that, it executes words that appear after the
DOES>.
"does cells" always allocate 4 bytes (2 for the cell, 2 for the
DOES> link) and there is no need for ALLOT in colon definition.
At compile time, colon definition stops processing words when
reaching the DOES>.
Example: ": CONSTANT CREATE HERE @ ! DOES> @ ;"

View File

@ -8,7 +8,7 @@ CREATE x -- Create cell named x. Doesn't allocate a PF.
COMPILE x -- Meta compiles. See B6.
CONSTANT x n -- Creates cell x that when called pushes its
value.
DOES> -- See B4.
DOES> -- See B17.
IMMED? a -- f Checks whether wordref at a is immediate.
IMMEDIATE -- Flag the latest defined word as immediate.
LITA n -- Write address n as a literal.