a9ac349c73fdf116ce13ae9bbf609a89fe0ebc0c
[rrq/rrqforth.git] / adoc / p_does.adoc
1 // compile.asm: WORD p_does,'DOES>',fasm,IMMEDIATE
2
3 anchor:p_does[]
4
5 === WORD: DOES>
6
7 ....
8 Data stack: ( -- )
9 ....
10
11 "DOES>" is a function that in execution mode does nothing but in
12 compilation mode it changes the execution semantics assignments for
13 the most recent word to use the +dodoes+ sematics with adjustment
14 offset to the current heap address. I.e., the word being defined will
15 have its execution start at whatever comes after "DOES>".
16
17 ====
18 .Word: DOES>
19 ----
20 : DOES> IMMEDIATE
21 STATE @ != IF ( only for compilation mode )
22   CURRENT-WORDLIST @ @ TFA>CFA    ( cfa of current word )
23     doDOES OVER !                 ( set up doer )
24     HERE @ OVER 8 + - SWAP 8 - !  ( set up offset
25   THEN
26 ;
27 ----
28 ====
29
30 See also
31 <<p_put,!>>,
32 <<p_unequal,!=>>,
33 <<p_plus,+>>,
34 <<p_minus,->>,
35 <<p_semicolon,;>>,
36 <<p_get,@>>,
37 <<p_current_wordlist,CURRENT-WORDLIST>>,
38 <<p_here,HERE>>,
39 <<p_if,IF>>,
40 <<p_immediate,IMMEDIATE>>,
41 <<p_over,OVER>>,
42 <<p_state,STATE>>,
43 <<p_swap,SWAP>>,
44 <<p_tfa2cfa,TFA>CFA>>,
45 <<p_then,THEN>>,
46 <<p_dodoes,doDOES>>,
47 as well as  <<p_execute,EXECUTE>>
48 about the range of "doer" assignments and their meanings.
49