Browse Source

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...
pull/102/head
Virgil Dupras 4 years ago
parent
commit
a96b5f1dec
3 changed files with 18 additions and 2 deletions
  1. +1
    -1
      blk/003
  2. +16
    -0
      blk/017
  3. +1
    -1
      blk/040

+ 1
- 1
blk/003 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
- 0
blk/017 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> @ ;"


+ 1
- 1
blk/040 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.


Loading…
Cancel
Save