| 1 : |
anton
|
1.5
|
This file describes the implementation model of Gforth. The things |
| 2 : |
|
|
described herein are valid in all implementations of Gforth. |
| 3 : |
|
|
!! needs updating |
| 4 : |
anton
|
1.1
|
|
| 5 : |
anton
|
1.10
|
\ Copyright (C) 1995,2000,2003,2007 Free Software Foundation, Inc. |
| 6 : |
anton
|
1.5
|
|
| 7 : |
|
|
\ This file is part of Gforth. |
| 8 : |
|
|
|
| 9 : |
|
|
\ Gforth is free software; you can redistribute it and/or |
| 10 : |
|
|
\ modify it under the terms of the GNU General Public License |
| 11 : |
anton
|
1.9
|
\ as published by the Free Software Foundation, either version 3 |
| 12 : |
anton
|
1.5
|
\ of the License, or (at your option) any later version. |
| 13 : |
|
|
|
| 14 : |
|
|
\ This program is distributed in the hope that it will be useful, |
| 15 : |
|
|
\ but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 : |
|
|
\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 : |
|
|
\ GNU General Public License for more details. |
| 18 : |
|
|
|
| 19 : |
|
|
\ You should have received a copy of the GNU General Public License |
| 20 : |
anton
|
1.9
|
\ along with this program. If not, see http://www.gnu.org/licenses/. |
| 21 : |
anton
|
1.1
|
|
| 22 : |
|
|
The instruction pointer (ip) is post-incremented. |
| 23 : |
|
|
|
| 24 : |
|
|
Branches are relative: |
| 25 : |
|
|
branch |
| 26 : |
|
|
offset: target - offset |
| 27 : |
|
|
... |
| 28 : |
|
|
target: ... |
| 29 : |
|
|
|
| 30 : |
|
|
The top-of return stack is in memory |
| 31 : |
|
|
|
| 32 : |
|
|
The top of data stack need not be in memory. Other data stack items |
| 33 : |
|
|
are in memory. |
| 34 : |
|
|
|
| 35 : |
|
|
The stacks grow downward |
| 36 : |
|
|
|
| 37 : |
|
|
flags are represtented by 0 and -1 |
| 38 : |
|
|
|
| 39 : |
|
|
The loop control parameters are the index on the top of return stack |
| 40 : |
|
|
and the limit on the second item. |
| 41 : |
|
|
|
| 42 : |
|
|
Everything except the virtual machine registers (ip, sp, etc.) is |
| 43 : |
|
|
addressable. |
| 44 : |
|
|
|
| 45 : |
|
|
The return address on the return stack occupies one cell. |
| 46 : |
|
|
|
| 47 : |
|
|
There is a floating point stack |
| 48 : |
|
|
The floating point numbers are the same as C's double numbers |
| 49 : |
|
|
|
| 50 : |
|
|
The error returns of the file word set are FALSE or TRUE. (or should |
| 51 : |
|
|
we use errno? Does this work with stdio functions?) |
| 52 : |
|
|
|
| 53 : |
|
|
No assumptions can be made about the order of fetching the xt of the |
| 54 : |
|
|
next word wrt the other operations in a forth word. This makes a |
| 55 : |
|
|
difference only if you want to execute code lying on the stack or if |
| 56 : |
|
|
you store into the very next word that is executed. |