sandbox/misc/kforth/doc/fst83/fst83-15.txt

133 lines
3.3 KiB
Plaintext

15. THE SYSTEM EXTENSION WORD SET
15. THE SYSTEM EXTENSION WORD SET
15.1 The System Extension Word Set Layers
Nucleus layer
BRANCH ?BRANCH
Device layer
none
Interpreter layer
CONTEXT CURRENT
Compiler layer
<MARK <RESOLVE >MARK >RESOLVE
15.2 System Extension Word Set Usage
After BRANCH or ?BRANCH is compiled, >MARK or <RESOLVE is
executed. The addr left by >MARK is passed to >RESOLVE . The
addr left by <MARK is passed to <RESOLVE . For example:
: IF COMPILE ?BRANCH >MARK ; IMMEDIATE
: THEN >RESOLVE ; IMMEDIATE
50
15. THE SYSTEM EXTENSION WORD SET
15.3 The System Extension Word Set Glossary
<MARK -- addr C,83 "backward-mark"
Used at the destination of a backward branch. addr is
typically only used by <RESOLVE to compile a branch address.
<RESOLVE addr -- C,83"backward-resolve"
Used at the source of a backward branch after either BRANCH
or ?BRANCH . Compiles a branch address using addr as the
destination address.
>MARK -- addr C,83 "forward-mark"
Used at the source of a forward branch. Typically used
after either BRANCH or ?BRANCH . Compiles space in the
dictionary for a branch address which will later be resolved
by >RESOLVE .
>RESOLVE addr -- C,83"forward-resolve"
Used at the destination of a forward branch. Calculates the
branch address (to the current location in the dictionary)
using addr and places this branch address into the space
left by >MARK .
?BRANCH flag -- C,83"question-branch"
When used in the form: COMPILE ?BRANCH a conditional
branch operation is compiled. See BRANCH for further
details. When executed, if flag is false the branch is
performed as with BRANCH . When flag is true execution
continues at the compilation address immediately following
the branch address.
BRANCH -- C,83
When used in the form: COMPILE BRANCH an unconditional
branch operation is compiled. A branch address must be
compiled immediately following this compilation address.
The branch address is typically generated by following
BRANCH with <RESOLVE or >MARK .
CONTEXT -- addr U,79
The address of a variable which determines the dictionary
search order.
CURRENT -- addr U,79
The address of a variable specifying the vocabulary in which
new word definitions are appended.
51