diff --git a/build.sh b/build.sh index 47cffc8..c1fe748 100755 --- a/build.sh +++ b/build.sh @@ -1,11 +1,13 @@ #!/bin/bash cd `dirname ${0}` PLATFORM="" +ADD_OPTS="" if [ -n "${1}" -a -d "platforms/${1}" ]; then PLATFORM="${1}" + ADD_OPTS="${ADD_OPTS} -I platforms/${PLATFORM}/inc" fi export PLATFORM echo ".define PLATFORM \"${PLATFORM}\"" > platform.inc set -e -x -ca65 -I inc forth.s -l forth.lst +ca65 ${ADD_OPTS} -I inc forth.s -l forth.lst diff --git a/inc/config.inc b/inc/config.inc new file mode 100644 index 0000000..6c8e9ef --- /dev/null +++ b/inc/config.inc @@ -0,0 +1,83 @@ +; Default config.inc, used if not compiling for a specific platform or it is not found +; in the platform's inc directory. + +; Platform ports may wish to use this when copying this default config.inc +; PLATFORM_INCLUDE "platform-config.inc" + +; *** options *** + +; Set this to a nonzero value if any code will run out of bank 0. If not set, then +; numeric literals <= $0000FFFF will use the "fast literal" mode, getting on the +; stack faster and using less memory. +; Since we don't know where it will be linked as we ship, we leave this set. +.define no_fast_lits 1 + +; Set this to the size of the terminal input buffer. This will be dynamically allocated +; when the system starts. If command line history is enabled, several of these may be +; allocated at any given time. IEEE 1275 requires that it be 128 chars. +.define tib_size 128 + +; Set this to the number of bytes in the PAD. This is not required by IEEE 1275 and can +; be turned off with 0, saving a few bytes. ANSI X3J14-1994 requires at least 84 chars +; (bytes in our case) in the pad if it is present +.define pad_size $100 + +; Set this to the byte size of the WORD buffer. IEEE 1275 requires it to be (>=) 80. +; this buffer is shared with the pictured numeric output, which IEEE 1275 requires to +; be able to hold (>=) 66 characters. +.define word_buf_size 80 + +; Set this to a nonzero value to include FCode features (see IEEE 1275). This will +; cause the system size to increase by ~6K and also increase memory usage. +; The FCode evaluator supports most of the non-Device Tree FCode numbers, which can be +; added later via FCode or source in order to build an Open Firmware implementation on +; top of OF816. +.define include_fcode 1 + +; Set this to the number of word lists that may be in the search order. This number +; is required by ANSI X3J14-1994 to be 8 or greater if search order words are implemented. +; If this is set to 0, search order words are not included and about 1K is saved from +; the system size. +.define max_search_order 8 + +; IEEE 1275 specifies that certain words where interpretation semantics are not defined +; by ANSI X3J14-1994 must trigger a temporary definition outside of data space in order +; to provide interpretation semantics equivalent to what occurs in a compiled word. +; (e.g. '10 0 do i . loop' works outside of a definition) +; set this to the number of bytes allowed for such a temporary definition (512 =~ 128 +; cells). The memory used for a temporary definition is allocated from the heap, and is +; *not* bounds-checked during creation of the temporary definition. +.define max_tempdef 512 + +; SEE is a large complicated word. Omitting it saves 500 bytes. +.define include_see 1 + +; quotations are non-standard in ANS Forth and IEEE 1275, but may be useful +.define enable_quotations 1 + +; IEEE 1275 declines to identify what ENVIRONMENT? should return. ANS Forth gives +; specifics, but Forth 2012 deprecates detecting wordlists through environmental queries +; set this to 0 to include no environmental queries (ENVIRONMENT? always returns false) +; set this to 1 to include everything but the word list entries +; set this to 2 to include all of them +; note that the routines to access the environmental queries dictionary are not omitted, +; even when env_query_level is zero. As long as max_search_order is nonzero it is +; possible to add items to the environmental query dictionary +.define env_query_level 0 + +; UNALIGNED-[LW][!@] words are specified by IEEE 1275 for the user interface only (not +; FCode). In general these are redundant on the '816 because all accesses are unaligned, +; and in fact are defined as aliases to the normal versions of these. +; set this to 0 to exclude them, saving a few bytes. +.define unaligned_words 0 + +; *** debug options *** + +.define trace 0 ; requires emulator cooperation via WDM instruction +.define print_dict 0 ; output word addresses and XTs during assembly + +.if trace + .define no_headerless 1 +.else + .define no_headerless 0 ; set to 1 to compile headers for all words for debugging +.endif diff --git a/platforms/GoSXB/inc/config.inc b/platforms/GoSXB/inc/config.inc new file mode 100644 index 0000000..cdb4ce5 --- /dev/null +++ b/platforms/GoSXB/inc/config.inc @@ -0,0 +1,79 @@ +; GoSXB Configuration File + +; *** options *** + +; Set this to a nonzero value if any code will run out of bank 0. If not set, then +; numeric literals <= $0000FFFF will use the "fast literal" mode, getting on the +; stack faster and using less memory. +; GoSXB port always runs outside of bank 0 +.define no_fast_lits 0 + +; Set this to the size of the terminal input buffer. This will be dynamically allocated +; when the system starts. If command line history is enabled, several of these may be +; allocated at any given time. IEEE 1275 requires that it be 128 chars. +.define tib_size 128 + +; Set this to the number of bytes in the PAD. This is not required by IEEE 1275 and can +; be turned off with 0, saving a few bytes. ANSI X3J14-1994 requires at least 84 chars +; (bytes in our case) in the pad if it is present +.define pad_size $100 + +; Set this to the byte size of the WORD buffer. IEEE 1275 requires it to be (>=) 80. +; this buffer is shared with the pictured numeric output, which IEEE 1275 requires to +; be able to hold (>=) 66 characters. +.define word_buf_size 80 + +; Set this to a nonzero value to include FCode features (see IEEE 1275). This will +; cause the system size to increase by ~6K and also increase memory usage. +; The FCode evaluator supports most of the non-Device Tree FCode numbers, which can be +; added later via FCode or source in order to build an Open Firmware implementation on +; top of OF816. +.define include_fcode 1 + +; Set this to the number of word lists that may be in the search order. This number +; is required by ANSI X3J14-1994 to be 8 or greater if search order words are implemented. +; If this is set to 0, search order words are not included and about 1K is saved from +; the system size. +.define max_search_order 8 + +; IEEE 1275 specifies that certain words where interpretation semantics are not defined +; by ANSI X3J14-1994 must trigger a temporary definition outside of data space in order +; to provide interpretation semantics equivalent to what occurs in a compiled word. +; (e.g. '10 0 do i . loop' works outside of a definition) +; set this to the number of bytes allowed for such a temporary definition (512 =~ 128 +; cells). The memory used for a temporary definition is allocated from the heap, and is +; *not* bounds-checked during creation of the temporary definition. +.define max_tempdef 512 + +; SEE is a large complicated word. Omitting it saves 500 bytes. +.define include_see 1 + +; quotations are non-standard in ANS Forth and IEEE 1275, but may be useful +.define enable_quotations 1 + +; IEEE 1275 declines to identify what ENVIRONMENT? should return. ANS Forth gives +; specifics, but Forth 2012 deprecates detecting wordlists through environmental queries +; set this to 0 to include no environmental queries (ENVIRONMENT? always returns false) +; set this to 1 to include everything but the word list entries +; set this to 2 to include all of them +; note that the routines to access the environmental queries dictionary are not omitted, +; even when env_query_level is zero. As long as max_search_order is nonzero it is +; possible to add items to the environmental query dictionary +.define env_query_level 0 + +; UNALIGNED-[LW][!@] words are specified by IEEE 1275 for the user interface only (not +; FCode). In general these are redundant on the '816 because all accesses are unaligned, +; and in fact are defined as aliases to the normal versions of these. +; set this to 0 to exclude them, saving a few bytes. +.define unaligned_words 0 + +; *** debug options *** + +.define trace 0 ; requires emulator cooperation via WDM instruction +.define print_dict 0 ; output word addresses and XTs during assembly + +.if trace + .define no_headerless 1 +.else + .define no_headerless 0 ; set to 1 to compile headers for all words for debugging +.endif diff --git a/platforms/GoSXB/platform-config.inc b/platforms/GoSXB/platform-config.inc deleted file mode 100644 index 1b2dbd8..0000000 --- a/platforms/GoSXB/platform-config.inc +++ /dev/null @@ -1,2 +0,0 @@ -; nothing yet! - diff --git a/config.inc b/platforms/IIgs/inc/config.inc similarity index 92% rename from config.inc rename to platforms/IIgs/inc/config.inc index 1c869ae..002af46 100644 --- a/config.inc +++ b/platforms/IIgs/inc/config.inc @@ -1,17 +1,15 @@ +; Apple IIgs Configuration File + +; This platform uses it... PLATFORM_INCLUDE "platform-config.inc" ; *** options *** ; Set this to a nonzero value if any code will run out of bank 0. If not set, then ; numeric literals <= $0000FFFF will use the "fast literal" mode, getting on the -; stack faster and using less memory. This should be set in the platform-specific -; config, and will only be set here if the platform config does not set it. -.if .defined(platform_fast_lits) - .out "platform_fast_lits set by platform config or cmdline" - .define no_fast_lits 0 -.else - .define no_fast_lits 1 -.endif +; stack faster and using less memory. +; We run out of bank 0 on the IIgs, so this is set +.define no_fast_lits 1 ; Set this to the size of the terminal input buffer. This will be dynamically allocated ; when the system starts. If command line history is enabled, several of these may be diff --git a/platforms/Neon816/inc/config.inc b/platforms/Neon816/inc/config.inc new file mode 100644 index 0000000..f64ab29 --- /dev/null +++ b/platforms/Neon816/inc/config.inc @@ -0,0 +1,81 @@ +; Config file for Neon816 port + +;PLATFORM_INCLUDE "platform-config.inc" + +; *** options *** + +; Set this to a nonzero value if any code will run out of bank 0. If not set, then +; numeric literals <= $0000FFFF will use the "fast literal" mode, getting on the +; stack faster and using less memory. +; Fast literals are enabled on the Neon816 +.define no_fast_lits 0 + +; Set this to the size of the terminal input buffer. This will be dynamically allocated +; when the system starts. If command line history is enabled, several of these may be +; allocated at any given time. IEEE 1275 requires that it be 128 chars. +.define tib_size 128 + +; Set this to the number of bytes in the PAD. This is not required by IEEE 1275 and can +; be turned off with 0, saving a few bytes. ANSI X3J14-1994 requires at least 84 chars +; (bytes in our case) in the pad if it is present +.define pad_size $100 + +; Set this to the byte size of the WORD buffer. IEEE 1275 requires it to be (>=) 80. +; this buffer is shared with the pictured numeric output, which IEEE 1275 requires to +; be able to hold (>=) 66 characters. +.define word_buf_size 80 + +; Set this to a nonzero value to include FCode features (see IEEE 1275). This will +; cause the system size to increase by ~6K and also increase memory usage. +; The FCode evaluator supports most of the non-Device Tree FCode numbers, which can be +; added later via FCode or source in order to build an Open Firmware implementation on +; top of OF816. +.define include_fcode 1 + +; Set this to the number of word lists that may be in the search order. This number +; is required by ANSI X3J14-1994 to be 8 or greater if search order words are implemented. +; If this is set to 0, search order words are not included and about 1K is saved from +; the system size. +.define max_search_order 8 + +; IEEE 1275 specifies that certain words where interpretation semantics are not defined +; by ANSI X3J14-1994 must trigger a temporary definition outside of data space in order +; to provide interpretation semantics equivalent to what occurs in a compiled word. +; (e.g. '10 0 do i . loop' works outside of a definition) +; set this to the number of bytes allowed for such a temporary definition (512 =~ 128 +; cells). The memory used for a temporary definition is allocated from the heap, and is +; *not* bounds-checked during creation of the temporary definition. +.define max_tempdef 512 + +; SEE is a large complicated word. Omitting it saves 500 bytes. +.define include_see 1 + +; quotations are non-standard in ANS Forth and IEEE 1275, but may be useful +.define enable_quotations 1 + +; IEEE 1275 declines to identify what ENVIRONMENT? should return. ANS Forth gives +; specifics, but Forth 2012 deprecates detecting wordlists through environmental queries +; set this to 0 to include no environmental queries (ENVIRONMENT? always returns false) +; set this to 1 to include everything but the word list entries +; set this to 2 to include all of them +; note that the routines to access the environmental queries dictionary are not omitted, +; even when env_query_level is zero. As long as max_search_order is nonzero it is +; possible to add items to the environmental query dictionary +.define env_query_level 0 + +; UNALIGNED-[LW][!@] words are specified by IEEE 1275 for the user interface only (not +; FCode). In general these are redundant on the '816 because all accesses are unaligned, +; and in fact are defined as aliases to the normal versions of these. +; set this to 0 to exclude them, saving a few bytes. +.define unaligned_words 0 + +; *** debug options *** + +.define trace 0 ; requires emulator cooperation via WDM instruction +.define print_dict 0 ; output word addresses and XTs during assembly + +.if trace + .define no_headerless 1 +.else + .define no_headerless 0 ; set to 1 to compile headers for all words for debugging +.endif diff --git a/platforms/Neon816/platform-config.inc b/platforms/Neon816/platform-config.inc deleted file mode 100644 index 43684c5..0000000 --- a/platforms/Neon816/platform-config.inc +++ /dev/null @@ -1,2 +0,0 @@ -; nothing here yet! - diff --git a/platforms/W65C816SXB/inc/config.inc b/platforms/W65C816SXB/inc/config.inc new file mode 100644 index 0000000..0582b7b --- /dev/null +++ b/platforms/W65C816SXB/inc/config.inc @@ -0,0 +1,82 @@ +; Configuration for W65C816SXB Port + +; the W65C816SXB port uses this +PLATFORM_INCLUDE "platform-config.inc" + +; *** options *** + +; Set this to a nonzero value if any code will run out of bank 0. If not set, then +; numeric literals <= $0000FFFF will use the "fast literal" mode, getting on the +; stack faster and using less memory. +; All memory in the stock 'SXB is in bank 0, so this is set. +.define no_fast_lits 1 + +; Set this to the size of the terminal input buffer. This will be dynamically allocated +; when the system starts. If command line history is enabled, several of these may be +; allocated at any given time. IEEE 1275 requires that it be 128 chars. +.define tib_size 128 + +; Set this to the number of bytes in the PAD. This is not required by IEEE 1275 and can +; be turned off with 0, saving a few bytes. ANSI X3J14-1994 requires at least 84 chars +; (bytes in our case) in the pad if it is present +.define pad_size $100 + +; Set this to the byte size of the WORD buffer. IEEE 1275 requires it to be (>=) 80. +; this buffer is shared with the pictured numeric output, which IEEE 1275 requires to +; be able to hold (>=) 66 characters. +.define word_buf_size 80 + +; Set this to a nonzero value to include FCode features (see IEEE 1275). This will +; cause the system size to increase by ~6K and also increase memory usage. +; The FCode evaluator supports most of the non-Device Tree FCode numbers, which can be +; added later via FCode or source in order to build an Open Firmware implementation on +; top of OF816. +.define include_fcode 1 + +; Set this to the number of word lists that may be in the search order. This number +; is required by ANSI X3J14-1994 to be 8 or greater if search order words are implemented. +; If this is set to 0, search order words are not included and about 1K is saved from +; the system size. +.define max_search_order 8 + +; IEEE 1275 specifies that certain words where interpretation semantics are not defined +; by ANSI X3J14-1994 must trigger a temporary definition outside of data space in order +; to provide interpretation semantics equivalent to what occurs in a compiled word. +; (e.g. '10 0 do i . loop' works outside of a definition) +; set this to the number of bytes allowed for such a temporary definition (512 =~ 128 +; cells). The memory used for a temporary definition is allocated from the heap, and is +; *not* bounds-checked during creation of the temporary definition. +.define max_tempdef 512 + +; SEE is a large complicated word. Omitting it saves 500 bytes. +.define include_see 1 + +; quotations are non-standard in ANS Forth and IEEE 1275, but may be useful +.define enable_quotations 1 + +; IEEE 1275 declines to identify what ENVIRONMENT? should return. ANS Forth gives +; specifics, but Forth 2012 deprecates detecting wordlists through environmental queries +; set this to 0 to include no environmental queries (ENVIRONMENT? always returns false) +; set this to 1 to include everything but the word list entries +; set this to 2 to include all of them +; note that the routines to access the environmental queries dictionary are not omitted, +; even when env_query_level is zero. As long as max_search_order is nonzero it is +; possible to add items to the environmental query dictionary +.define env_query_level 0 + +; UNALIGNED-[LW][!@] words are specified by IEEE 1275 for the user interface only (not +; FCode). In general these are redundant on the '816 because all accesses are unaligned, +; and in fact are defined as aliases to the normal versions of these. +; set this to 0 to exclude them, saving a few bytes. +.define unaligned_words 0 + +; *** debug options *** + +.define trace 0 ; requires emulator cooperation via WDM instruction +.define print_dict 0 ; output word addresses and XTs during assembly + +.if trace + .define no_headerless 1 +.else + .define no_headerless 0 ; set to 1 to compile headers for all words for debugging +.endif diff --git a/platforms/W65C816SXB/platform-config.inc b/platforms/W65C816SXB/platform-config.inc index 12f6bdf..e84779c 100644 --- a/platforms/W65C816SXB/platform-config.inc +++ b/platforms/W65C816SXB/platform-config.inc @@ -1,4 +1,4 @@ -; Should we inclide the romloader in $SXB-ROMLDR +; Should we include the romloader in $SXB-ROMLDR .define romloader_as_word 0 ; Should we instead put it in the FCode to install at startup?