File:  [gforth] / gforth / kernel / main.fs
Revision 1.50: download - view: text, annotated - select for diffs
Mon Dec 31 15:25:19 2012 UTC (11 years, 3 months ago) by anton
Branches: MAIN
CVS tags: HEAD
updated copyright year

    1: \ MAIN.FS      Kernel main load file                   20may93jaw
    2: 
    3: \ Copyright (C) 1995,1996,1997,1998,2000,2003,2006,2007,2008,2011,2012 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: parse-name vocabulary find-name 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,                \ boot entry point
   63:     0 A,                \ throw entry point
   64:     0 A,                \ quit entry point
   65:     0 A,                \ execute entry point
   66:     0 A,                \ find entry point
   67:     0 ,                 \ base of DOUBLE_INDIRECT xts[], for comp-i.fs
   68: [THEN]
   69: 
   70: doc-off
   71: has? prims [IF]
   72:     include ./aliases.fs             \ primitive aliases
   73: [ELSE]
   74:     prims-include
   75:     undef-words
   76:     include prim.fs
   77:     all-words  
   78: [THEN]
   79: doc-on
   80: 
   81: has? header [IF]
   82: 1802 <> [IF] .s cr .( header start address expected!) cr uffz [THEN]
   83: AConstant image-header
   84: : forthstart image-header @ ;
   85: [THEN]
   86: 
   87: \ 0 AConstant forthstart
   88: 
   89: \ include ./vars.fs                  \ variables and other stuff
   90: \ include kernel/version.fs          \ is in $(build)/kernel
   91: include ./kernel.fs                  \ kernel
   92: \ include ./errore.fs
   93: include ./doers.fs
   94: has? file [IF]
   95:     include ./args.fs
   96:     include ./files.fs               \ file words
   97:     include ./paths.fs
   98:     include ./require.fs
   99: [THEN]
  100: 
  101: has? compiler [IF]
  102:     has? glocals [IF]
  103:         include ./cond.fs            \ IF and co.
  104:     [ELSE]
  105:         include ./cond-old.fs        \ IF and co. withoutlocals
  106:     [THEN]
  107:     \ these two games can be added to provide complex examples for the 4stack
  108:     \ and misc simulators (see arch/4stack/README and arch/misc/README).
  109:     has? games [IF]
  110: 	include arch/misc/tt.fs
  111:         \ disabled, as cross-compilation support seems broken currently:
  112:         include arch/misc/sokoban.fs
  113:     [THEN]
  114: [THEN]
  115: include ./quotes.fs
  116: has? ec 0= [IF]
  117: include ./toolsext.fs
  118: [THEN]
  119: include ./tools.fs               \ load tools ( .s dump )
  120: include ./getdoers.fs
  121: 
  122: \ Setup                                                13feb93py
  123: 
  124: include ./pass.fs                    \ pass pointers from cross to target
  125: 
  126: has? header [IF]
  127:     \ set image size
  128:     here image-header 2 cells + !         
  129:     ." set image entry point" cr
  130:     ' boot       >body  image-header #08 cells + A!
  131:     ' quit       >body  image-header #10 cells + A!
  132:     ' do-execute >body  image-header #11 cells + A!
  133:     ' do-find    >body  image-header #12 cells + A!
  134: [ELSE]
  135:     >boot
  136: [THEN]
  137: 
  138: .unresolved                          \ how did we do?

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