X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=adoc%2Fp_literal.adoc;h=5a50f2d5ab3fb7f0807c637a078862e441e1a799;hb=9b8fcf87eaed58b6dfabcf885f8eef5484643de6;hp=b469880fdeac41b629c6d6052e0b0a99cfdb020c;hpb=b7da3f7bbd1cb10241163abdb950472e539e796d;p=rrq%2Frrqforth.git diff --git a/adoc/p_literal.adoc b/adoc/p_literal.adoc index b469880..5a50f2d 100644 --- a/adoc/p_literal.adoc +++ b/adoc/p_literal.adoc @@ -1,30 +1,26 @@ -Word: LIT ---------- +// compile.asm: WORD p_literal,'LIT',fasm anchor:p_literal[] ----- -compile.asm: WORD p_literal,'LIT',fasm ----- -Data stack: compiling ( v -- ) interpreting ( -- v ) +=== Word: LIT -"LIT" is a function word for, in compiling mode, creating a literal -value the gets pushed in interpreting mode. In compiling mode, it a -lays out its own CFA pointer, then grabs the current stack value onto -the heap. In interpreting mode it recreates the value onto the stack. +.... +Data stack: ( -- v ) +.... -Note that the value is layed out as if a subsequent CFA poitnter in -the containing definition, but the LIT execution will make the -execution skip past that and instead contine with the CFA pointer -folling the value. +"LIT" is a function word that pushes the cell subsequent and moves +excution past that. The literal value is thus layed out as if a +subsequent CFA pointer in the containing definition, and the LIT +execution will make the execution skip past that and instead contine +with the CFA pointer following the value. It's not a good idea to use "LIT" interactively. -.Execution semantics expressed in RRQFORTH ==== -: LIT IMMEDIATE - STATE @ IF p_literal , ELSE R> DUP 8 + >R @ THEN -; +.Definition concept for LIT +**** +: LIT R> DUP 8 + >R @ ; +**** ====