X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=reference.html;h=f49869a4eb7329644a6d974173b691fbe9fb4fd5;hb=97a4e5ecb1623dbe0fbd7b6eeb96e966c6c5b1d3;hp=f57f5c8805811feb0fa67dcb88aee1b7a7ee5d6d;hpb=c8819ee75b180664d649f542f4448122f6c4cdce;p=rrq%2Frrqforth.git diff --git a/reference.html b/reference.html index f57f5c8..f49869a 100644 --- a/reference.html +++ b/reference.html @@ -905,6 +905,8 @@ RRQFORTH executon by means of the following instruction sequence:
forthcode: +Note that the FORTH compiler does not invoke an assembler so any +inline assembly code must be provided in its binary form.
Note that the branch offset is a byte count and each FORTH word of a +definition take up a cell of 8 bytes. The offset is relative to the +cell address immediately subsequent to the offset cell. In other +words, offset 0 is not branching anywhere and an offset of -16 would +make a tight loop back to the branch instruction itself. The latter +would pull data stack values until and including the first non-zero +value.
"0=" is a function word that replaces a value with its logical complement; the result is zero if the value non-zero, and the result is non-zero if the value is zero.
Compare with NOT.
This is the same function as NOT.
Note that the branch offset is a byte count and each FORTH word of a +definition take up a cell of 8 bytes. The offset is relative to the +cell address immediately subsequent to the offset cell. In other +words, offset 0 is not branching anywhere and an offset of -16 would +make a tight loop back to the branch instruction itself. The latter +would pull data stack values until and including the first zero value.
See also :, [p_comma]. HERE, @, @@ -1253,10 +1271,6 @@ numerical base is set to 10 or 16 by DECIMAL and supported.
See also DIGITS, which holds the mapping table from digits to text.
CREATE FOO BASE
: WTELL ( tfa -- ; Print word pname )
+ 24 + DUP 8 + SWAP @ TELL SP EMIT
+;
+
+: WORDS ( wordlist -- ; Print all words of word list )
+ BEGIN
+ @ DUP 0= IFBREAK
+ DUP WTELL
+ END
+ DROP
+ NL EMIT
+;
+"[']" is an immediate function word that reads the next word on the input stream and pushes its cfa.
"BRANCH" is a function word that implements execution transfer by means of adding the subsequent branch offset to the point of execution.
Note that the branch offset is a byte count and each FORTH word of a +definition take up a cell of 8 bytes. The offset is relative to the +cell address immediately subsequent to the offset cell. In other +words, offset 0 is not branching anywhere and an offset of -16 would +make a tight loop back to the branch instruction itself. The latter +would pull data stack values until and including the first zero value.
: WTELL ( tfa -- ; Print word pname )
+ 24 + DUP 8 + SWAP @ TELL SP EMIT
+;
+
+: WORDS ( wordlist -- ; Print all words of word list )
+ BEGIN
+ @ DUP IF DUP WTELL ELSE BREAK THEN
+ 1 IFAGAIN
+ END
+ DROP
+ NL EMIT
+;
+See also doFORTH, READ-WORD, @@ -1397,10 +1468,10 @@ _______________________________________________________ HERE heap.
See also :, [p_Ccomma]. HERE, @, @@ -1422,6 +1493,7 @@ Address) of the word. The header memory layout is as follows:
struct WORD
TFA 8 link ; tfa of previous word
@@ -1448,10 +1520,10 @@ function words initiated by ":" (aka "COLON") or changed to "dovalue"
for RRQFORTH constants created by "CONSTANT".