diff --git a/Makefile b/Makefile index c4ec4e0c..300eafd0 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ SRC_TOOLS = $(wildcard tools/*.c,tools/*.cc) # Generated files -GEN_BASIC = build/,generated/packed_strings.s build/,generated/float_constants.s +GEN_BASIC = build/,generated/float_constants.s GEN_KERNAL = # List of build directories @@ -78,10 +78,19 @@ CFG_M65 = c64/,,config_mega65.s CFG_U64 = c64/,,config_ultimate64.s CFG_X16 = c64/,,config_cx16.s +# List of files with generated strings + +GEN_STR_CUS = $(DIR_CUS)/,generated/packed_strings.s +GEN_STR_GEN = $(DIR_GEN)/,generated/packed_strings.s +GEN_STR_TST = $(DIR_TST)/,generated/packed_strings.s +GEN_STR_M65 = $(DIR_M65)/,generated/packed_strings.s +GEN_STR_U64 = $(DIR_U64)/,generated/packed_strings.s +GEN_STR_X16 = $(DIR_X16)/,generated/packed_strings.s + # Dependencies - helper variables -DEP_BASIC = $(SRC_BASIC) $(SRCDIR_BASIC) $(GEN_BASIC) -DEP_KERNAL = $(SRC_KERNAL) $(SRCDIR_KERNAL) $(GEN_KERNAL) +DEP_BASIC = $(SRC_BASIC) $(SRCDIR_BASIC) $(GEN_BASIC) +DEP_KERNAL = $(SRC_KERNAL) $(SRCDIR_KERNAL) $(GEN_KERNAL) # List of tools @@ -196,42 +205,42 @@ build/chargen_pxlfont.patched: $(TOOL_PATCH_CHARGEN) build/chargen_pxlfont.rom # Dependencies - BASIC and KERNAL $(DIR_CUS)/OUTB_x.BIN $(DIR_CUS)/BASIC_combined.vs: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_CUS) $(DIR_CUS)/KERNAL_combined.sym + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_CUS) $(GEN_STR_CUS) $(DIR_CUS)/KERNAL_combined.sym $(DIR_GEN)/OUTB_x.BIN $(DIR_GEN)/BASIC_combined.vs: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_GEN) $(DIR_GEN)/KERNAL_combined.sym + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_GEN) $(GEN_STR_GEN) $(DIR_GEN)/KERNAL_combined.sym $(DIR_TST)/OUTB_x.BIN $(DIR_TST)/BASIC_combined.vs: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_TST) $(DIR_TST)/KERNAL_combined.sym + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_TST) $(GEN_STR_TST) $(DIR_TST)/KERNAL_combined.sym $(DIR_U64)/OUTB_x.BIN $(DIR_U64)/BASIC_combined.vs: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_U64) $(DIR_U64)/KERNAL_combined.sym + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_U64) $(GEN_STR_U64) $(DIR_U64)/KERNAL_combined.sym $(DIR_CUS)/OUTK_x.BIN $(DIR_CUS)/KERNAL_combined.vs $(DIR_CUS)/KERNAL_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_CUS) + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_CUS) $(GEN_STR_CUS) $(DIR_GEN)/OUTK_x.BIN $(DIR_GEN)/KERNAL_combined.vs $(DIR_GEN)/KERNAL_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_GEN) + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_GEN) $(GEN_STR_GEN) $(DIR_TST)/OUTK_x.BIN $(DIR_TST)/KERNAL_combined.vs $(DIR_TST)/KERNAL_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_TST) + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_TST) $(GEN_STR_TST) $(DIR_U64)/OUTK_x.BIN $(DIR_U64)/KERNAL_combined.vs $(DIR_U64)/KERNAL_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_U64) + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_U64) $(GEN_STR_U64) $(DIR_M65)/OUTB_0.BIN $(DIR_M65)/BASIC_0_combined.vs $(DIR_M65)/BASIC_0_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_M65) $(DIR_M65)/KERNAL_0_combined.sym + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_M65) $(GEN_STR_M65) $(DIR_M65)/KERNAL_0_combined.sym $(DIR_M65)/OUTK_0.BIN $(DIR_M65)/KERNAL_0_combined.vs $(DIR_M65)/KERNAL_0_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_M65) + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_M65) $(GEN_STR_M65) $(DIR_X16)/OUTB_0.BIN $(DIR_X16)/BASIC_0_combined.vs $(DIR_X16)/BASIC_0_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_X16) $(DIR_X16)/KERNAL_0_combined.sym + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_X16) $(GEN_STR_X16) $(DIR_X16)/KERNAL_0_combined.sym $(DIR_X16)/OUTK_0.BIN $(DIR_X16)/KERNAL_0_combined.vs $(DIR_X16)/KERNAL_0_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_X16) + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_X16) $(GEN_STR_X16) $(DIR_M65)/basic.seg_1 $(DIR_M65)/BASIC_1_combined.vs $(DIR_M65)/BASIC_1_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_M65) $(DIR_M65)/KERNAL_0_combined.sym $(DIR_M65)/BASIC_0_combined.sym + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_M65) $(GEN_STR_M65) $(DIR_M65)/KERNAL_0_combined.sym $(DIR_M65)/BASIC_0_combined.sym $(DIR_M65)/kernal.seg_1 $(DIR_M65)/KERNAL_1_combined.vs $(DIR_M65)/KERNAL_1_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_M65) $(DIR_M65)/KERNAL_0_combined.sym + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_M65) $(GEN_STR_M65) $(DIR_M65)/KERNAL_0_combined.sym $(DIR_X16)/basic.seg_1 $(DIR_X16)/BASIC_1_combined.vs $(DIR_X16)/BASIC_1_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_X16) $(DIR_X16)/KERNAL_0_combined.sym $(DIR_X16)/BASIC_0_combined.sym + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_X16) $(GEN_STR_X16) $(DIR_X16)/KERNAL_0_combined.sym $(DIR_X16)/BASIC_0_combined.sym $(DIR_X16)/kernal.seg_1 $(DIR_X16)/KERNAL_1_combined.vs $(DIR_X16)/KERNAL_1_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_X16) $(DIR_X16)/KERNAL_0_combined.sym + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_X16) $(GEN_STR_X16) $(DIR_X16)/KERNAL_0_combined.sym $(DIR_CUS)/OUTx_x.BIN: $(DIR_CUS)/OUTB_x.BIN $(DIR_CUS)/OUTK_x.BIN $(DIR_GEN)/OUTx_x.BIN: $(DIR_GEN)/OUTB_x.BIN $(DIR_GEN)/OUTK_x.BIN @@ -257,69 +266,96 @@ build/symbols_ultimate64.vs: $(DIR_U64)/BASIC_combined.vs $(DIR_U64)/KER # Rules - BASIC and KERNAL intermediate files -build/,generated/packed_strings.s: $(TOOL_GENERATE_STRINGS) - @mkdir -p build/,generated - $(TOOL_GENERATE_STRINGS) -o build/,generated/packed_strings.s +$(GEN_STR_CUS): $(TOOL_GENERATE_STRINGS) $(CFG_CUS) + @mkdir -p $(DIR_CUS)/,generated + $(TOOL_GENERATE_STRINGS) -o $@ -c $(CFG_CUS) + +$(GEN_STR_GEN): $(TOOL_GENERATE_STRINGS) $(CFG_GEN) + @mkdir -p $(DIR_GEN)/,generated + $(TOOL_GENERATE_STRINGS) -o $@ -c $(CFG_GEN) + +$(GEN_STR_TST): $(TOOL_GENERATE_STRINGS) $(CFG_TST) + @mkdir -p $(DIR_TST)/,generated + $(TOOL_GENERATE_STRINGS) -o $@ -c $(CFG_TST) + +$(GEN_STR_M65): $(TOOL_GENERATE_STRINGS) $(CFG_M65) + @mkdir -p $(DIR_M65)/,generated + $(TOOL_GENERATE_STRINGS) -o $@ -c $(CFG_M65) + +$(GEN_STR_U64): $(TOOL_GENERATE_STRINGS) $(CFG_U64) + @mkdir -p $(DIR_U64)/,generated + $(TOOL_GENERATE_STRINGS) -o $@ -c $(CFG_U64) + +$(GEN_STR_X16): $(TOOL_GENERATE_STRINGS) $(CFG_X16) + @mkdir -p $(DIR_X16)/,generated + $(TOOL_GENERATE_STRINGS) -o $@ -c $(CFG_X16) build/,generated/float_constants.s: $(TOOL_GENERATE_CONSTANTS) @mkdir -p build/,generated $(TOOL_GENERATE_CONSTANTS) -o build/,generated/float_constants.s +GEN_STR_custom = $(GEN_STR_CUS) +GEN_STR_generic = $(GEN_STR_GEN) +GEN_STR_testing = $(GEN_STR_TST) +GEN_STR_mega65 = $(GEN_STR_M65) +GEN_STR_ultimate64 = $(GEN_STR_U64) +GEN_STR_cx16 = $(GEN_STR_X16) + .PRECIOUS: build/target_%/OUTB_x.BIN build/target_%/BASIC_combined.vs build/target_%/OUTB_x.BIN build/target_%/BASIC_combined.vs: @mkdir -p build/target_$* @rm -f $@* build/target_$*/BASIC* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r STD -s BASIC -i BASIC-$* -o OUTB_x.BIN -d build/target_$* -l a000 -h e4d2 c64/,,config_$*.s $(SRCDIR_BASIC) $(GEN_BASIC) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r STD -s BASIC -i BASIC-$* -o OUTB_x.BIN -d build/target_$* -l a000 -h e4d2 c64/,,config_$*.s $(SRCDIR_BASIC) $(GEN_BASIC) $(GEN_STR_$*) .PRECIOUS: build/target_%/OUTK_x.BIN build/target_%/KERNAL_combined.vs build/target_%/KERNAL_combined.sym build/target_%/OUTK_x.BIN build/target_%/KERNAL_combined.vs build/target_%/KERNAL_combined.sym: @mkdir -p build/target_$* @rm -f $@* build/target_$*/KERNAL* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r STD -s KERNAL -i KERNAL-$* -o OUTK_x.BIN -d build/target_$* -l e4d3 -h ffff c64/,,config_$*.s $(SRCDIR_KERNAL) $(GEN_KERNAL) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r STD -s KERNAL -i KERNAL-$* -o OUTK_x.BIN -d build/target_$* -l e4d3 -h ffff c64/,,config_$*.s $(SRCDIR_KERNAL) $(GEN_KERNAL) $(GEN_STR_$*) # Rules - BASIC and KERNAL intermediate files, for Mega65 $(DIR_M65)/OUTB_0.BIN $(DIR_M65)/BASIC_0_combined.vs $(DIR_M65)/BASIC_0_combined.sym: @mkdir -p $(DIR_M65) @rm -f $@* $(DIR_M65)/BASIC_0* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r M65 -s BASIC_0 -i BASIC_0-mega65 -o OUTB_0.BIN -d $(DIR_M65) -l a000 -h e4d2 $(CFG_M65) $(SRCDIR_BASIC) $(GEN_BASIC) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r M65 -s BASIC_0 -i BASIC_0-mega65 -o OUTB_0.BIN -d $(DIR_M65) -l a000 -h e4d2 $(CFG_M65) $(GEN_STR_M65) $(SRCDIR_BASIC) $(GEN_BASIC) $(DIR_M65)/OUTK_0.BIN $(DIR_M65)/KERNAL_0_combined.vs $(DIR_M65)/KERNAL_0_combined.sym: @mkdir -p $(DIR_M65) @rm -f $@* $(DIR_M65)/KERNAL_0* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r M65 -s KERNAL_0 -i KERNAL_0-mega65 -o OUTK_0.BIN -d $(DIR_M65) -l e4d3 -h ffff $(CFG_M65) $(SRCDIR_KERNAL) $(GEN_KERNAL) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r M65 -s KERNAL_0 -i KERNAL_0-mega65 -o OUTK_0.BIN -d $(DIR_M65) -l e4d3 -h ffff $(CFG_M65) $(GEN_STR_M65) $(SRCDIR_KERNAL) $(GEN_KERNAL) $(DIR_M65)/basic.seg_1 $(DIR_M65)/BASIC_1_combined.vs $(DIR_M65)/BASIC_1_combined.sym: @mkdir -p $(DIR_M65) @rm -f $@* $(DIR_M65)/basic.seg_1 $(DIR_M65)/BASIC_1* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r M65 -s BASIC_1 -i BASIC_1-mega65 -o basic.seg_1 -d $(DIR_M65) -l 4000 -h 5fff $(CFG_M65) $(SRCDIR_BASIC) $(GEN_BASIC) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r M65 -s BASIC_1 -i BASIC_1-mega65 -o basic.seg_1 -d $(DIR_M65) -l 4000 -h 5fff $(CFG_M65) $(GEN_STR_M65) $(SRCDIR_BASIC) $(GEN_BASIC) $(DIR_M65)/kernal.seg_1 $(DIR_M65)/KERNAL_1_combined.vs $(DIR_M65)/KERNAL_1_combined.sym: @mkdir -p $(DIR_M65) @rm -f $@* $(DIR_M65)/kernal.seg_1 $(DIR_M65)/KERNAL_1* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r M65 -s KERNAL_1 -i KERNAL_1-mega65 -o kernal.seg_1 -d $(DIR_M65) -l 4000 -h 5fff $(CFG_M65) $(SRCDIR_KERNAL) $(GEN_KERNAL) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r M65 -s KERNAL_1 -i KERNAL_1-mega65 -o kernal.seg_1 -d $(DIR_M65) -l 4000 -h 5fff $(CFG_M65) $(GEN_STR_M65) $(SRCDIR_KERNAL) $(GEN_KERNAL) # Rules - BASIC and KERNAL intermediate files, for Commander X16 $(DIR_X16)/OUTB_0.BIN $(DIR_X16)/BASIC_0_combined.vs $(DIR_X16)/BASIC_0_combined.sym: @mkdir -p $(DIR_X16) @rm -f $@* $(DIR_X16)/BASIC_0* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s BASIC_0 -i BASIC_0-x16 -o OUTB_0.BIN -d $(DIR_X16) -l c000 -h e4d2 $(CFG_X16) $(SRCDIR_BASIC) $(GEN_BASIC) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s BASIC_0 -i BASIC_0-x16 -o OUTB_0.BIN -d $(DIR_X16) -l c000 -h e4d2 $(CFG_X16) $(GEN_STR_X16) $(SRCDIR_BASIC) $(GEN_BASIC) $(DIR_X16)/OUTK_0.BIN $(DIR_X16)/KERNAL_0_combined.vs $(DIR_X16)/KERNAL_0_combined.sym: @mkdir -p $(DIR_X16) @rm -f $@* $(DIR_X16)/KERNAL_0* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s KERNAL_0 -i KERNAL_0-x16 -o OUTK_0.BIN -d $(DIR_X16) -l e4d3 -h ffff $(CFG_X16) $(SRCDIR_KERNAL) $(GEN_KERNAL) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s KERNAL_0 -i KERNAL_0-x16 -o OUTK_0.BIN -d $(DIR_X16) -l e4d3 -h ffff $(CFG_X16) $(GEN_STR_X16) $(SRCDIR_KERNAL) $(GEN_KERNAL) $(DIR_X16)/basic.seg_1 $(DIR_X16)/BASIC_1_combined.vs $(DIR_X16)/BASIC_1_combined.sym: @mkdir -p $(DIR_X16) @rm -f $@* $(DIR_X16)/basic.seg_1 $(DIR_X16)/BASIC_1* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s BASIC_1 -i BASIC_1-x16 -o basic.seg_1 -d $(DIR_X16) -l a000 -h bfff $(CFG_X16) $(SRCDIR_BASIC) $(GEN_BASIC) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s BASIC_1 -i BASIC_1-x16 -o basic.seg_1 -d $(DIR_X16) -l a000 -h bfff $(CFG_X16) $(GEN_STR_X16) $(SRCDIR_BASIC) $(GEN_BASIC) $(DIR_X16)/kernal.seg_1 $(DIR_X16)/KERNAL_1_combined.vs $(DIR_X16)/KERNAL_1_combined.sym: @mkdir -p $(DIR_X16) @rm -f $@* $(DIR_X16)/kernal.seg_1 $(DIR_X16)/KERNAL_1* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s KERNAL_1 -i KERNAL_1-x16 -o kernal.seg_1 -d $(DIR_X16) -l a000 -h bfff $(CFG_X16) $(SRCDIR_KERNAL) $(GEN_KERNAL) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s KERNAL_1 -i KERNAL_1-x16 -o kernal.seg_1 -d $(DIR_X16) -l a000 -h bfff $(CFG_X16) $(GEN_STR_X16) $(SRCDIR_KERNAL) $(GEN_KERNAL) # Rules - BASIC and KERNAL diff --git a/c64/,,config_custom.s b/c64/,,config_custom.s index 1e03bdff..b2b827c4 100644 --- a/c64/,,config_custom.s +++ b/c64/,,config_custom.s @@ -52,7 +52,7 @@ // #define CONFIG_IEC_JIFFYDOS_BLANK // #define CONFIG_IEC_BURST_CIA1 // please keep disabled for now // #define CONFIG_IEC_BURST_CIA2 // please keep disabled for now -// #define CONFIG_IEC_BURST_SOFT // please keep disabled for now +// #define CONFIG_IEC_BURST_MEGA_65 // please keep disabled for now #define CONFIG_TAPE_NORMAL #define CONFIG_TAPE_TURBO @@ -135,7 +135,6 @@ #define CONFIG_BANNER_FANCY // #define CONFIG_BANNER_BRAND #define CONFIG_SHOW_FEATURES -#define CONFIG_SHOW_PAL_NTSC // Debug options diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 0a652064..3e14bbaa 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -148,12 +148,12 @@ .error "CONFIG_IEC_DOLPHINDOS_FAST requires CONFIG_IEC_DOLPHINDOS" #endif -#if (CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_SOFT) && !CONFIG_IEC +#if (CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_MEGA_65) && !CONFIG_IEC .error "CONFIG_IEC_BURST_* requires CONFIG_IEC" #endif -#if CONFIG_IEC_BURST_SOFT && !CONFIG_MB_MEGA_65 - .error "CONFIG_IEC_BURST_SOFT requires CONFIG_MB_MEGA_65" +#if CONFIG_IEC_BURST_MEGA_65 && !CONFIG_MB_MEGA_65 + .error "CONFIG_IEC_BURST_MEGA_65 requires CONFIG_MB_MEGA_65" #endif .var selected_iec_burst = 0; @@ -164,7 +164,7 @@ #if CONFIG_IEC_BURST_CIA2 .eval selected_iec_burst++ #endif -#if CONFIG_IEC_BURST_SOFT +#if CONFIG_IEC_BURST_MEGA_65 .eval selected_iec_burst++ #endif @@ -358,86 +358,3 @@ .const CONFIG_COLOR_TXT = $01 #endif - - -// Function for printing out build features - -.var feature_new_line = false - -.function ADD_FEATURE(current_features, new_feature) -{ - .var features_str = current_features - - .if (!feature_new_line && features_str.size() > 0) - { - .eval features_str = features_str + ", " - } - - .if (feature_new_line) - { - .eval feature_new_line = false - .eval features_str = features_str + @"\r" - } - - .return features_str + new_feature -} - -.function BUILD_FEATURES_STR() -{ - .var features_str = "" - -#if CONFIG_TAPE_NORMAL && !CONFIG_TAPE_TURBO - .eval features_str = ADD_FEATURE(features_str, "TAPE LOAD NORMAL") -#endif -#if !CONFIG_TAPE_NORMAL && CONFIG_TAPE_TURBO - .eval features_str = ADD_FEATURE(features_str, "TAPE LOAD TURBO") -#endif -#if CONFIG_TAPE_NORMAL && CONFIG_TAPE_TURBO - .eval features_str = ADD_FEATURE(features_str, "TAPE LOAD NORMAL TURBO") -#endif - - .eval feature_new_line = true - -#if CONFIG_IEC - .var iec_features_str = "IEC" -#if CONFIG_IEC_BURST_CIA1 - .eval iec_features_str = iec_features_str + " BURST1" -#endif -#if CONFIG_IEC_BURST_CIA2 - .eval iec_features_str = iec_features_str + " BURST2" -#endif -#if CONFIG_IEC_BURST_SOFT - .eval iec_features_str = iec_features_str + " BURST" -#endif -#if CONFIG_IEC_DOLPHINDOS - .eval iec_features_str = iec_features_str + " DOLPHIN" -#endif -#if CONFIG_IEC_JIFFYDOS - .eval iec_features_str = iec_features_str + " JIFFY" -#endif -#if !CONFIG_IEC_BURST_CIA1 && !CONFIG_IEC_BURST_CIA2 && !CONFIG_IEC_BURST_SOFT && !CONFIG_IEC_DOLPHINDOS && !CONFIG_IEC_JIFFYDOS - .eval iec_features_str = iec_features_str + " NORMAL" -#endif - .eval features_str = ADD_FEATURE(features_str, iec_features_str) -#endif - - .eval feature_new_line = true - -#if CONFIG_RS232_UP2400 - .eval features_str = ADD_FEATURE(features_str, "UP2400") -#endif - -#if CONFIG_RS232_UP2400 - .eval features_str = ADD_FEATURE(features_str, "UP9600") -#endif - -#if CONFIG_KEYBOARD_C128 - .eval features_str = ADD_FEATURE(features_str, "KBD 128") -#endif - -#if CONFIG_KEYBOARD_C65 - .eval features_str = ADD_FEATURE(features_str, "KBD 65") -#endif - - .return features_str -} diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index 72bd6d0b..3e206102 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -103,7 +103,7 @@ .label PTR1 = $9E // for tape support, counter of errorneous bytes .label PTR2 = $9F // for tape support, counter for errorneous bytes correction .label TIME = $A0 // $A0-$A2 jiffy clock -#if !CONFIG_IEC_JIFFYDOS && !CONFIG_IEC_DOLPHINDOS && !CONFIG_IEC_BURST_CIA1 && !CONFIG_IEC_BURST_CIA2 && !CONFIG_IEC_BURST_SOFT +#if !CONFIG_IEC_JIFFYDOS && !CONFIG_IEC_DOLPHINDOS && !CONFIG_IEC_BURST_CIA1 && !CONFIG_IEC_BURST_CIA2 && !CONFIG_IEC_BURST_MEGA_65 .label TSFCNT = $A3 // temporary variable for tape and IEC, [!] our usage differs #else .label IECPROTO = $A3 // -- WIP -- [!] 0 = normal, 1 = JiffyDOS, >= $80 for unknown diff --git a/c64/basic/,imports.s b/c64/basic/,imports.s index 3d0934dc..8b3c1e45 100644 --- a/c64/basic/,imports.s +++ b/c64/basic/,imports.s @@ -43,10 +43,6 @@ .label print_return = KERNAL().print_return .label print_space = KERNAL().print_space -#if CONFIG_SHOW_FEATURES -.label print_features = KERNAL().print_features -#endif - #if CONFIG_TAPE_HEAD_ALIGN .label tape_head_align = KERNAL().tape_head_align #endif diff --git a/c64/basic/init/initmsg_real.s b/c64/basic/init/initmsg_real.s index 3438c8ad..98df977a 100644 --- a/c64/basic/init/initmsg_real.s +++ b/c64/basic/init/initmsg_real.s @@ -57,8 +57,7 @@ initmsg_real: ldy #$00 #if CONFIG_SHOW_FEATURES jsr plot_set - jsr print_features - jmp print_pal_ntsc + jmp print_features #else jmp plot_set #endif @@ -111,8 +110,7 @@ initmsg_real: ldy #$00 #if CONFIG_SHOW_FEATURES jsr plot_set - jsr print_features - jmp print_pal_ntsc + jmp print_features #else jmp plot_set #endif diff --git a/c64/basic/print/print_pal_ntsc.s b/c64/basic/print/print_features.s similarity index 65% rename from c64/basic/print/print_pal_ntsc.s rename to c64/basic/print/print_features.s index cfabc62e..47de7cda 100644 --- a/c64/basic/print/print_pal_ntsc.s +++ b/c64/basic/print/print_features.s @@ -4,11 +4,18 @@ // #LAYOUT# * * #IGNORE // -// Print video system on startup banner +// Print configured features and current video system on startup banner // #if CONFIG_SHOW_FEATURES +print_features: + + ldx #IDX__STR_FEATURES + jsr print_packed_misc_str + + // FALLTROUGH + print_pal_ntsc: ldx #IDX__STR_NTSC diff --git a/c64/kernal/assets/kernal_messages.s b/c64/kernal/assets/kernal_messages.s index a5d712bf..16129aa8 100644 --- a/c64/kernal/assets/kernal_messages.s +++ b/c64/kernal/assets/kernal_messages.s @@ -31,9 +31,6 @@ .label __MSG_KERNAL_PANIC_ROM_MISMATCH = __msg_kernalpanic_rom_mismatch - __msg_kernal_first #endif -#if CONFIG_SHOW_FEATURES -.label __MSG_KERNAL_FEATURES = __msg_kernalfeatures - __msg_kernal_first -#endif __msg_kernal_first: @@ -99,11 +96,3 @@ __msg_kernalpanic_rom_mismatch: .byte $80 + $48 // end of string mark + 'H' #endif // CONFIG_PANIC_SCREEN - -#if CONFIG_SHOW_FEATURES - -__msg_kernalfeatures: - .text BUILD_FEATURES_STR() - .byte $80 + $0D // end of string mark + return - -#endif // CONFIG_SHOW_FEATURES diff --git a/c64/kernal/iec/iec_cmd_open.s b/c64/kernal/iec/iec_cmd_open.s index 6d1bba33..a4a0e2df 100644 --- a/c64/kernal/iec/iec_cmd_open.s +++ b/c64/kernal/iec/iec_cmd_open.s @@ -20,7 +20,7 @@ iec_cmd_open: // similar to TKSA, but without turnaround !: ora #$F0 -#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT +#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_MEGA_65 pha jsr burst_advertise pla diff --git a/c64/kernal/iec/load_iec.s b/c64/kernal/iec/load_iec.s index 578e9f97..fdd75f85 100644 --- a/c64/kernal/iec/load_iec.s +++ b/c64/kernal/iec/load_iec.s @@ -60,7 +60,7 @@ load_iec: jsr TALK bcs load_iec_error -#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT +#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_MEGA_65 jsr burst_advertise #endif diff --git a/c64/kernal/iec/save_iec.s b/c64/kernal/iec/save_iec.s index 83dff28b..324653c6 100644 --- a/c64/kernal/iec/save_iec.s +++ b/c64/kernal/iec/save_iec.s @@ -42,7 +42,7 @@ save_iec: jsr LISTEN bcs save_iec_dev_not_found -#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT +#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_MEGA_65 jsr burst_advertise #endif diff --git a/c64/kernal/iec_fast/burst_soft_advertise.s b/c64/kernal/iec_fast/burst_m65_advertise.s similarity index 93% rename from c64/kernal/iec_fast/burst_soft_advertise.s rename to c64/kernal/iec_fast/burst_m65_advertise.s index 7e9e9dcf..d0b91b84 100644 --- a/c64/kernal/iec_fast/burst_soft_advertise.s +++ b/c64/kernal/iec_fast/burst_m65_advertise.s @@ -7,7 +7,7 @@ // -#if CONFIG_IEC_BURST_SOFT +#if CONFIG_IEC_BURST_MEGA_65 burst_advertise: diff --git a/c64/kernal/print/print_features.s b/c64/kernal/print/print_features.s deleted file mode 100644 index c4b4c0ae..00000000 --- a/c64/kernal/print/print_features.s +++ /dev/null @@ -1,17 +0,0 @@ -// #LAYOUT# STD * #TAKE -// #LAYOUT# * KERNAL_0 #TAKE -// #LAYOUT# * * #IGNORE - -// -// Print configured features on startup banner -// - -#if CONFIG_SHOW_FEATURES - -print_features: - - ldx #__MSG_KERNAL_FEATURES -!: - jmp print_kernal_message - -#endif // CONFIG_SHOW_FEATURES diff --git a/tools/generate_strings.cc b/tools/generate_strings.cc index 720c4ceb..8245f3ab 100644 --- a/tools/generate_strings.cc +++ b/tools/generate_strings.cc @@ -2,7 +2,7 @@ // Utility to generate compressed messages and BASIC tokens // -// XXX parse the config file to select the string set (STD, M65, X16) and generate feature string +// XXX print somewhere configuration file used to generate strings // XXX use DualStream class for logging // XXX use dictionary compression by finding the set of non-overlapping strings that can be concatenated // to produce full set of strings; some idea for the algorithm (not sure if proper one) is available here @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -25,6 +26,7 @@ // std::string CMD_outFile = "out.s"; +std::string CMD_cnfFile = ""; // // Type definition for text/tokens to generate @@ -313,9 +315,8 @@ const StringEntryList GLOBAL_MiscStrings = { ListType::STRINGS_BASIC, "misc", { true, true, true, "STR_ERROR", " ERROR" }, // simply the word error that is attached to the other parts of messages https://fjkraan.home.xs4all.nl/comp/apple2faq/app2asoftfaq.html { true, true, true, "STR_IN", " IN " }, // STD M65 X16 --- misc strings specific to OpenROMs, not present in CBM ROMs - { true, true, true, "STR_PAL", "PAL\r" }, - { true, true, true, "STR_NTSC", "NTSC\r" }, { true, true, true, "STR_BRK_AT", "\rBRK AT $" }, + // Note: depending on configuration, additional strings will be added here } }; @@ -448,6 +449,8 @@ const StringEntryList GLOBAL_MiscStrings = { ListType::STRINGS_BASIC, "misc", "HIGHLIGHT" // $FE $3D */ +std::map GLOBAL_ConfigOptions; + // // Work class definitions // @@ -464,6 +467,7 @@ private: void process(); + void generateConfigDepStrings(); void calculateFrequencies(); void encodeStrings(); @@ -539,6 +543,7 @@ void DataSet::process() { std::cout << "Processing layout '" << layoutName() << "'" << std::endl; + generateConfigDepStrings(); calculateFrequencies(); encodeStrings(); prepareOutput(); @@ -554,6 +559,101 @@ const std::string &DataSet::getOutput() return outFileContent; } +void DataSet::generateConfigDepStrings() +{ + // Generate string to show the build features + + std::string featureStr; + + // Tape support features + + if (GLOBAL_ConfigOptions["CONFIG_TAPE_NORMAL"] && GLOBAL_ConfigOptions["CONFIG_TAPE_TURBO"]) + { + featureStr = "TAPE LOAD NORMAL TURBO\r"; + } + else if (GLOBAL_ConfigOptions["CONFIG_TAPE_NORMAL"]) + { + featureStr = "TAPE LOAD NORMAL\r"; + } + else if (GLOBAL_ConfigOptions["CONFIG_TAPE_TURBO"]) + { + featureStr = "TAPE LOAD TURBO\r"; + } + + // IEC support features + + if (GLOBAL_ConfigOptions["CONFIG_IEC"]) + { + featureStr += "IEC"; + + bool extendedIEC = false; + + if (GLOBAL_ConfigOptions["CONFIG_IEC_BURST_CIA1"]) + { + featureStr += " BURST1"; + extendedIEC = true; + } + if (GLOBAL_ConfigOptions["CONFIG_IEC_BURST_CIA2"]) + { + featureStr += " BURST2"; + extendedIEC = true; + } + if (GLOBAL_ConfigOptions["CONFIG_IEC_BURST_MEGA65"]) + { + featureStr += " BURST"; + extendedIEC = true; + } + + if (GLOBAL_ConfigOptions["CONFIG_IEC_DOLPHINDOS"]) + { + featureStr += " DOLPHIN"; + extendedIEC = true; + } + + if (GLOBAL_ConfigOptions["CONFIG_IEC_JIFFYDOS"]) + { + featureStr += " JIFFY"; + extendedIEC = true; + } + + if (!extendedIEC) featureStr += " NORMAL"; + + featureStr += "\r"; + } + + // RS-232 support features + + if (GLOBAL_ConfigOptions["CONFIG_RS232_UP2400"]) featureStr += "UP2400\r"; + if (GLOBAL_ConfigOptions["CONFIG_RS232_UP9600"]) featureStr += "UP9600\r"; + + // Keyboard support features + + if (GLOBAL_ConfigOptions["CONFIG_KEYBOARD_C128"]) featureStr += "KBD 128\r"; + if (GLOBAL_ConfigOptions["CONFIG_KEYBOARD_C65"]) featureStr += "KBD 65\r"; + + // Add strings to appropriate list + + for (auto &stringEntryList : stringEntryLists) + { + if (stringEntryList.name != std::string("misc")) continue; + + // List found + + if (GLOBAL_ConfigOptions["CONFIG_SHOW_FEATURES"]) + { + StringEntry newEntry1 = { true, true, true, "STR_PAL", "PAL\r" }; + StringEntry newEntry2 = { true, true, true, "STR_NTSC", "NTSC\r" }; + StringEntry newEntry3 = { true, true, true, "STR_FEATURES", featureStr }; + + stringEntryList.list.push_back(newEntry1); + stringEntryList.list.push_back(newEntry2); + stringEntryList.list.push_back(newEntry3); + + break; + } + } +} + void DataSet::calculateFrequencies() { as1n.clear(); @@ -899,10 +999,59 @@ void DataSet::prepareOutput() // Common helper functions // +void parseConfigFile() +{ + GLOBAL_ConfigOptions.clear(); + + // Open the configuration file + + std::ifstream cnfFile; + cnfFile.open(CMD_cnfFile); + if (!cnfFile.good()) ERROR("unable to open config file"); + + // Parse the file + + size_t lineNum = 0; + while (!cnfFile.eof()) + { + lineNum++; + std::string workStr; + + // Read a single line, remove leading spaces and tabs + + std::getline(cnfFile, workStr); // XXX check for errors here + workStr = std::regex_replace(workStr, std::regex("^[ \t]+"), ""); + + // Skip lines which are not preprocessor definitions + + if (workStr.empty() || workStr[0] != '#') continue; + + // Make sure this is '#define ' + + if (!std::regex_match(workStr, std::regex("^#define[ \t].*"))) + { + ERROR(std::string("only '#define' preprocessor directives allowed in config files - line ") + std::to_string(lineNum)); + } + + // Get rid of the directive and trailing spaces/comments + + workStr = std::regex_replace(workStr, std::regex("^#define[ \t]+"), ""); + workStr = std::regex_replace(workStr, std::regex("[ \t]+.*"), ""); + + // Add definitin to config option map + + if (workStr.empty()) ERROR(std::string("error parsing config file - line ") + std::to_string(lineNum)); + + GLOBAL_ConfigOptions[workStr] = true; + } + + cnfFile.close(); +} + void printUsage() { std::cout << "\n" << - "usage: generate_strings [-o ]" << "\n\n"; + "usage: generate_strings [-o ] [-c ]" << "\n\n"; } void printBanner() @@ -918,11 +1067,12 @@ void parseCommandLine(int argc, char **argv) // Retrieve command line options - while ((opt = getopt(argc, argv, "o:")) != -1) + while ((opt = getopt(argc, argv, "o:c:")) != -1) { switch(opt) { case 'o': CMD_outFile = optarg; break; + case 'c': CMD_cnfFile = optarg; break; default: printUsage(); ERROR(); } } @@ -930,36 +1080,61 @@ void parseCommandLine(int argc, char **argv) void writeStrings() { - DataSetSTD dataSetSTD; - DataSetM65 dataSetM65; - DataSetX16 dataSetX16; + std::string outputString; + + if (GLOBAL_ConfigOptions["CONFIG_PLATFORM_COMMANDER_X16"]) + { + DataSetX16 dataSetX16; - // Add input data to computation objects + // Add input data to computation objects + + dataSetX16.addStrings(GLOBAL_Keywords_V2); + dataSetX16.addStrings(GLOBAL_Keywords_CC); + dataSetX16.addStrings(GLOBAL_Keywords_CD); + dataSetX16.addStrings(GLOBAL_Errors); + dataSetX16.addStrings(GLOBAL_MiscStrings); - dataSetSTD.addStrings(GLOBAL_Keywords_V2); - dataSetSTD.addStrings(GLOBAL_Keywords_CC); - dataSetSTD.addStrings(GLOBAL_Keywords_CD); - dataSetSTD.addStrings(GLOBAL_Errors); - dataSetSTD.addStrings(GLOBAL_MiscStrings); + // Retrieve the results + + outputString = dataSetX16.getOutput(); + } + else if (GLOBAL_ConfigOptions["CONFIG_PLATFORM_COMMODORE_64"] && GLOBAL_ConfigOptions["CONFIG_MB_MEGA_65"]) + { + DataSetM65 dataSetM65; - dataSetM65.addStrings(GLOBAL_Keywords_V2); - dataSetM65.addStrings(GLOBAL_Keywords_CC); - dataSetM65.addStrings(GLOBAL_Keywords_CD); - dataSetM65.addStrings(GLOBAL_Errors); - dataSetM65.addStrings(GLOBAL_MiscStrings); + // Add input data to computation objects - dataSetX16.addStrings(GLOBAL_Keywords_V2); - dataSetX16.addStrings(GLOBAL_Keywords_CC); - dataSetX16.addStrings(GLOBAL_Keywords_CD); - dataSetX16.addStrings(GLOBAL_Errors); - dataSetX16.addStrings(GLOBAL_MiscStrings); + dataSetM65.addStrings(GLOBAL_Keywords_V2); + dataSetM65.addStrings(GLOBAL_Keywords_CC); + dataSetM65.addStrings(GLOBAL_Keywords_CD); + dataSetM65.addStrings(GLOBAL_Errors); + dataSetM65.addStrings(GLOBAL_MiscStrings); + + // Retrieve the results + + outputString = dataSetM65.getOutput(); + } + else if (GLOBAL_ConfigOptions["CONFIG_PLATFORM_COMMODORE_64"]) + { + DataSetSTD dataSetSTD; - // Retrieve the results + // Add input data to computation objects - std::string outputSTD = dataSetSTD.getOutput(); - std::string outputM65 = dataSetM65.getOutput(); - std::string outputX16 = dataSetX16.getOutput(); + dataSetSTD.addStrings(GLOBAL_Keywords_V2); + dataSetSTD.addStrings(GLOBAL_Keywords_CC); + dataSetSTD.addStrings(GLOBAL_Keywords_CD); + dataSetSTD.addStrings(GLOBAL_Errors); + dataSetSTD.addStrings(GLOBAL_MiscStrings); + // Retrieve the results + + outputString = dataSetSTD.getOutput(); + } + else + { + ERROR("unable to determine string set"); + } + // Remove old file unlink(CMD_outFile.c_str()); @@ -976,11 +1151,7 @@ void writeStrings() // Write packed strings outFile << std::endl << std::endl; - outFile << outputSTD; - outFile << std::endl << std::endl; - outFile << outputM65; - outFile << std::endl << std::endl; - outFile << outputX16; + outFile << outputString; outFile << std::endl << std::endl; // Close the file @@ -999,6 +1170,8 @@ int main(int argc, char **argv) printBanner(); parseCommandLine(argc, argv); + parseConfigFile(); + writeStrings(); return 0;