Fix test_read_file so it reads its own output (which should obviously
[rrq/jonesforth.git] / jonesforth.f
index 82642f1d0ed874154a5869c5fe8afe5599c4371f..e5718ea59f458e8dcf62b7d4b32d409161fdd28f 100644 (file)
@@ -2,7 +2,7 @@
 \      A sometimes minimal FORTH compiler and tutorial for Linux / i386 systems. -*- asm -*-
 \      By Richard W.M. Jones <rich@annexia.org> http://annexia.org/forth
 \      This is PUBLIC DOMAIN (see public domain release statement below).
 \      A sometimes minimal FORTH compiler and tutorial for Linux / i386 systems. -*- asm -*-
 \      By Richard W.M. Jones <rich@annexia.org> http://annexia.org/forth
 \      This is PUBLIC DOMAIN (see public domain release statement below).
-\      $Id: jonesforth.f,v 1.15 2007-10-11 07:39:51 rich Exp $
+\      $Id: jonesforth.f,v 1.17 2007-10-12 20:07:44 rich Exp $
 \
 \      The first part of this tutorial is in jonesforth.S.  Get if from http://annexia.org/forth
 \
 \
 \      The first part of this tutorial is in jonesforth.S.  Get if from http://annexia.org/forth
 \
 
        Notice that the parameters to DUMP (address, length) are compatible with string words
        such as WORD and S".
 
        Notice that the parameters to DUMP (address, length) are compatible with string words
        such as WORD and S".
+
+       You can dump out the raw code for the last word you defined by doing something like:
+
+               LATEST @ 128 DUMP
 )
 : DUMP         ( addr len -- )
        BASE @ ROT              ( save the current BASE at the bottom of the stack )
 )
 : DUMP         ( addr len -- )
        BASE @ ROT              ( save the current BASE at the bottom of the stack )
@@ -1705,6 +1709,10 @@ DECIMAL
 
                : C@++ INLINE DUP INLINE 1+ INLINE SWAP INLINE C@ ;CODE
 
 
                : C@++ INLINE DUP INLINE 1+ INLINE SWAP INLINE C@ ;CODE
 
+       One interesting point to note is that this "concatenative" style of programming
+       allows you to write assembler words portably.  The above definition would work
+       for any CPU architecture.
+
        There are several conditions that must be met for INLINE to be used successfully:
 
        (1) You must be currently defining an assembler word (ie. : ... ;CODE).
        There are several conditions that must be met for INLINE to be used successfully:
 
        (1) You must be currently defining an assembler word (ie. : ... ;CODE).
@@ -1734,7 +1742,7 @@ DECIMAL
 
 ( (INLINE) is the lowlevel inline function. )
 : (INLINE)     ( cfa -- )
 
 ( (INLINE) is the lowlevel inline function. )
 : (INLINE)     ( cfa -- )
-       @                       ( codeword points to the code, remember )
+       @                       ( remember codeword points to the code )
        BEGIN                   ( copy bytes until we hit NEXT macro )
                DUP =NEXT NOT
        WHILE
        BEGIN                   ( copy bytes until we hit NEXT macro )
                DUP =NEXT NOT
        WHILE