Diff for /gforth/doc/gforth.ds between versions 1.90 and 1.91

version 1.90, 2000/11/13 22:10:31 version 1.91, 2000/11/29 22:21:57
Line 169  personal machines. This manual correspon Line 169  personal machines. This manual correspon
 * Word Index::                  An item for each Forth word  * Word Index::                  An item for each Forth word
 * Concept Index::               A menu covering many topics  * Concept Index::               A menu covering many topics
   
 @detailmenu --- The Detailed Node Listing ---  @detailmenu
    --- The Detailed Node Listing ---
   
 Gforth Environment  Gforth Environment
   
Line 313  User-defined Defining Words Line 314  User-defined Defining Words
 * CREATE..DOES> applications::    * CREATE..DOES> applications::  
 * CREATE..DOES> details::         * CREATE..DOES> details::       
 * Advanced does> usage example::    * Advanced does> usage example::  
   * @code{Const-does>}::          
   
 Interpretation and Compilation Semantics  Interpretation and Compilation Semantics
   
Line 6565  locals declarations for stack effect spe Line 6567  locals declarations for stack effect spe
 * CREATE..DOES> applications::    * CREATE..DOES> applications::  
 * CREATE..DOES> details::         * CREATE..DOES> details::       
 * Advanced does> usage example::    * Advanced does> usage example::  
   * @code{Const-does>}::          
 @end menu  @end menu
   
 @node CREATE..DOES> applications, CREATE..DOES> details, User-defined Defining Words, User-defined Defining Words  @node CREATE..DOES> applications, CREATE..DOES> details, User-defined Defining Words, User-defined Defining Words
Line 6615  DOES> ( n2 -- n1+n2 ) Line 6618  DOES> ( n2 -- n1+n2 )
 -2 curry+ 2-  -2 curry+ 2-
 @end example  @end example
   
   
 @node CREATE..DOES> details, Advanced does> usage example, CREATE..DOES> applications, User-defined Defining Words  @node CREATE..DOES> details, Advanced does> usage example, CREATE..DOES> applications, User-defined Defining Words
 @subsubsection The gory details of @code{CREATE..DOES>}  @subsubsection The gory details of @code{CREATE..DOES>}
 @cindex @code{CREATE} ... @code{DOES>}, details  @cindex @code{CREATE} ... @code{DOES>}, details
Line 6673  CREATE name EXECUTE ( ... -- ... ) Line 6677  CREATE name EXECUTE ( ... -- ... )
   
 doc->body  doc->body
   
 @node Advanced does> usage example,  , CREATE..DOES> details, User-defined Defining Words  @node Advanced does> usage example, @code{Const-does>}, CREATE..DOES> details, User-defined Defining Words
 @subsubsection Advanced does> usage example  @subsubsection Advanced does> usage example
   
 The MIPS disassembler (@file{arch/mips/disasm.fs}) contains many words  The MIPS disassembler (@file{arch/mips/disasm.fs}) contains many words
Line 6797  of parameters when using the defining wo Line 6801  of parameters when using the defining wo
 understand this, but it may improve your understanding of Forth.  understand this, but it may improve your understanding of Forth.
   
   
   @node @code{Const-does>},  , Advanced does> usage example, User-defined Defining Words
   @subsubsection @code{Const-does>}
   
   A frequent use of @code{create}...@code{does>} is for transferring some
   values from definition-time to run-time.  Gforth supports this use with
   
   doc-const-does>
   
   A typical use of this word is:
   
   @example
   : curry+ ( n1 "name" -- )
   1 0 CONST-DOES> ( n2 -- n1+n2 )
       + ;
   
   3 curry+ 3+
   @end example
   
   Here the @code{1 0} means that 1 cell and 0 floats are transferred from
   definition to run-time.
   
   The advantages of using @code{const-does>} are:
   
   @itemize
   
   @item
   You don't have to deal with storing and retrieving the values, i.e.,
   your program becomes more writable and readable.
   
   @item
   When using @code{does>}, you have to introduce a @code{@@} that cannot
   be optimized away (because you could change the data using
   @code{>body}...@code{!}); @code{const-does>} avoids this problem.
   
   @end itemize
   
   An ANS Forth implementation of @code{const-does>} is available in
   @file{compat/const-does.fs}.
   
   
 @node Deferred words, Aliases, User-defined Defining Words, Defining Words  @node Deferred words, Aliases, User-defined Defining Words, Defining Words
 @subsection Deferred words  @subsection Deferred words
 @cindex deferred words  @cindex deferred words
Line 11809  available under GPL, and originally part Line 11853  available under GPL, and originally part
 The 386 disassembler included in Gforth was written by Andrew McKewan  The 386 disassembler included in Gforth was written by Andrew McKewan
 and is in the public domain.  and is in the public domain.
   
 The disassembler displays code in prefix Intel syntax.  The disassembler displays code in an Intel-like prefix syntax.
   
 The assembler uses a postfix syntax with reversed parameters.  The assembler uses a postfix syntax with reversed parameters.
   
Line 11834  PLDQ/PLDD and PSTQ/PSTD. Line 11878  PLDQ/PLDD and PSTQ/PSTD.
   
 The registers lack the 'e' prefix; even in 32 bit mode, eax is called  The registers lack the 'e' prefix; even in 32 bit mode, eax is called
 ax.  Immediate values are indicated by postfixing them with @code{#},  ax.  Immediate values are indicated by postfixing them with @code{#},
 e.g., @code{3 #}.  Here are some examples of addressing modes:  e.g., @code{3 #}.  Here are some examples of addressing modes in various
   syntaxes:
   
 @example  @example
 3 #          \ immediate  Gforth          Intel (NASM)   AT&T (gas)      Name
 1000 #)      \ absolute  .w ax           ax             %ax             register (16 bit)
 ax           \ register  ax              eax            %eax            register (32 bit)
 100 di d)    \ 100[edi]  3 #             offset 3       $3              immediate
 4 bx cx di)  \ 4[ebx][ecx]  1000 #)         byte ptr 1000  1000            displacement
 di ax *4 i)  \ [edi][eax*4]  bx )            [ebx]          (%ebx)          base
 20 ax *4 i#) \ 20[eax*4]  100 di d)       100[edi]       100(%edi)       base+displacement
 @end example  20 ax *4 i#)    20[eax*4]      20(,%eax,4)     (index*scale)+displacement
   di ax *4 i)     [edi][eax*4]   (%edi,%eax,4)   base+(index*scale)
   4 bx cx di)     4[ebx][ecx]    4(%ebx,%ecx)    base+index+displacement
   12 sp ax *2 di) 12[esp][eax*2] 12(%esp,%eax,2) base+(index*scale)+displacement
   @end example
   
   You can use @code{L)} and @code{LI)} instead of @code{D)} and
   @code{DI)} to enforce 32-bit displacement fields (useful for
   later patching).
   
 Some example of instructions are:  Some example of instructions are:
   

Removed from v.1.90  
changed lines
  Added in v.1.91


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>