File:  [gforth] / gforth / kernel / main.fs
Revision 1.25: download - view: text, annotated - select for diffs
Sun Sep 16 19:14:23 2001 UTC (22 years, 7 months ago) by pazsan
Branches: MAIN
CVS tags: HEAD
Put full featured startup.fs into main.fs, so that both BUILD-FROM-SCRATCH
and a build based on kernl*.fi can expect the same extensions.

    1: \ MAIN.FS      Kernel main load file                   20may93jaw
    2: 
    3: \ Copyright (C) 1995,1996,1997,1998,2000 Free Software Foundation, Inc.
    4: 
    5: \ This file is part of Gforth.
    6: 
    7: \ Gforth is free software; you can redistribute it and/or
    8: \ modify it under the terms of the GNU General Public License
    9: \ as published by the Free Software Foundation; either version 2
   10: \ of the License, or (at your option) any later version.
   11: 
   12: \ This program is distributed in the hope that it will be useful,
   13: \ but WITHOUT ANY WARRANTY; without even the implied warranty of
   14: \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   15: \ GNU General Public License for more details.
   16: 
   17: \ You should have received a copy of the GNU General Public License
   18: \ along with this program; if not, write to the Free Software
   19: \ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
   20: 
   21: Create mach-file here over 1+ allot place
   22: 
   23: 0 [IF]
   24: \ debugging: produce a relocation and a symbol table
   25: s" rel-table" r/w create-file throw
   26: Constant fd-relocation-table
   27: 
   28: \ debuggging: produce a symbol table
   29: s" sym-table" r/w create-file throw
   30: Constant fd-symbol-table
   31: [THEN]
   32: 
   33: 
   34: bl word vocabulary find nip 0= [IF]
   35:     \ if search order stuff is missing assume we are compiling on a gforth
   36:     \ system and include it.
   37:     \ We want the files taken from our current gforth installation
   38:     \ so we don't include relatively to this file
   39:     require startup.fs
   40: [THEN]
   41: 
   42: \ include etags.fs
   43: 
   44: include ./../cross.fs              \ cross-compiler
   45: 
   46: decimal
   47: 
   48: has? kernel-size makekernel
   49: \ create image-header
   50: has? header [IF]
   51: here dup 
   52:     A,                  \ base address
   53:     0 ,                 \ checksum
   54:     0 ,                 \ image size (without tags)
   55: has? kernel-size
   56:     ,                   \ dict size
   57:     has? stack-size ,   \ data stack size
   58:     has? fstack-size ,  \ FP stack size
   59:     has? rstack-size ,  \ return stack size
   60:     has? lstack-size ,  \ locals stack size
   61:     0 A,                \ code entry point
   62:     0 A,                \ throw entry point
   63:     has? stack-size ,   \ unused (possibly tib stack size)
   64:     0 ,                 \ unused
   65:     0 ,                 \ data stack base
   66:     0 ,                 \ fp stack base
   67:     0 ,                 \ return stack base
   68:     0 ,                 \ locals stack base
   69: AConstant image-header
   70: : forthstart image-header @ ;
   71: [THEN]
   72: 
   73: doc-off
   74: has? prims [IF]
   75:     include ./aliases.fs             \ primitive aliases
   76: [ELSE]
   77:     prims-include
   78:     undef-words
   79:     include prim.fs
   80:     all-words  
   81: [THEN]
   82: doc-on
   83: 
   84: \ 0 AConstant forthstart
   85: 
   86: \ include ./vars.fs                  \ variables and other stuff
   87: \ include kernel/version.fs          \ is in $(build)/kernel
   88: include ./kernel.fs                  \ kernel
   89: \ include ./errore.fs
   90: include ./doers.fs
   91: has? file [IF]
   92:     include ./args.fs
   93:     include ./files.fs               \ file words
   94:     include ./paths.fs
   95:     include ./require.fs
   96: [THEN]
   97: 
   98: has? compiler [IF]
   99:     has? glocals [IF]
  100:         include ./cond.fs            \ IF and co.
  101:     [ELSE]
  102:         include ./cond-old.fs        \ IF and co. withoutlocals
  103:     [THEN]
  104:     \ these two games can be added to provide complex examples for the 4stack
  105:     \ and misc simulators (see arch/4stack/README and arch/misc/README).
  106:     \ include arch/misc/tt.fs
  107:     \ include arch/misc/sokoban.fs
  108: [THEN]
  109: include ./quotes.fs
  110: include ./toolsext.fs
  111: include ./tools.fs               \ load tools ( .s dump )
  112: include ./getdoers.fs
  113: 
  114: \ Setup                                                13feb93py
  115: 
  116: has? header [IF]
  117:     \ set image size
  118:     here image-header 2 cells + !         
  119:     \ set image entry point
  120:     ' boot >body  image-header 8 cells + A!         
  121: [ELSE]
  122:     >boot
  123: [THEN]
  124: 
  125: include ./pass.fs                    \ pass pointers from cross to target
  126: 
  127: .unresolved                          \ how did we do?

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