File:  [gforth] / gforth / kernel / main.fs
Revision 1.40: download - view: text, annotated - select for diffs
Sun Feb 10 16:46:55 2008 UTC (16 years, 2 months ago) by anton
Branches: MAIN
CVS tags: HEAD
Kernel and primitive building should now be done by a pre-installed gforth.
  configure.in and Makefile.in are now prepared for that.
  However, it does not work yet.

    1: \ MAIN.FS      Kernel main load file                   20may93jaw
    2: 
    3: \ Copyright (C) 1995,1996,1997,1998,2000,2003,2006,2007 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 3
   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, see http://www.gnu.org/licenses/.
   19: 
   20: Create mach-file here over 1+ allot place
   21: 
   22: 0 [IF]
   23: \ debugging: produce a relocation and a symbol table
   24: s" rel-table" r/w create-file throw
   25: Constant fd-relocation-table
   26: 
   27: \ debuggging: produce a symbol table
   28: s" sym-table" r/w create-file throw
   29: Constant fd-symbol-table
   30: [THEN]
   31: 
   32: 
   33: bl word vocabulary find nip 0= [IF]
   34:     \ if search order stuff is missing assume we are compiling on a gforth
   35:     \ system and include it.
   36:     \ We want the files taken from our current gforth installation
   37:     \ so we don't include relatively to this file
   38:     require ./../startup.fs
   39: [THEN]
   40: 
   41: \ include etags.fs
   42: 
   43: include ./../cross.fs              \ cross-compiler
   44: 
   45: decimal
   46: 
   47: has? rom 0= [IF]
   48:     has? kernel-start has? kernel-size makekernel
   49: [THEN]
   50:     \ create image-header
   51: has? header [IF]
   52: here 1802 over 
   53:     A,                  \ base address
   54:     0 ,                 \ checksum
   55:     0 ,                 \ image size (without tags)
   56: has? kernel-size
   57:     ,                   \ dict size
   58:     has? stack-size ,   \ data stack size
   59:     has? fstack-size ,  \ FP stack size
   60:     has? rstack-size ,  \ return stack size
   61:     has? lstack-size ,  \ locals stack size
   62:     0 A,                \ code entry point
   63:     0 A,                \ throw entry point
   64:     has? stack-size ,   \ unused (possibly tib stack size)
   65:     0 ,                 \ unused
   66:     0 ,                 \ data stack base
   67:     0 ,                 \ fp stack base
   68:     0 ,                 \ return stack base
   69:     0 ,                 \ locals stack base
   70: [THEN]
   71: 
   72: doc-off
   73: has? prims [IF]
   74:     include ./aliases.fs             \ primitive aliases
   75: [ELSE]
   76:     prims-include
   77:     undef-words
   78:     include prim.fs
   79:     all-words  
   80: [THEN]
   81: doc-on
   82: 
   83: has? header [IF]
   84: 1802 <> [IF] .s cr .( header start address expected!) cr uffz [THEN]
   85: AConstant image-header
   86: : forthstart image-header @ ;
   87: [THEN]
   88: 
   89: \ 0 AConstant forthstart
   90: 
   91: \ include ./vars.fs                  \ variables and other stuff
   92: \ include kernel/version.fs          \ is in $(build)/kernel
   93: include ./kernel.fs                  \ kernel
   94: \ include ./errore.fs
   95: include ./doers.fs
   96: has? file [IF]
   97:     include ./args.fs
   98:     include ./files.fs               \ file words
   99:     include ./paths.fs
  100:     include ./require.fs
  101: [THEN]
  102: 
  103: has? compiler [IF]
  104:     has? glocals [IF]
  105:         include ./cond.fs            \ IF and co.
  106:     [ELSE]
  107:         include ./cond-old.fs        \ IF and co. withoutlocals
  108:     [THEN]
  109:     \ these two games can be added to provide complex examples for the 4stack
  110:     \ and misc simulators (see arch/4stack/README and arch/misc/README).
  111:     has? games [IF]
  112: 	include arch/misc/tt.fs
  113: 	include arch/misc/sokoban.fs
  114:     [THEN]
  115: [THEN]
  116: include ./quotes.fs
  117: has? ec 0= [IF]
  118: include ./toolsext.fs
  119: [THEN]
  120: include ./tools.fs               \ load tools ( .s dump )
  121: include ./getdoers.fs
  122: 
  123: \ Setup                                                13feb93py
  124: 
  125: include ./pass.fs                    \ pass pointers from cross to target
  126: 
  127: has? header [IF]
  128:     \ set image size
  129:     here image-header 2 cells + !         
  130:     \ set image entry point
  131:     ' boot >body  image-header 8 cells + A!         
  132: [ELSE]
  133:     >boot
  134: [THEN]
  135: 
  136: .unresolved                          \ how did we do?

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