| 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.7
|
\ Copyright (C) 1995,2000 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 : |
|
|
\ as published by the Free Software Foundation; either version 2 |
| 12 : |
|
|
\ 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 : |
|
|
\ along with this program; if not, write to the Free Software |
| 21 : |
anton
|
1.6
|
\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. |
| 22 : |
anton
|
1.1
|
|
| 23 : |
|
|
The instruction pointer (ip) is post-incremented. |
| 24 : |
|
|
|
| 25 : |
|
|
Branches are relative: |
| 26 : |
|
|
branch |
| 27 : |
|
|
offset: target - offset |
| 28 : |
|
|
... |
| 29 : |
|
|
target: ... |
| 30 : |
|
|
|
| 31 : |
|
|
The top-of return stack is in memory |
| 32 : |
|
|
|
| 33 : |
|
|
The top of data stack need not be in memory. Other data stack items |
| 34 : |
|
|
are in memory. |
| 35 : |
|
|
|
| 36 : |
|
|
The stacks grow downward |
| 37 : |
|
|
|
| 38 : |
|
|
flags are represtented by 0 and -1 |
| 39 : |
|
|
|
| 40 : |
|
|
The loop control parameters are the index on the top of return stack |
| 41 : |
|
|
and the limit on the second item. |
| 42 : |
|
|
|
| 43 : |
|
|
Everything except the virtual machine registers (ip, sp, etc.) is |
| 44 : |
|
|
addressable. |
| 45 : |
|
|
|
| 46 : |
|
|
The return address on the return stack occupies one cell. |
| 47 : |
|
|
|
| 48 : |
|
|
There is a floating point stack |
| 49 : |
|
|
The floating point numbers are the same as C's double numbers |
| 50 : |
|
|
|
| 51 : |
|
|
The error returns of the file word set are FALSE or TRUE. (or should |
| 52 : |
|
|
we use errno? Does this work with stdio functions?) |
| 53 : |
|
|
|
| 54 : |
|
|
No assumptions can be made about the order of fetching the xt of the |
| 55 : |
|
|
next word wrt the other operations in a forth word. This makes a |
| 56 : |
|
|
difference only if you want to execute code lying on the stack or if |
| 57 : |
|
|
you store into the very next word that is executed. |