Author: wmb
Date: 2007-09-29 21:40:22 +0200 (Sat, 29 Sep 2007)
New Revision: 653
Added:
cpu/x86/pc/olpc/devsmall.fth
cpu/x86/pc/olpc/fwsmall.bth
cpu/x86/pc/olpc/smallconfig.fth
cpu/x86/small.bth
Log:
Check in experimental small-Forth build scripts to avoid losing them.
Added: cpu/x86/pc/olpc/devsmall.fth
===================================================================
--- cpu/x86/pc/olpc/devsmall.fth (rev 0)
+++ cpu/x86/pc/olpc/devsmall.fth 2007-09-29 19:40:22 UTC (rev 653)
@@ -0,0 +1,223 @@
+\ See license at end of file
+purpose: Load device drivers according to configuration definitions
+
+: gx? ( -- flag ) h# 4c000017 msr@ drop 4 rshift 2 = ;
+: lx? ( -- flag ) h# 4c000017 msr@ drop 4 rshift 3 = ;
+
+fload ${BP}/cpu/x86/pc/isaio.fth
+
+fload ${BP}/cpu/x86/pc/olpc/vsapci.fth \ PCI configuration access with some hacks
+
+0 0 " " " /" begin-package
+ fload ${BP}/cpu/x86/pc/mappci.fth \ Map PCI to root
+ fload ${BP}/dev/pcibus.fth \ Generic PCI bus package
+ fload ${BP}/cpu/x86/pc/olpc/pcinode.fth \ System-specific words for PCI
+end-package
+stand-init: PCI host bridge
+ " /pci" " init" execute-device-method drop
+;
+
+fload ${BP}/dev/pciprobe.fth \ Generic PCI probing
+
+\ Use the CPU chip's Time Stamp Counter for timing; it does just what we want
+fload ${BP}/cpu/x86/tsc.fth
+
+stand-init:
+ d# 1000 rounded-/ dup to ms-factor ( cpu-clock-khz )
+ d# 1000 rounded-/ to us-factor ( )
+;
+
+[ifdef] use-root-isa
+0 0 " " " /" begin-package
+ fload ${BP}/cpu/x86/pc/isabus.fth \ ISA Bus Bridge under root node
+end-package
+[then]
+
+[ifdef] use-pci-isa
+
+[ifdef] addresses-assigned
+[ifdef] use-pci-isa
+\ This must precede isamisc.fth in the load file, to execute it first
+fload ${BP}/cpu/x86/pc/moveisa.fth
+[then]
+[then]
+
+0 0 " 0" " /pci" begin-package
+ fload ${BP}/dev/pci/isa.fth \ ISA bus bridge under PCI node
+ fload ${BP}/dev/pci/isamisc.fth
+end-package
+
+[then]
+
+1 [if]
+dev /interrupt-controller
+h# 20 to vector-base0
+h# 28 to vector-base1
+device-end
+
+warning @ warning off
+: probe-pci ( -- )
+ probe-pci
+ " /pci" " make-interrupt-map" execute-device-method drop
+;
+warning !
+
+0 0 dropin-base <# u#s u#> " /" begin-package
+ " flash" device-name
+
+ h# 10.0000
+ dup value /device
+ constant /device-phys
+ my-address my-space /device-phys reg
+ fload ${BP}/cpu/x86/pc/flashpkg.fth
+
+ : init ( comp$ /device -- )
+ to /device 2>r
+ 0 0 encode-bytes
+ 2r> encode-string encode+
+ " rom" encode-string encode+
+ " compatible" property
+[ifdef] enable-flash-select
+ /device /device-phys <> if enable-flash-select then
+[then]
+ ;
+
+end-package
+" rom" dropin-base <# u#s " /flash@" hold$ u#> $devalias
+
+: foo-save-state here 5 + ; ' foo-save-state to save-state
+
+fload ${BP}/cpu/x86/forthint.fth \ Low-level interrupt handling code
+fload ${BP}/dev/isa/irq.fth \ ISA interrupt dispatcher
+fload ${BP}/cpu/x86/pc/isatick.fth \ Use ISA timer as the alarm tick timer
+
+[ifdef] resident-packages
+support-package: 16550
+fload ${BP}/dev/16550pkg/16550.fth \ Serial port support package
+end-support-package
+[then]
+
+fload ${BP}/dev/pci/isaall.fth
+devalias com1 /isa/serial@i3f8:115200
+devalias sd /sd/disk
+
+
+dev /8042
+ patch false ctlr-selftest open
+device-end
+
+0 [if]
+0 0 " i70" " /isa" begin-package \ Real-time clock node
+ fload ${BP}/dev/ds1385r.fth
+ 8 encode-int 0 encode-int encode+ " interrupts" property
+ 2 encode-int " device#" property
+end-package
+[then]
+
+fload ${BP}/cpu/x86/pc/cpunode.fth
+
+fload ${BP}/cpu/x86/pc/olpc/cmos.fth \ CMOS RAM indices are 1f..ff , above RTC
+
+[if] 0
+[ifdef] use-null-nvram
+fload ${BP}/cpu/x86/pc/nullnv.fth
+stand-init: Null-NVRAM
+ " /null-nvram" open-dev to nvram-node
+ ['] init-config-vars catch drop
+;
+[then]
+[then]
+
+fload ${BP}/cpu/x86/inoutstr.fth \ Multiple I/O port read/write
+fload ${BP}/dev/isa/diaguart.fth \ ISA COM port driver
+\ : inituarts ascii G uemit ascii o uemit ; \ They are already on
+
+h# 3f8 is uart-base
+fload ${BP}/forth/lib/sysuart.fth \ Use UART for key and emit
+
+[ifndef] save-flash
+: save-flash ;
+: restore-flash ;
+[then]
+
+\needs md5init fload ${BP}/ofw/ppp/md5.fth \ MD5 hash
+
+fload ${BP}/dev/olpc/kb3700/ecspi.fth \ EC chip SPI FLASH access
+
+warning @ warning off
+: stand-init stand-init h# fff0.0000 to flash-base ;
+warning !
+
+fload ${BP}/dev/olpc/kb3700/ecserial.fth \ Serial access to EC chip
+
+fload ${BP}/dev/olpc/kb3700/ecio.fth \ I/O space access to EC chip
+
+fload ${BP}/cpu/x86/pc/olpc/boardrev.fth \ Board revision decoding
+
+fload ${BP}/cpu/x86/pc/olpc/mfgdata.fth \ Manufacturing data
+
+fload ${BP}/dev/olpc/spiflash/spiflash.fth \ SPI FLASH programming
+fload ${BP}/dev/olpc/spiflash/spiui.fth \ User interface for SPI FLASH programming
+fload ${BP}/dev/olpc/spiflash/recover.fth \ XO-to-XO SPI FLASH recovery
+: ofw-fw-filename$ " disk:\boot\olpc.rom" ;
+' ofw-fw-filename$ to fw-filename$
+
+: +i encode-int encode+ ; : 0+i 0 +i ;
+
+fload ${BP}/cpu/x86/fb16-ops.fth
+fload ${BP}/ofw/termemu/fb16.fth
+0 0 " 1,1" " /pci" begin-package
+ fload ${BP}/dev/olpc/dcon/dconsmb.fth \ SMB access to DCON chip
+ fload ${BP}/dev/olpc/dcon/dcon.fth \ DCON control
+ fload ${BP}/dev/geode/display/loadpkg.fth \ Geode display
+
+ 0 0 encode-bytes
+ h# 8200.0910 +i 0+i h# fd00.0000 +i 0+i h# 0080.0000 +i \ Frame buffer
+ h# 8200.0914 +i 0+i h# fe00.0000 +i 0+i h# 0000.4000 +i \ GP
+ h# 8200.0918 +i 0+i h# fe00.4000 +i 0+i h# 0000.4000 +i \ DC
+ h# 8200.091c +i 0+i h# fe00.8000 +i 0+i h# 0000.4000 +i \ VP
+ h# 8200.0920 +i 0+i h# fe00.c000 +i 0+i h# 0000.4000 +i \ VIP (LX only)
+ " assigned-addresses" property
+
+end-package
+devalias screen /display
+
+0 0 " c,1" " /pci" begin-package
+ fload ${BP}/dev/mmc/sdhci/sdhci.fth \ SD host controller
+.( Gots to do init in sdhci.fth) cr
+ new-device
+ fload ${BP}/dev/mmc/sdhci/sdmmc.fth
+ finish-device
+end-package
+
+
+\ fload ${BP}/dev/geode/acpi.fth \ Power management
+
+[ifdef] rom-loaded
+fload ${BP}/cpu/x86/pc/olpc/gpioinit.fth
+fload ${BP}/cpu/x86/pc/olpc/chipinit.fth
+[then]
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2006 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Added: cpu/x86/pc/olpc/fwsmall.bth
===================================================================
--- cpu/x86/pc/olpc/fwsmall.bth (rev 0)
+++ cpu/x86/pc/olpc/fwsmall.bth 2007-09-29 19:40:22 UTC (rev 653)
@@ -0,0 +1,324 @@
+purpose: Build Open Firmware for OLPC
+\ See license at end of file
+
+dictionary: ${BP}/cpu/x86/build/kernel.dic
+command: &x86forth &dictionary &this
+in: builton.fth
+build-now
+
+
+fload ${BP}/cpu/x86/small.bth
+
+hex
+' $report-name is include-hook
+
+fload ${BP}/cpu/x86/pc/olpc/smallconfig.fth
+
+: headerless ; : headers ; : headerless0 ;
+
+' (quit) to quit
+
+create debug-startup
+: \Tags [compile] \ ; immediate
+: \NotTags [compile] \ ; immediate
+
+fload ${BP}/cpu/x86/pc/segments.fth \ Segment selectors (address spaces)
+
+: RAMbase ( -- adr ) fw-virt-base ;
+: RAMtop ( -- adr ) RAMbase /fw-ram + ;
+
+h# 00.0000 value dp-loc \ Set in patchboot
+: stacktop ( -- adr ) RAMtop ;
+: dict-limit ( -- adr ) RAMtop h# 06.0000 - ;
+
+\ XXX What we should do is pass in the top address in SP, and have
+\ boot.fth allocate the user area by subtracting user-size. But
+\ we need some way of finding it again for exception re-entry.
+\ prom-main-task is used in arch/pc/boot.fth . The constant
+\ value is wired into the assembly code
+stacktop user-size - constant prom-main-task \ user area for main task
+
+0 value load-limit \ Top address of area at load-base
+' 2drop to sync-cache
+
+def-load-base to load-base
+
+fload ${BP}/cpu/x86/msr.fth \ Access to machine specific registers
+
+h# 1000 to pagesize
+d# 12 to pageshift
+
+dev /
+1 encode-int " #address-cells" property
+device-end
+
+\ Memory management services
+fload ${BP}/ofw/core/memlist.fth \ Resource list common routines
+fload ${BP}/ofw/core/showlist.fth \ Linked list display tool
+fload ${BP}/ofw/core/allocph1.fth \ S Physical memory allocator
+fload ${BP}/ofw/core/availpm.fth \ Available memory list
+
+fload ${BP}/cpu/x86/pc/rootnode.fth \ Platform-specific root node changes
+
+fload ${BP}/cpu/x86/pc/olpc/gpio.fth \ Rudimentary GPIO driver
+fload ${BP}/cpu/x86/pc/olpc/probemem.fth \ Memory probing
+
+[ifdef] virtual-mode
+fload ${BP}/cpu/x86/loadvmem.fth \ /mmu node
+
+stand-init: MMU
+ " /mmu" open-dev mmu-node !
+;
+fload ${BP}/cpu/x86/pc/initdict.fth \ Dynamic dictionary allocation
+[then]
+
+fload ${BP}/cpu/x86/crc32.fth \ Assembly language Zip CRC calculation
+fload ${BP}/forth/lib/crc32.fth \ High-level portion of CRC calculation
+
+[ifdef] resident-packages
+
+[ifdef] linux-support
+support-package: ext2-file-system
+ fload ${BP}/ofw/fs/ext2fs/ext2fs.fth \ Linux file system
+end-support-package
+[then]
+
+[ifdef] jffs2-support
+support-package: jffs2-file-system
+ fload ${BP}/ofw/fs/jffs2/jffs2.fth \ Journaling flash file system 2
+end-support-package
+[then]
+
+support-package: zip-file-system
+ fload ${BP}/ofw/fs/zipfs.fth \ Zip file system
+end-support-package
+[then]
+
+\ Load file format handlers
+
+: call32 ;
+
+: release-load-area ( boundary-adr -- ) drop ;
+
+headerless
+[ifdef] virtual-mode
+: (initial-heap) ( -- adr len ) sp0 @ ps-size - dict-limit tuck - ;
+[else]
+: (initial-heap) ( -- adr len ) RAMtop heap-size ;
+[then]
+' (initial-heap) is initial-heap
+headers
+
+[ifdef] virtual-mode
+fload ${BP}/cpu/x86/pc/mmusetup.fth \ Initial values for MMU lists
+dev /mmu
+: claim-rom ( -- )
+ (initial-claim)
+ rom-pa h# ffff.0000 over - claim-virtual drop \ ROM 1-1 map
+;
+' claim-rom to initial-claim
+dend
+[then]
+
+fload ${BP}/cpu/x86/pc/olpc/devsmall.fth
+
+\ fload ${BP}/cpu/x86/pc/olpc/countdwn.fth \ Startup countdown
+
+fload ${BP}/cpu/x86/pc/boot.fth
+
+[ifdef] use-usb
+: usb-port-power-map ( -- n )
+[ifdef] lx-devel
+ h# 3ea exit \ USB4:PWR2 USB3:PWR1 USB2:PWR1 USB1:PWR1
+[then]
+ board-revision h# b10 h# b2f between if \ B1 and B2
+ h# 3ab \ USB4:PWR1 USB3:PWR1 USB2:PWR1 USB1:PWR2
+ else
+ \ A-test doesn't switch USB power, so the value doesn't matter.
+ \ preB3 and presumably later use this value
+ h# 3aa \ USB4:PWR1 USB3:PWR1 USB2:PWR1 USB1:PWR1
+ then
+;
+fload ${BP}/cpu/x86/pc/olpc/usb.fth
+[then]
+
+\ false to stand-init-debug?
+true to stand-init-debug?
+
+hex
+: i-key-wait ( ms -- pressed? )
+ cr ." Type 'i' to interrupt stand-init sequence" cr
+ 0 do
+ key? if
+ key upc ascii I = if true unloop exit then
+ then
+ 1 ms
+ loop
+ false
+;
+
+\ stand-init-debug? [if]
+warning @ warning off
+: init
+\ initial-heap add-memory
+ init
+
+ standalone? if
+ disable-interrupts
+ d# 300
+ i-key-wait if
+ ." Interacting" cr hex interact
+ then
+
+ setup
+ then
+;
+\ warning !
+[then]
+
+' noop to .firmware
+
+: probe-all ( -- )
+ probe-pci
+[ifdef] use-usb
+ probe-usb
+[then]
+;
+
+[ifdef] linux-support
+fload ${BP}/cpu/x86/pc/olpc/linux.fth
+[then]
+
+fload ${BP}/dev/null.fth
+
+[ifdef] olpc
+\ fload ${BP}/cpu/x86/pc/olpc/crypto.fth \ Cryptographic image validation
+\ fload ${BP}/cpu/x86/pc/olpc/lzip.fth \ Access zip images from memory
+\ fload ${BP}/cpu/x86/pc/olpc/security.fth
+[then]
+
+\ Eliminate 4 second delay in install console for the case where
+\ there is no keyboard. The delay is unnecessary because the screen
+\ does not go blank when the device is closed.
+patch drop ms install-console
+
+: dcon-reset-all ( -- )
+ " screen" " dcon-off" ['] execute-device-method catch if
+ 2drop 2drop
+ then
+
+ 1. h# 5140.0017 wrmsr \ DIVIL_SOFT_RESET MSR, 5536 page 367
+ begin again
+;
+' dcon-reset-all to reset-all
+
+alias reboot bye
+
+alias crcgen drop ( crc byte -- crc' )
+fload ${BP}/cpu/x86/pc/saveabs.fth
+
+\ fload ${BP}/cpu/x86/pc/report.fth
+fload ${BP}/ofw/core/dualconsole.fth
+
+0 value game-key-mask
+
+: read-game-keys ( -- )
+ board-revision h# b20 < if
+ h# 100 to game-key-mask
+ exit
+ then
+
+ game-key@ dup to game-key-mask if
+ ." Release the game key to continue" cr
+ begin d# 100 ms game-key@ 0= until
+ then
+;
+
+: interpreter-init ( -- )
+ hex
+ warning on
+ only forth also definitions
+
+ install-alarm
+
+ #line off
+
+\ .built cr
+;
+
+: console-start ( -- )
+[ifdef] rom-loaded
+ video-map cr
+[then]
+ " screen" open-dev ?dup if
+ set-stdout
+\ logo-banner drop
+\ close-dev
+\ 0 stdout !
+ then
+
+ install-dual-console
+
+\ ." nvramrc" cr
+\ use-nvramrc? if nvramrc safe-evaluate then
+;
+: optional-startup ( -- )
+[ifdef] use-usb
+ probe-usb
+ ?usb-keyboard
+[then]
+;
+
+: open-keyboard ( -- )
+ " keyboard" open-dev ?dup if set-stdin then
+;
+
+
+: startup ( -- )
+ standalone? 0= if exit then
+
+ console-start
+ read-game-keys
+ banner
+ probe-pci
+ open-keyboard
+ optional-startup
+ interpreter-init
+ \ do-update
+
+ quit
+;
+
+.( --- Saving smallfw.dic ...)
+" smallfw.dic" $save-forth cr
+
+\ patch foo decimal cold
+
+[ifndef] notdef
+.( --- Saving fw.img ...)
+" smallfw.img" RAMbase save-abs-rom cr
+[then]
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2006 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Added: cpu/x86/pc/olpc/smallconfig.fth
===================================================================
--- cpu/x86/pc/olpc/smallconfig.fth (rev 0)
+++ cpu/x86/pc/olpc/smallconfig.fth 2007-09-29 19:40:22 UTC (rev 653)
@@ -0,0 +1,77 @@
+\ See license at end of file
+purpose: Establish configuration definitions
+
+create olpc \ OLPC-specific build
+
+\ --- The environment that "boots" us ---
+\ - Image Format - Example Media - previous stage bootloader
+
+\ - OBMD format - ROM - direct boot from ROM
+create rom-loaded
+
+\ - ELF format (no pheader) - ROM - LinuxBIOS direct
+\ create linuxbios-loaded
+
+\ - Linux kernel format - USB Key w/ FAT FS - LinuxBIOS w/ stripped Linux payload
+\ create bzimage-loaded
+
+\ - ELF format w/ Multiboot signature - various - GRUB
+\ create grub-loaded
+
+\ - (Syslinux) COM32 format - USB Key w/ FAT FS - Syslinux
+\ create syslinux-loaded
+
+
+\ create virtual-mode
+create addresses-assigned \ Define if base addresses are already assigned
+\ create serial-console \ Define to default to serial port for console
+create pc
+\ create linux-support
+\ create jffs2-support
+\ create use-elf
+
+\ create use-timestamp-counter \ Use CPU's timestamp counter for timing ...
+ \ ... this is worthwhile if your CPU has one.
+
+create resident-packages
+\ create use-watch-all
+\ create use-root-isa
+create no-floppy-node
+create no-com2-node
+create no-lpt-node
+create use-pci-isa
+create basic-isa
+create isa-dma-only
+
+create use-null-nvram
+
+\ Uncomment this to compile for the LX development board
+\ It's not possible to use one ROM image for both OLPC and
+\ the LX board, because of the ROM size difference.
+\ create lx-devel \ Support for the LX development board
+
+fload ${BP}/cpu/x86/pc/olpc/addrs.fth
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2006 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Added: cpu/x86/small.bth
===================================================================
--- cpu/x86/small.bth (rev 0)
+++ cpu/x86/small.bth 2007-09-29 19:40:22 UTC (rev 653)
@@ -0,0 +1,235 @@
+\ See license at end of file
+purpose: Load file for Forth toolkit, without firmware
+
+dictionary: ${BP}/cpu/x86/build/kernel.dic
+command: &x86forth &dictionary &this
+build-now
+
+ ' noop is include-hook
+\ ' $report-name is include-hook
+\ : rn (cr 2dup type 15 spaces ; ' rn is include-hook
+
+create no-tools
+create no-heads
+create resident-packages
+
+fload ${BP}/forth/lib/fwsetup.fth
+
+: dot hex transtart . transize . there . ouser . hedge . limit . cr decimal ;
+.( after: ) dot
+
+transient
+
+\ Variables controlling inclusion of optional packages.
+
+[ifdef] no-heads
+false
+[else]
+true
+[then]
+value assembler? \ 5280 bytes
+true value forth-debug? \ 1064 bytes
+
+resident
+
+[ifndef] partial-no-heads transient [then]
+fload ${BP}/forth/lib/filetool.fth \ needed for dispose, savefort.fth
+
+\NotTags fload ${BP}/forth/lib/dispose.fth
+[ifndef] partial-no-heads resident [then]
+
+[ifndef] partial-no-heads transient [then]
+\NotTags fload ${BP}/forth/lib/headless.fth
+\NotTags fload ${BP}/forth/lib/showspac.fth
+[ifndef] partial-no-heads resident [then]
+
+fload ${BP}/forth/lib/romable.fth
+
+fload ${BP}/forth/lib/hidden.fth
+
+fload ${BP}/forth/kernel/hashcach.fth
+
+fload ${BP}/forth/lib/th.fth
+\ fload ${BP}/forth/lib/ansiterm.fth
+
+fload ${BP}/forth/kernel/splits.fth
+fload ${BP}/forth/kernel/endian.fth
+
+fload ${BP}/forth/lib/strings.fth
+fload ${BP}/forth/lib/stringop.fth
+
+fload ${BP}/forth/lib/fastspac.fth
+
+fload ${BP}/forth/lib/patch.fth
+fload ${BP}/forth/lib/cirstack.fth \ Circular stack
+\ fload ${BP}/forth/lib/pseudors.fth \ Interpretable >r and r>
+
+\ fload ${BP}/forth/lib/headtool.fth
+
+fload ${BP}/forth/lib/needs.fth
+
+\ fload ${BP}/forth/lib/suspend.fth
+alias exit? false
+
+fload ${BP}/forth/lib/util.fth
+\ fload ${BP}/forth/lib/format.fth
+: to-column ( column# -- ) drop space ;
+
+fload ${BP}/forth/lib/stringar.fth
+
+fload ${BP}/forth/lib/parses1.fth \ String parsing
+
+\ fload ${BP}/forth/lib/dump.fth
+\ fload ${BP}/forth/lib/words.fth
+\ fload ${BP}/forth/lib/decomp.fth
+
+\ Uses over-vocabulary from words.fth
+[ifndef] partial-no-heads transient [then]
+\ \NotTags fload ${BP}/forth/lib/dumphead.fth
+[ifndef] partial-no-heads resident [then]
+
+\ fload ${BP}/forth/lib/seechain.fth
+
+\ fload ${BP}/forth/lib/loadedit.fth \ Command line editor module
+
+\ fload ${BP}/forth/lib/caller.fth
+
+\ fload ${BP}/forth/lib/callfind.fth
+fload ${BP}/forth/lib/substrin.fth
+\ fload ${BP}/forth/lib/sift.fth
+
+fload ${BP}/forth/lib/array.fth
+
+fload ${BP}/forth/lib/linklist.fth \ Linked list routines
+
+fload ${BP}/forth/lib/lex.fth
+
+\ fload ${BP}/forth/lib/autold.fth \ Autoload mechanism
+
+[ifndef] partial-no-heads transient [then]
+fload ${BP}/forth/lib/initsave.fth \ Common code for save-forth et al
+fload ${BP}/forth/lib/reminder.fth \ Reminders
+[ifndef] partial-no-heads resident [then]
+
+assembler? [if]
+fload ${BP}/cpu/x86/assem.fth
+fload ${BP}/cpu/x86/code.fth
+fload ${BP}/forth/lib/loclabel.fth
+[else]
+transient fload ${BP}/cpu/x86/assem.fth resident
+fload ${BP}/cpu/x86/code.fth
+transient fload ${BP}/forth/lib/loclabel.fth resident
+[then]
+fload ${BP}/cpu/x86/asmspec.fth \ Special registers
+
+\ fload ${BP}/cpu/x86/decompm.fth
+
+
+: be-l, ( l -- ) here set-swap-bit here 4 allot be-l! ;
+
+[ifndef] partial-no-heads transient [then]
+fload ${BP}/cpu/x86/saveexp.fth
+fload ${BP}/cpu/x86/savefort.fth
+[ifndef] partial-no-heads resident [then]
+alias $save-forth $save-forth
+
+\ [ifdef] resident-packages
+\ fload ${BP}/cpu/x86/disassem.fth
+\ [else]
+\ autoload: disassem.fth
+\ defines: dis
+\ defines: +dis
+\ defines: pc!dis1
+\ [then]
+
+\ fload ${BP}/forth/lib/instdis.fth
+
+fload ${BP}/cpu/x86/objsup.fth
+fload ${BP}/forth/lib/objects.fth
+
+\ fload ${BP}/cpu/x86/cpustate.fth
+\ fload ${BP}/cpu/x86/register.fth
+
+\ fload ${BP}/forth/lib/savedstk.fth
+\ fload ${BP}/forth/lib/rstrace.fth
+\ fload ${BP}/cpu/x86/ftrace.fth
+\ fload ${BP}/cpu/x86/ctrace.fth
+\ fload ${BP}/cpu/x86/showcras.fth
+
+\ forth-debug? [if]
+\ fload ${BP}/cpu/x86/debugm.fth \ Forth debugger support
+\ fload ${BP}/forth/lib/debug.fth \ Forth debugger
+\ [then]
+
+\ start-module \ Breakpointing
+\ fload ${BP}/cpu/x86/cpubpsup.fth \ Breakpoint support
+\ fload ${BP}/forth/lib/breakpt.fth
+\ fload ${BP}/cpu/x86/Linux/catchexc.fth \ OS signal handling
+\ end-module
+
+: edit-file ( adr len maxlen -- len' ) drop nip ;
+: edit-line ( adr len maxlen -- len' ) drop nip ;
+defer light ' noop to light
+alias cancel noop
+: vsift? ( adr len voc-xt -- adr len exit? ) drop true ;
+alias .in noop
+defer .voc ' noop is .voc
+alias save-state-common noop
+defer save-state
+alias init-exceptions noop
+defer deny-history?
+alias not-dark noop
+alias (debug drop
+alias cpeek c@
+alias wpeek w@
+alias lpeek l@
+alias cpoke c!
+alias wpoke w!
+alias lpoke l!
+0 value load-base
+variable file-size
+: loaded load-base file-size @ ;
+: !load-size file-size ! ;
+defer ?inflate-loaded ' noop is ?inflate-loaded
+alias external noop
+
+\needs no-heads create no-heads
+fload ${BP}/cpu/x86/basefw.bth
+
+: reg ( phys.. size ) encode-reg " reg" property ;
+: ($callback) ( nargs name$ -- error? ) 2drop 0 ?do drop loop true ;
+: memory-test-suite ( adr len -- error? ) 2drop false ;
+: byte-load ( adr stride -- ) 2drop ;
+: model " model" string-property ;
+
+[ifndef] no-heads
+resident dispose 0 0 set-transize \ true is suppress-transient
+\ .( zeroed: ) dot
+
+' noop is include-hook ' noop is include-exit-hook
+.( --- Saving small.dic --- ) " small.dic" $save-forth cr
+[then]
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2006 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END