// compile.asm: WORD p_create,'CREATE',fasm anchor:p_create[] === Word: CREATE .... Data stack: ( char* n -- tfa ) .... "CREATE" is a function word that allocates a "word header" with the indicated [n:char*] print name, and returns the "TFA" (Token Field Address) of the word. The header memory layout is as follows: ==== .rrqforth word structure [caption='Layout {counter:layout}: '] ---- struct WORD TFA 8 link ; tfa of previous word pCFA 8 cfap ; CFA = Code Field Address of this word 8 flags ; PFA 8 length ; length of pname representation ? pname ; the pname bytes 1 nul ; a forced nul byte following the pname pTFA 8 tfap ; TFA = Token Field Address of this word OFF 8 doff ; entry offset for FORTH level execution CFA 8 doer ; word execution semantics DFA 0 content ; DFA = Data Field Address end_struct ---- ==== A "word" is generally understod as a marker in memory for some content as held in the memory space following the DFA (Data Field Address). The words CFA (Code Field Address) is the most important field for RRQFORTH execution, as holding a jump address to the assembly code that implements the particular execution semantics for the word. "CREATE" will assign this as "dovariable", which makes the word push its DFA when executed. This is changed to "doforth" for RRQFORTH function words initiated by ":" (aka "COLON") or changed to "dovalue" for RRQFORTH constants created by "CONSTANT". ==== .Definition concept for CREATE **** HERE @ R> ( save tfa on RS ) R@ CURRENT-WORD @ DUP @ , ! ( link in a new word ) DUP 49 + R@ + , ( pCFA ) 0 , ( flags ) DUP , ( length ) HERE @ ROT ROT MEMCPY 0 C, ( pname + NUL ) R@ , ( pTFA ) 0 , ( OFF ) doVARIABLE ( CFA, default semantics ) **** ==== ==== .a possible definition of CONSTANT [caption='Usage example {counter:example}: '] ---- : CONSTANT READ-WORD CREATE TFA>DFA doVALUE OVER 8 - ! ! ; ---- ==== See also <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, and <>, as well as <> about the range of "doer" assignments and their meanings.