diff --git a/CONFIG.md b/CONFIG.md
index 064877d1..c3033ba5 100644
--- a/CONFIG.md
+++ b/CONFIG.md
@@ -31,6 +31,10 @@ Since Open ROMs is highly modular, it should be possible to add other platforms
Select if the ROM is going to be used exclusively on the specified motherboard. It prevents from enabling options not having sense, skips initialization of C128-only registers, and enables motherboard-specific features.
+### `ROM_CRT`
+
+Has to be set for builds utilizing cartridge image as a ROM extension.
+
## Brand
Branding is only allowed for C64 platform, if no motherboard is specified.
@@ -139,7 +143,7 @@ Needs about 430 bytes in KERNAL segment. If unsure - enable.
### `IEC_JIFFYDOS_BLANK`
-Causes screen blanking during JiffyDOS file loading to increase performance.
+Causes screen blanking during JiffyDOS file loading to increase performance. On Ultimate 64 motherboard, if possible, screen blanking is substituted by disabling badlines.
## Tape deck
diff --git a/Makefile b/Makefile
index 1f57c808..11cf3ac2 100644
--- a/Makefile
+++ b/Makefile
@@ -15,10 +15,11 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
src/basic/assets \
src/basic/basic_commands \
src/basic/basic_commands_01 \
- src/basic/basic_commands_02 \
- src/basic/basic_commands_03_m65 \
+ src/basic/basic_commands_04 \
src/basic/basic_operators \
src/basic/basic_functions \
+ src/basic/basic_functions_06 \
+ src/basic/board_crt \
src/basic/board_m65 \
src/basic/board_x16 \
src/basic/engine_editor \
@@ -35,12 +36,16 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \
SRCDIR_DOS_M65 = $(SRCDIR_COMMON) \
src/dos_m65 \
+ # src/dos_m65/cmdrdos \
+ src/dos_m65/sdcard
SRCDIR_KERNAL = $(SRCDIR_COMMON) \
src/kernal \
src/kernal/,stubs \
src/kernal/assets \
+ src/kernal/board_crt \
src/kernal/board_m65 \
+ src/kernal/board_u64 \
src/kernal/board_x16 \
src/kernal/extapi_m65 \
src/kernal/iec \
@@ -59,18 +64,24 @@ SRCDIR_KERNAL = $(SRCDIR_COMMON) \
src/kernal/tape \
src/kernal/time
-SRC_BASIC = $(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s))
-SRC_DOS_M65 = $(foreach dir,$(SRCDIR_DOS_M65),$(wildcard $(dir)/*.s))
-SRC_KERNAL = $(foreach dir,$(SRCDIR_KERNAL),$(wildcard $(dir)/*.s))
-SRC_TOOLS = $(wildcard tools/*.c,tools/*.cc)
+SRC_BASIC = $(foreach dir,$(SRCDIR_BASIC),$(wildcard $(dir)/*.s))
+SRC_DOS_M65 = $(foreach dir,$(SRCDIR_DOS_M65),$(wildcard $(dir)/*.s))
+SRC_KERNAL = $(foreach dir,$(SRCDIR_KERNAL),$(wildcard $(dir)/*.s))
+SRC_TOOLS = $(wildcard tools/*.c,tools/*.cc)
-DIR_ACME = assembler/acme/src
-HDR_ACME = $(filter-out $(wildcard $(DIR_ACME)/_*.h),$(wildcard $(DIR_ACME)/*.h))
-SRC_ACME = $(DIR_ACME)/acme.c $(DIR_ACME)/platform.c $(DIR_ACME)/alu.c $(DIR_ACME)/typesystem.c \
- $(DIR_ACME)/cliargs.c $(DIR_ACME)/global.c $(DIR_ACME)/output.c $(DIR_ACME)/flow.c \
- $(DIR_ACME)/macro.c $(DIR_ACME)/cpu.c $(DIR_ACME)/encoding.c $(DIR_ACME)/pseudoopcodes.c \
- $(DIR_ACME)/dynabuf.c $(DIR_ACME)/mnemo.c $(DIR_ACME)/input.c $(DIR_ACME)/section.c \
- $(DIR_ACME)/symbol.c $(DIR_ACME)/tree.c
+DIR_ACME = assembler/acme/src
+HDR_ACME = $(filter-out $(wildcard $(DIR_ACME)/_*.h),$(wildcard $(DIR_ACME)/*.h))
+SRC_ACME = $(DIR_ACME)/acme.c $(DIR_ACME)/platform.c $(DIR_ACME)/alu.c $(DIR_ACME)/typesystem.c \
+ $(DIR_ACME)/cliargs.c $(DIR_ACME)/global.c $(DIR_ACME)/output.c $(DIR_ACME)/flow.c \
+ $(DIR_ACME)/macro.c $(DIR_ACME)/cpu.c $(DIR_ACME)/encoding.c $(DIR_ACME)/pseudoopcodes.c \
+ $(DIR_ACME)/dynabuf.c $(DIR_ACME)/mnemo.c $(DIR_ACME)/input.c $(DIR_ACME)/section.c \
+ $(DIR_ACME)/symbol.c $(DIR_ACME)/tree.c
+
+CRT_BIN_LIST = assets/cartridge/header-cart.bin \
+ assets/cartridge/header-seg0.bin \
+ assets/cartridge/header-seg1.bin \
+ assets/cartridge/header-seg2.bin \
+ assets/cartridge/header-seg3.bin
# Generated files
@@ -79,30 +90,36 @@ GEN_KERNAL =
# List of build directories
-DIR_CUS = build/target_custom
-DIR_GEN = build/target_generic
-DIR_TST = build/target_testing
-DIR_M65 = build/target_mega65
-DIR_U64 = build/target_ultimate64
-DIR_X16 = build/target_cx16
+DIR_CUS = build/target_custom
+DIR_GEN = build/target_generic
+DIR_GENCRT = build/target_generic_crt
+DIR_TST = build/target_testing
+DIR_M65 = build/target_mega65
+DIR_U64 = build/target_ultimate64
+DIR_U64CRT = build/target_ultimate64_crt
+DIR_X16 = build/target_cx16
# List of config files
-CFG_CUS = src/,,config_custom.s
-CFG_GEN = src/,,config_generic.s
-CFG_TST = src/,,config_testing.s
-CFG_M65 = src/,,config_mega65.s
-CFG_U64 = src/,,config_ultimate64.s
-CFG_X16 = src/,,config_cx16.s
+CFG_CUS = src/,,config_custom.s
+CFG_GEN = src/,,config_generic.s
+CFG_GENCRT = src/,,config_generic_crt.s
+CFG_TST = src/,,config_testing.s
+CFG_M65 = src/,,config_mega65.s
+CFG_U64 = src/,,config_ultimate64.s
+CFG_X16 = src/,,config_cx16.s
+CFG_U64CRT = src/,,config_ultimate64_crt.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
+GEN_STR_CUS = $(DIR_CUS)/,generated/,packed_strings.s
+GEN_STR_GEN = $(DIR_GEN)/,generated/,packed_strings.s
+GEN_STR_GENCRT = $(DIR_GENCRT)/,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_U64CRT = $(DIR_U64CRT)/,generated/,packed_strings.s
+GEN_STR_X16 = $(DIR_X16)/,generated/,packed_strings.s
# Dependencies - helper variables
@@ -132,46 +149,71 @@ TOOLS_LIST = $(TOOL_GENERATE_CONSTANTS) \
# List of targets
-TARGET_CUS_B = build/basic_custom.rom
-TARGET_GEN_B = build/basic_generic.rom
-TARGET_TST_B = build/basic_testing.rom
-TARGET_U64_B = build/basic_ultimate64.rom
+TARGET_CHR_ORF = build/chargen_openroms.rom
+TARGET_CHR_PXL = build/chargen_pxlfont.rom
-TARGET_CUS_K = build/kernal_custom.rom
-TARGET_GEN_K = build/kernal_generic.rom
-TARGET_TST_K = build/kernal_testing.rom
-TARGET_U64_K = build/kernal_ultimate64.rom
+TARGET_CUS_B = build/basic_custom.rom
+TARGET_GEN_B = build/basic_generic.rom
+TARGET_GENCRT_B = build/basic_generic_crt.rom
+TARGET_TST_B = build/basic_testing.rom
+TARGET_U64_B = build/basic_ultimate64.rom
+TARGET_U64CRT_B = build/basic_ultimate64_crt.rom
-TARGET_M65_x = build/mega65.rom
-TARGET_M65_x_PXL = build/mega65_pxlfont.rom
-TARGET_X16_x = build/cx16-dummy.rom
+TARGET_CUS_K = build/kernal_custom.rom
+TARGET_GEN_K = build/kernal_generic.rom
+TARGET_GENCRT_K = build/kernal_generic_crt.rom
+TARGET_TST_K = build/kernal_testing.rom
+TARGET_U64_K = build/kernal_ultimate64.rom
+TARGET_U64CRT_K = build/kernal_ultimate64_crt.rom
-TARGET_LIST_CUS = $(TARGET_CUS_B) $(TARGET_CUS_K)
-TARGET_LIST_GEN = $(TARGET_GEN_B) $(TARGET_GEN_K)
-TARGET_LIST_TST = $(TARGET_TST_B) $(TARGET_TST_K)
-TARGET_LIST_U64 = $(TARGET_U64_B) $(TARGET_U64_K)
+TARGET_GENCRT_X = build/extrom_generic_crt.crt
+TARGET_U64CRT_X = build/extrom_ultimate64_crt.crt
-TARGET_LIST = build/chargen_openroms.rom \
- $(TARGET_LIST_CUS) \
- $(TARGET_LIST_GEN) \
- $(TARGET_LIST_TST) \
- $(TARGET_M65_x) \
- $(TARGET_M65_x_PXL) \
- $(TARGET_LIST_U64) \
- $(TARGET_X16_x)
+TARGET_M65_x_ORF = build/mega65.rom
+TARGET_M65_x_PXL = build/mega65_pxlfont.rom
+TARGET_X16_x = build/cx16-dummy.rom
-SEG_LIST_M65 = $(DIR_M65)/basic.seg_0 \
- $(DIR_M65)/basic.seg_1 \
- $(DIR_M65)/dos.seg_1 \
- $(DIR_M65)/kernal.seg_0 \
- $(DIR_M65)/kernal.seg_1
+TARGET_LIST_CUS = $(TARGET_CUS_B) $(TARGET_CUS_K)
+TARGET_LIST_GEN = $(TARGET_GEN_B) $(TARGET_GEN_K)
+TARGET_LIST_GENCRT = $(TARGET_GENCRT_B) $(TARGET_GENCRT_K) $(TARGET_GENCRT_X)
+TARGET_LIST_TST = $(TARGET_TST_B) $(TARGET_TST_K)
+TARGET_LIST_U64 = $(TARGET_U64_B) $(TARGET_U64_K)
+TARGET_LIST_U64CRT = $(TARGET_U64CRT_B) $(TARGET_U64CRT_K) $(TARGET_U64CRT_X)
-SEG_LIST_X16 = $(DIR_X16)/basic.seg_0 \
- $(DIR_X16)/basic.seg_1 \
- $(DIR_X16)/kernal.seg_0 \
- $(DIR_X16)/kernal.seg_1
-REL_TARGET_LIST = $(TARGET_LIST_GEN) $(TARGET_M65_x) $(TARGET_M65_x_PXL) $(TARGET_LIST_U64)
+TARGET_LIST = $(TARGET_CHR_ORF) \
+ $(TARGET_LIST_CUS) \
+ $(TARGET_LIST_GEN) \
+ $(TARGET_LIST_GENCRT) \
+ $(TARGET_LIST_TST) \
+ $(TARGET_M65_x_ORF) \
+ $(TARGET_M65_x_PXL) \
+ $(TARGET_LIST_U64) \
+ $(TARGET_LIST_U64CRT) \
+ $(TARGET_X16_x)
+
+SEG_LIST_GENCRT = $(DIR_GENCRT)/basic.seg_1 \
+ $(DIR_GENCRT)/kernal.seg_1
+
+SEG_LIST_U64CRT = $(DIR_U64CRT)/basic.seg_1 \
+ $(DIR_U64CRT)/kernal.seg_1
+
+SEG_LIST_M65 = $(DIR_M65)/basic.seg_0 \
+ $(DIR_M65)/basic.seg_1 \
+ $(DIR_M65)/dos.seg_1 \
+ $(DIR_M65)/kernal.seg_0 \
+ $(DIR_M65)/kernal.seg_1
+
+SEG_LIST_X16 = $(DIR_X16)/basic.seg_0 \
+ $(DIR_X16)/basic.seg_1 \
+ $(DIR_X16)/kernal.seg_0 \
+ $(DIR_X16)/kernal.seg_1
+
+REL_TARGET_LIST = $(TARGET_LIST_GEN) \
+ $(TARGET_LIST_GENCRT) \
+ $(TARGET_M65_x_ORF) \
+ $(TARGET_M65_x_PXL) \
+ $(TARGET_LIST_U64)
# Misc strings
@@ -199,6 +241,20 @@ updatebin:
@$(TOOL_RELEASE) -i ./build -o ./bin $(patsubst build/%,%,$(REL_TARGET_LIST))
@cp build/chargen_openroms.rom bin/chargen_openroms.rom
+# Rules - external blobs
+
+kernal:
+ @echo
+ @echo Please copy \'kernal\' file from the original ROM set to the \'open-roms\' directory
+ @echo
+ @exit 1
+
+basic:
+ @echo
+ @echo Please copy \'basic\' file from the original ROM set to the \'open-roms\' directory
+ @echo
+ @exit 1
+
# Rules - tools
$(DIR_ACME) $(SRC_ACME):
@@ -233,17 +289,17 @@ build/tools/%: tools/%.cc tools/common.h
# Rules - CHARGEN
-build/chargen_openroms.rom: $(TOOL_PNGPREPARE) assets/8x8font.png
+$(TARGET_CHR_ORF): $(TOOL_PNGPREPARE) assets/8x8font.png
@$(TOOL_PNGPREPARE) charrom assets/8x8font.png $@ 1>build/pngprepare.log
-build/chargen_pxlfont.rom: bin/chargen_pxlfont_2.3.rom
+$(TARGET_CHR_PXL): bin/chargen_pxlfont_2.3.rom
@cp $< $@
-build/chargen_openroms.patched: $(TOOL_PATCH_CHARGEN) build/chargen_openroms.rom
- @$(TOOL_PATCH_CHARGEN) -i build/chargen_openroms.rom -o $@ -n 7px-OpenROMs
+build/chargen_openroms.patched: $(TOOL_PATCH_CHARGEN) $(TARGET_CHR_ORF)
+ @$(TOOL_PATCH_CHARGEN) -i $(TARGET_CHR_ORF) -o $@ -n 7px-OpenROMs
-build/chargen_pxlfont.patched: $(TOOL_PATCH_CHARGEN) build/chargen_pxlfont.rom
- @$(TOOL_PATCH_CHARGEN) -i build/chargen_pxlfont.rom -o $@ -n 6px-PXLfont
+build/chargen_pxlfont.patched: $(TOOL_PATCH_CHARGEN) $(TARGET_CHR_PXL)
+ @$(TOOL_PATCH_CHARGEN) -i $(TARGET_CHR_PXL) -o $@ -n 6px-PXLfont
# Dependencies - BASIC, DOS, and KERNAL
@@ -265,6 +321,16 @@ $(DIR_TST)/OUTK_x.BIN $(DIR_TST)/KERNAL_combined.vs $(DIR_TST)/KERNAL_combined.s
$(DIR_U64)/OUTK_x.BIN $(DIR_U64)/KERNAL_combined.vs $(DIR_U64)/KERNAL_combined.sym: \
$(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_U64) $(GEN_STR_U64)
+$(DIR_GENCRT)/OUTB_0.BIN $(DIR_GENCRT)/BASIC_0_combined.vs: \
+ $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_GENCRT) $(CRT_STR_GENCRT) $(DIR_GENCRT)/KERNAL_0_combined.sym
+$(DIR_GENCRT)/OUTK_0.BIN $(DIR_GENCRT)/KERNAL_0_combined.vs $(DIR_GENCRT)/KERNAL_0_combined.sym: \
+ $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_GENCRT) $(GEN_STR_GENCRT)
+
+$(DIR_U64CRT)/OUTB_0.BIN $(DIR_U64CRT)/BASIC_0_combined.vs: \
+ $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_U64CRT) $(CRT_STR_U64CRT) $(DIR_U64CRT)/KERNAL_0_combined.sym
+$(DIR_U64CRT)/OUTK_0.BIN $(DIR_U64CRT)/KERNAL_0_combined.vs $(DIR_U64CRT)/KERNAL_0_combined.sym: \
+ $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_U64CRT) $(GEN_STR_U64CRT)
+
$(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) $(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: \
@@ -275,6 +341,16 @@ $(DIR_X16)/OUTB_0.BIN $(DIR_X16)/BASIC_0_combined.vs $(DIR_X16)/BASIC_0_combine
$(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) $(GEN_STR_X16)
+$(DIR_GENCRT)/basic.seg_1 $(DIR_GENCRT)/BASIC_1_combined.vs $(DIR_GENCRT)/BASIC_1_combined.sym: \
+ $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_GENCRT) $(GEN_STR_GENCRT) $(DIR_GENCRT)/KERNAL_0_combined.sym $(DIR_GENCRT)/BASIC_0_combined.sym
+$(DIR_GENCRT)/kernal.seg_1 $(DIR_GENCRT)/KERNAL_1_combined.vs $(DIR_GENCRT)/KERNAL_1_combined.sym: \
+ $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_GENCRT) $(GEN_STR_GENCRT) $(DIR_GENCRT)/KERNAL_0_combined.sym
+
+$(DIR_U64CRT)/basic.seg_1 $(DIR_U64CRT)/BASIC_1_combined.vs $(DIR_U64CRT)/BASIC_1_combined.sym: \
+ $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_U64CRT) $(GEN_STR_U64CRT) $(DIR_U64CRT)/KERNAL_0_combined.sym $(DIR_U64CRT)/BASIC_0_combined.sym
+$(DIR_U64CRT)/kernal.seg_1 $(DIR_U64CRT)/KERNAL_1_combined.vs $(DIR_U64CRT)/KERNAL_1_combined.sym: \
+ $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_U64CRT) $(GEN_STR_U64CRT) $(DIR_U64CRT)/KERNAL_0_combined.sym
+
$(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) $(GEN_STR_M65) $(DIR_M65)/KERNAL_0_combined.sym $(DIR_M65)/BASIC_0_combined.sym
$(DIR_M65)/dos.seg_1 $(DIR_M65)/DOS_1_combined.vs $(DIR_M65)/DOS_1_combined.sym: \
@@ -287,12 +363,14 @@ $(DIR_X16)/basic.seg_1 $(DIR_X16)/BASIC_1_combined.vs $(DIR_X16)/BASIC_1_combi
$(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) $(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
-$(DIR_TST)/OUTx_x.BIN: $(DIR_TST)/OUTB_x.BIN $(DIR_TST)/OUTK_x.BIN
-$(DIR_M65)/OUTx_0.BIN: $(DIR_M65)/OUTB_0.BIN $(DIR_M65)/OUTK_0.BIN
-$(DIR_U64)/OUTx_x.BIN: $(DIR_U64)/OUTB_x.BIN $(DIR_U64)/OUTK_x.BIN
-$(DIR_X16)/OUTx_0.BIN: $(DIR_X16)/OUTB_0.BIN $(DIR_X16)/OUTK_0.BIN
+$(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
+$(DIR_GENCRT)/OUTx_0.BIN: $(DIR_GENCRT)/OUTB_0.BIN $(DIR_GENCRT)/OUTK_0.BIN
+$(DIR_TST)/OUTx_x.BIN: $(DIR_TST)/OUTB_x.BIN $(DIR_TST)/OUTK_x.BIN
+$(DIR_M65)/OUTx_0.BIN: $(DIR_M65)/OUTB_0.BIN $(DIR_M65)/OUTK_0.BIN
+$(DIR_U64)/OUTx_x.BIN: $(DIR_U64)/OUTB_x.BIN $(DIR_U64)/OUTK_x.BIN
+$(DIR_U64CRT)/OUTx_0.BIN: $(DIR_U64CRT)/OUTB_0.BIN $(DIR_U64CRT)/OUTK_0.BIN
+$(DIR_X16)/OUTx_0.BIN: $(DIR_X16)/OUTB_0.BIN $(DIR_X16)/OUTK_0.BIN
$(TARGET_CUS_B): $(DIR_CUS)/OUTx_x.BIN
$(TARGET_GEN_B): $(DIR_GEN)/OUTx_x.BIN
@@ -304,10 +382,12 @@ $(TARGET_GEN_K): $(DIR_GEN)/OUTx_x.BIN
$(TARGET_TST_K): $(DIR_TST)/OUTx_x.BIN
$(TARGET_U64_K): $(DIR_U64)/OUTx_x.BIN
-build/symbols_custom.vs: $(DIR_CUS)/BASIC_combined.vs $(DIR_CUS)/KERNAL_combined.vs
-build/symbols_generic.vs: $(DIR_GEN)/BASIC_combined.vs $(DIR_GEN)/KERNAL_combined.vs
-build/symbols_testing.vs: $(DIR_TST)/BASIC_combined.vs $(DIR_TST)/KERNAL_combined.vs
-build/symbols_ultimate64.vs: $(DIR_U64)/BASIC_combined.vs $(DIR_U64)/KERNAL_combined.vs
+build/symbols_custom.vs: $(DIR_CUS)/BASIC_combined.vs $(DIR_CUS)/KERNAL_combined.vs
+build/symbols_generic.vs: $(DIR_GEN)/BASIC_combined.vs $(DIR_GEN)/KERNAL_combined.vs
+build/symbols_generic_crt.vs: $(DIR_GENCRT)/BASIC_0_combined.vs $(DIR_GENCRT)/KERNAL_0_combined.vs
+build/symbols_testing.vs: $(DIR_TST)/BASIC_combined.vs $(DIR_TST)/KERNAL_combined.vs
+build/symbols_ultimate64.vs: $(DIR_U64)/BASIC_combined.vs $(DIR_U64)/KERNAL_combined.vs
+build/symbols_ultimate64_crt.vs: $(DIR_U64CRT)/BASIC_0_combined.vs $(DIR_U64CRT)/KERNAL_0_combined.vs
# Rules - BASIC and KERNAL intermediate files
@@ -319,6 +399,10 @@ $(GEN_STR_GEN): $(TOOL_GENERATE_STRINGS) $(CFG_GEN)
@mkdir -p $(DIR_GEN)/,generated
$(TOOL_GENERATE_STRINGS) -o $@ -c $(CFG_GEN)
+$(GEN_STR_GENCRT): $(TOOL_GENERATE_STRINGS) $(CFG_GENCRT)
+ @mkdir -p $(DIR_GENCRT)/,generated
+ $(TOOL_GENERATE_STRINGS) -o $@ -c $(CFG_GENCRT)
+
$(GEN_STR_TST): $(TOOL_GENERATE_STRINGS) $(CFG_TST)
@mkdir -p $(DIR_TST)/,generated
$(TOOL_GENERATE_STRINGS) -o $@ -c $(CFG_TST)
@@ -331,6 +415,10 @@ $(GEN_STR_U64): $(TOOL_GENERATE_STRINGS) $(CFG_U64)
@mkdir -p $(DIR_U64)/,generated
$(TOOL_GENERATE_STRINGS) -o $@ -c $(CFG_U64)
+$(GEN_STR_U64CRT): $(TOOL_GENERATE_STRINGS) $(CFG_U64CRT)
+ @mkdir -p $(DIR_U64CRT)/,generated
+ $(TOOL_GENERATE_STRINGS) -o $@ -c $(CFG_U64CRT)
+
$(GEN_STR_X16): $(TOOL_GENERATE_STRINGS) $(CFG_X16)
@mkdir -p $(DIR_X16)/,generated
$(TOOL_GENERATE_STRINGS) -o $@ -c $(CFG_X16)
@@ -339,12 +427,14 @@ 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)
+GEN_STR_custom = $(GEN_STR_CUS)
+GEN_STR_generic = $(GEN_STR_GEN)
+GEN_STR_generic_crt = $(GEN_STR_GENCRT)
+GEN_STR_testing = $(GEN_STR_TST)
+GEN_STR_mega65 = $(GEN_STR_M65)
+GEN_STR_ultimate64 = $(GEN_STR_U64)
+GEN_STR_ultimate64_crt = $(GEN_STR_U64CRT)
+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:
@@ -358,6 +448,48 @@ build/target_%/OUTK_x.BIN build/target_%/KERNAL_combined.vs build/target_%/KERNA
@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 src/,,config_$*.s $(SRCDIR_KERNAL) $(GEN_KERNAL) $(GEN_STR_$*)
+# Rules - BASIC and KERNAL intermediate files, for ROM with external cartridge
+
+$(DIR_GENCRT)/OUTB_0.BIN $(DIR_GENCRT)/BASIC_0_combined.vs $(DIR_GENCRT)/BASIC_0_combined.sym:
+ @mkdir -p $(DIR_GENCRT)
+ @rm -f $@* $(DIR_GENCRT)/BASIC_0*
+ @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r CRT -s BASIC_0 -i BASIC_0-generic-crt -o OUTB_0.BIN -d $(DIR_GENCRT) -l a000 -h e4d2 $(CFG_GENCRT) $(GEN_STR_GENCRT) $(SRCDIR_BASIC) $(GEN_BASIC)
+
+$(DIR_GENCRT)/OUTK_0.BIN $(DIR_GENCRT)/KERNAL_0_combined.vs $(DIR_GENCRT)/KERNAL_0_combined.sym:
+ @mkdir -p $(DIR_GENCRT)
+ @rm -f $@* $(DIR_GENCRT)/KERNAL_0*
+ @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r CRT -s KERNAL_0 -i KERNAL_0-generic-crt -o OUTK_0.BIN -d $(DIR_GENCRT) -l e4d3 -h ffff $(CFG_GENCRT) $(GEN_STR_GENCRT) $(SRCDIR_KERNAL) $(GEN_KERNAL)
+
+$(DIR_GENCRT)/basic.seg_1 $(DIR_GENCRT)/BASIC_1_combined.vs $(DIR_GENCRT)/BASIC_1_combined.sym:
+ @mkdir -p $(DIR_GENCRT)
+ @rm -f $@* $(DIR_GENCRT)/basic.seg_1 $(DIR_GENCRT)/BASIC_1*
+ @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r CRT -s BASIC_1 -i BASIC_1-generic-crt -o basic.seg_1 -d $(DIR_GENCRT) -l 8000 -h 9fff $(CFG_GENCRT) $(GEN_STR_GENCRT) $(SRCDIR_BASIC) $(GEN_BASIC)
+
+$(DIR_GENCRT)/kernal.seg_1 $(DIR_GENCRT)/KERNAL_1_combined.vs $(DIR_GENCRT)/KERNAL_1_combined.sym:
+ @mkdir -p $(DIR_GENCRT)
+ @rm -f $@* $(DIR_GENCRT)/kernal.seg_1 $(DIR_GENCRT)/KERNAL_1*
+ @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r CRT -s KERNAL_1 -i KERNAL_1-generic-crt -o kernal.seg_1 -d $(DIR_GENCRT) -l 8000 -h 9fff $(CFG_GENCRT) $(GEN_STR_GENCRT) $(SRCDIR_KERNAL) $(GEN_KERNAL)
+
+$(DIR_U64CRT)/OUTB_0.BIN $(DIR_U64CRT)/BASIC_0_combined.vs $(DIR_U64CRT)/BASIC_0_combined.sym:
+ @mkdir -p $(DIR_U64CRT)
+ @rm -f $@* $(DIR_U64CRT)/BASIC_0*
+ @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r CRT -s BASIC_0 -i BASIC_0-ultimate64-crt -o OUTB_0.BIN -d $(DIR_U64CRT) -l a000 -h e4d2 $(CFG_U64CRT) $(GEN_STR_U64CRT) $(SRCDIR_BASIC) $(GEN_BASIC)
+
+$(DIR_U64CRT)/OUTK_0.BIN $(DIR_U64CRT)/KERNAL_0_combined.vs $(DIR_U64CRT)/KERNAL_0_combined.sym:
+ @mkdir -p $(DIR_U64CRT)
+ @rm -f $@* $(DIR_U64CRT)/KERNAL_0*
+ @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r CRT -s KERNAL_0 -i KERNAL_0-ultimate64-crt -o OUTK_0.BIN -d $(DIR_U64CRT) -l e4d3 -h ffff $(CFG_U64CRT) $(GEN_STR_U64CRT) $(SRCDIR_KERNAL) $(GEN_KERNAL)
+
+$(DIR_U64CRT)/basic.seg_1 $(DIR_U64CRT)/BASIC_1_combined.vs $(DIR_U64CRT)/BASIC_1_combined.sym:
+ @mkdir -p $(DIR_U64CRT)
+ @rm -f $@* $(DIR_U64CRT)/basic.seg_1 $(DIR_U64CRT)/BASIC_1*
+ @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r CRT -s BASIC_1 -i BASIC_1-ultimate64-crt -o basic.seg_1 -d $(DIR_U64CRT) -l 8000 -h 9fff $(CFG_U64CRT) $(GEN_STR_U64CRT) $(SRCDIR_BASIC) $(GEN_BASIC)
+
+$(DIR_U64CRT)/kernal.seg_1 $(DIR_U64CRT)/KERNAL_1_combined.vs $(DIR_U64CRT)/KERNAL_1_combined.sym:
+ @mkdir -p $(DIR_U64CRT)
+ @rm -f $@* $(DIR_U64CRT)/kernal.seg_1 $(DIR_U64CRT)/KERNAL_1*
+ @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r CRT -s KERNAL_1 -i KERNAL_1-ultimate64-crt -o kernal.seg_1 -d $(DIR_U64CRT) -l 8000 -h 9fff $(CFG_U64CRT) $(GEN_STR_U64CRT) $(SRCDIR_KERNAL) $(GEN_KERNAL)
+
# 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:
@@ -425,6 +557,24 @@ build/basic_%.rom:
build/symbols_%.vs:
@sort build/target_$*/BASIC_combined.vs build/target_$*/KERNAL_combined.vs | uniq | grep -v "__" > $@
+$(DIR_GENCRT)/OUTx_0.BIN:
+ @cat $(DIR_GENCRT)/OUTB_0.BIN $(DIR_GENCRT)/OUTK_0.BIN > $@
+
+$(DIR_GENCRT)/kernal.seg_0: $(DIR_GENCRT)/OUTx_0.BIN
+ @dd if=$(DIR_GENCRT)/OUTx_0.BIN bs=8192 count=1 skip=2 of=$@ status=none
+
+$(DIR_GENCRT)/basic.seg_0: $(DIR_GENCRT)/OUTx_0.BIN
+ @dd if=$(DIR_GENCRT)/OUTx_0.BIN bs=8192 count=1 skip=0 of=$@ status=none
+
+$(DIR_U64CRT)/OUTx_0.BIN:
+ @cat $(DIR_U64CRT)/OUTB_0.BIN $(DIR_U64CRT)/OUTK_0.BIN > $@
+
+$(DIR_U64CRT)/kernal.seg_0: $(DIR_U64CRT)/OUTx_0.BIN
+ @dd if=$(DIR_U64CRT)/OUTx_0.BIN bs=8192 count=1 skip=2 of=$@ status=none
+
+$(DIR_U64CRT)/basic.seg_0: $(DIR_U64CRT)/OUTx_0.BIN
+ @dd if=$(DIR_U64CRT)/OUTx_0.BIN bs=8192 count=1 skip=0 of=$@ status=none
+
$(DIR_M65)/OUTx_0.BIN:
@cat $(DIR_M65)/OUTB_0.BIN $(DIR_M65)/OUTK_0.BIN > $@
@@ -443,6 +593,24 @@ $(DIR_X16)/kernal.seg_0: $(DIR_X16)/OUTx_0.BIN
$(DIR_X16)/basic.seg_0: $(DIR_X16)/OUTx_0.BIN
@dd if=$(DIR_X16)/OUTx_0.BIN bs=8192 count=1 skip=0 of=$@ status=none
+$(TARGET_GENCRT_K): $(DIR_GENCRT)/OUTx_0.BIN
+ @dd if=$(DIR_GENCRT)/OUTx_0.BIN bs=8192 count=1 skip=2 of=$@ status=none
+
+$(TARGET_GENCRT_B): $(DIR_GENCRT)/OUTx_0.BIN
+ @dd if=$(DIR_GENCRT)/OUTx_0.BIN bs=8192 count=1 skip=0 of=$@ status=none
+
+$(TARGET_U64CRT_K): $(DIR_U64CRT)/OUTx_0.BIN
+ @dd if=$(DIR_U64CRT)/OUTx_0.BIN bs=8192 count=1 skip=2 of=$@ status=none
+
+$(TARGET_U64CRT_B): $(DIR_U64CRT)/OUTx_0.BIN
+ @dd if=$(DIR_U64CRT)/OUTx_0.BIN bs=8192 count=1 skip=0 of=$@ status=none
+
+build/symbols_generic_crt.vs:
+ @sort $(DIR_GENCRT)/BASIC_0_combined.vs $(DIR_GENCRT)/KERNAL_0_combined.vs | uniq | grep -v "__" > $@
+
+build/symbols_ultimate64_crt.vs:
+ @sort $(DIR_U64CRT)/BASIC_0_combined.vs $(DIR_U64CRT)/KERNAL_0_combined.vs | uniq | grep -v "__" > $@
+
build/kernal_hybrid.rom: kernal $(DIR_GEN)/OUTK_x.BIN
@echo
@echo $(HYBRID_WARNING)
@@ -455,41 +623,95 @@ build/kernal_hybrid.rom: kernal $(DIR_GEN)/OUTK_x.BIN
build/symbols_hybrid.vs: $(DIR_GEN)/KERNAL_combined.vs
@sort $(DIR_GEN)/KERNAL_combined.vs | uniq | grep -v "__" > $@
+build/kernal_hybrid_u64.rom: kernal $(DIR_U64)/OUTK_x.BIN
+ @echo
+ @echo $(HYBRID_WARNING)
+ @echo
+ (dd if=kernal bs=1140 count=1 skip=0 ; \
+ echo " > HYBRID ROM, DON'T DISTRIBUTE <" ; \
+ dd if=kernal bs=1 count=58 skip=1176 ; \
+ cat $(DIR_U64)/OUTK_x.BIN) > $@
+
+build/symbols_hybrid_u64.vs: $(DIR_U64)/KERNAL_combined.vs
+ @sort $(DIR_U64)/KERNAL_combined.vs | uniq | grep -v "__" > $@
+
+# Rules - external CRT images
+
+build/padding_8_KB:
+ @mkdir -p build
+ @dd if=/dev/zero bs=8192 count=1 of=$@ status=none
+
+$(TARGET_GENCRT_X): $(SEG_LIST_GENCRT) $(CRT_BIN_LIST) build/padding_8_KB
+ @echo
+ @echo
+ @echo
+ @echo //-------------------------------------------------------------------------------------------
+ @echo // Making external CRT ROM image - generic
+ @echo //-------------------------------------------------------------------------------------------
+ @cat assets/cartridge/header-cart.bin > $@
+ @cat assets/cartridge/header-seg0.bin >> $@
+ @cat $(DIR_GENCRT)/basic.seg_1 >> $@
+ @cat assets/cartridge/header-seg1.bin >> $@
+ @cat build/padding_8_KB >> $@
+ @cat assets/cartridge/header-seg2.bin >> $@
+ @cat $(DIR_GENCRT)/kernal.seg_1 >> $@
+ @cat assets/cartridge/header-seg3.bin >> $@
+ @cat build/padding_8_KB >> $@
+ @echo
+
+$(TARGET_U64CRT_X): $(SEG_LIST_U64CRT) $(CRT_BIN_LIST) build/padding_8_KB
+ @echo
+ @echo
+ @echo
+ @echo //-------------------------------------------------------------------------------------------
+ @echo // Making external CRT ROM image - Ultimate 64
+ @echo //-------------------------------------------------------------------------------------------
+ @cat assets/cartridge/header-cart.bin > $@
+ @cat assets/cartridge/header-seg0.bin >> $@
+ @cat $(DIR_U64CRT)/basic.seg_1 >> $@
+ @cat assets/cartridge/header-seg1.bin >> $@
+ @cat build/padding_8_KB >> $@
+ @cat assets/cartridge/header-seg2.bin >> $@
+ @cat $(DIR_U64CRT)/kernal.seg_1 >> $@
+ @cat assets/cartridge/header-seg3.bin >> $@
+ @cat build/padding_8_KB >> $@
+ @echo
+
# Rules - MEGA65 platform specific
build/padding_64_KB:
@mkdir -p build
- @dd if=/dev/zero bs=8192 count=8 of=build/padding_64_KB status=none
+ @dd if=/dev/zero bs=8192 count=8 of=$@ status=none
-$(TARGET_M65_x) $(TARGET_M65_x_PXL): $(SEG_LIST_M65) build/padding_64_KB build/chargen_openroms.rom build/chargen_openroms.patched build/chargen_pxlfont.rom build/chargen_pxlfont.patched
+$(TARGET_M65_x_ORF) $(TARGET_M65_x_PXL): $(SEG_LIST_M65) build/padding_64_KB $(TARGET_CHR_ORF) build/chargen_openroms.patched $(TARGET_CHR_PXL) build/chargen_pxlfont.patched
@echo
@echo
@echo
@echo //-------------------------------------------------------------------------------------------
@echo // Making ROM image for MEGA65 - with Open ROMs chargen
@echo //-------------------------------------------------------------------------------------------
- @cat $(DIR_M65)/dos.seg_1 > $(TARGET_M65_x)
- @cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x)
- @cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x)
- @cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x)
- @cat build/chargen_openroms.rom >> $(TARGET_M65_x)
- @cat build/chargen_openroms.patched >> $(TARGET_M65_x)
- @cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x)
- @cat build/padding_64_KB >> $(TARGET_M65_x)
+ @cat $(DIR_M65)/dos.seg_1 > $(TARGET_M65_x_ORF)
+ @cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x_ORF)
+ @cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x_ORF)
+ @cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x_ORF)
+ @cat $(TARGET_CHR_ORF) >> $(TARGET_M65_x_ORF)
+ @cat build/chargen_openroms.patched >> $(TARGET_M65_x_ORF)
+ @cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x_ORF)
+ @cat build/padding_64_KB >> $(TARGET_M65_x_ORF)
@echo
@echo
@echo
@echo //-------------------------------------------------------------------------------------------
@echo // Making ROM image for MEGA65 - with PXL font chargen
@echo //-------------------------------------------------------------------------------------------
- @cat $(DIR_M65)/dos.seg_1 > $(TARGET_M65_x_PXL)
- @cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x_PXL)
- @cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x_PXL)
- @cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x_PXL)
- @cat build/chargen_pxlfont.rom >> $(TARGET_M65_x_PXL)
- @cat build/chargen_pxlfont.patched >> $(TARGET_M65_x_PXL)
- @cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x_PXL)
- @cat build/padding_64_KB >> $(TARGET_M65_x_PXL)
+ @cat $(DIR_M65)/dos.seg_1 > $(TARGET_M65_x_PXL)
+ @cat $(DIR_M65)/kernal.seg_1 >> $(TARGET_M65_x_PXL)
+ @cat $(DIR_M65)/basic.seg_1 >> $(TARGET_M65_x_PXL)
+ @cat $(DIR_M65)/basic.seg_0 >> $(TARGET_M65_x_PXL)
+ @cat $(TARGET_CHR_PXL) >> $(TARGET_M65_x_PXL)
+ @cat build/chargen_pxlfont.patched >> $(TARGET_M65_x_PXL)
+ @cat $(DIR_M65)/kernal.seg_0 >> $(TARGET_M65_x_PXL)
+ @cat build/padding_64_KB >> $(TARGET_M65_x_PXL)
@echo
# Rules - platform 'Commander X16' specific
@@ -510,39 +732,54 @@ $(TARGET_X16_x): $(SEG_LIST_X16) build/chargen_openroms.rom
# Rules - tests
-.PHONY: test test_generic test_generic_x128 test_hybrid test_testing \
- test_mega65 test_mega65_xemu test_m65 \
- test_ultimate64 \
+.PHONY: test test_crt test_generic test_generic_x128 test_generic_crt test_hybrid test_testing \
+ test_mega65 test_mega65_xemu test_m65 test_ultimate64 \
testremote testsimilarity
-test: test_custom
+test: test_custom
+test_crt: test_generic_crt
-test_custom: build/kernal_custom.rom build/basic_custom.rom build/symbols_custom.vs
- x64 -kernal build/kernal_custom.rom -basic build/basic_custom.rom -moncommands build/symbols_custom.vs -1 $(TESTTAPE) -8 $(TESTDISK)
+test_custom: $(TARGET_LIST_CUS) $(TARGET_CHR_PXL) build/symbols_custom.vs
+ x64 -kernal $(TARGET_CUS_K) -basic $(TARGET_CUS_B) -chargen $(TARGET_CHR_PXL) -moncommands build/symbols_custom.vs -1 $(TESTTAPE) -8 $(TESTDISK)
-test_generic: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs
- x64 -kernal build/kernal_generic.rom -basic build/basic_generic.rom -moncommands build/symbols_generic.vs -1 $(TESTTAPE) -8 $(TESTDISK)
+test_generic: $(TARGET_LIST_GEN)$(TARGET_CHR_PXL) build/symbols_generic.vs
+ x64 -kernal $(TARGET_GEN_K) -basic $(TARGET_GEN_B) -chargen $(TARGET_CHR_PXL) -moncommands build/symbols_generic.vs -1 $(TESTTAPE) -8 $(TESTDISK)
-test_generic_x128: build/kernal_generic.rom build/basic_generic.rom build/symbols_generic.vs
- x128 -go64 -kernal64 build/kernal_generic.rom -basic64 build/basic_generic.rom -moncommands build/symbols_generic.vs -1 $(TESTTAPE) -8 $(TESTDISK)
+test_generic_x128: $(TARGET_LIST_GEN) $(TARGET_CHR_PXL) build/symbols_generic.vs
+ x128 -go64 -kernal64 $(TARGET_GEN_K) -basic64 $(TARGET_GEN_B) -chargen $(TARGET_CHR_PXL) -moncommands build/symbols_generic.vs -1 $(TESTTAPE) -8 $(TESTDISK)
-test_testing: build/kernal_testing.rom build/basic_testing.rom build/symbols_testing.vs
- x64 -kernal build/kernal_testing.rom -basic build/basic_testing.rom -moncommands build/symbols_testing.vs -1 $(TESTTAPE) -8 $(TESTDISK)
+test_generic_crt: $(TARGET_LIST_GENCRT) $(TARGET_CHR_PXL) build/symbols_generic_crt.vs
+ x64 -kernal $(TARGET_GENCRT_K) -basic $(TARGET_GENCRT_B) -chargen $(TARGET_CHR_PXL) -cartcrt $(TARGET_GENCRT_X) -moncommands build/symbols_generic_crt.vs -1 $(TESTTAPE) -8 $(TESTDISK)
-test_ultimate64: build/kernal_ultimate64.rom build/basic_ultimate64.rom build/symbols_ultimate64.vs
- x64 -kernal build/kernal_ultimate64.rom -basic build/basic_ultimate64.rom -moncommands build/symbols_ultimate64.vs -1 $(TESTTAPE) -8 $(TESTDISK)
+test_testing: $(TARGET_LIST_TST) $(TARGET_CHR_PXL) build/symbols_testing.vs
+ x64 -kernal $(TARGET_TST_K) -basic $(TARGET_TST_B) -chargen $(TARGET_CHR_PXL) -moncommands build/symbols_testing.vs -1 $(TESTTAPE) -8 $(TESTDISK)
-test_mega65: $(TARGET_M65_x) $(TARGET_M65_x_PXL)
+test_ultimate64: $(TARGET_LIST_U64) $(TARGET_CHR_PXL) build/symbols_ultimate64.vs
+ x64 -kernal $(TARGET_U64_K) -basic $(TARGET_U64_B) -chargen $(TARGET_CHR_PXL) -moncommands build/symbols_ultimate64.vs -1 $(TESTTAPE) -8 $(TESTDISK)
+
+test_ultimate64_crt: $(TARGET_LIST_U64CRT) $(TARGET_CHR_PXL) build/symbols_ultimate64_crt.vs
+ x64 -kernal $(TARGET_U64CRT_K) -basic $(TARGET_U64CRT_B) -chargen $(TARGET_CHR_PXL) -cartcrt $(TARGET_U64CRT_X) -moncommands build/symbols_ultimate64_crt.vs -1 $(TESTTAPE) -8 $(TESTDISK)
+
+test_mega65: $(TARGET_M65_x_ORF) $(TARGET_M65_x_PXL)
../xemu/build/bin/xmega65.native -dmarev 2 -besure -fontrefresh -forcerom -loadrom $(TARGET_M65_x_PXL)
test_cx16: $(TARGET_X16_x)
../x16-emulator/x16emu -rom $(TARGET_X16_x)
-test_hybrid: build/kernal_hybrid.rom build/symbols_hybrid.vs
+test_hybrid: build/kernal_hybrid.rom $(TARGET_CHR_PXL) build/symbols_hybrid.vs
@echo
@echo $(HYBRID_WARNING)
@echo
- x64 -kernal build/kernal_hybrid.rom -moncommands build/symbols_hybrid.vs -1 $(TESTTAPE) -8 $(TESTDISK)
+ x64 -kernal build/kernal_hybrid.rom -chargen $(TARGET_CHR_PXL) -moncommands build/symbols_hybrid.vs -1 $(TESTTAPE) -8 $(TESTDISK)
+ @echo
+ @echo $(HYBRID_WARNING)
+ @echo
+
+test_hybrid_u64: build/kernal_hybrid_u64.rom $(TARGET_CHR_PXL) build/symbols_hybrid_u64.vs
+ @echo
+ @echo $(HYBRID_WARNING)
+ @echo
+ x64 -kernal build/kernal_hybrid_u64.rom -chargen $(TARGET_CHR_PXL) -moncommands build/symbols_hybrid_u64.vs -1 $(TESTTAPE) -8 $(TESTDISK)
@echo
@echo $(HYBRID_WARNING)
@echo
@@ -550,8 +787,8 @@ test_hybrid: build/kernal_hybrid.rom build/symbols_hybrid.vs
test_m65: build/mega65.rom
m65 -b ../mega65-core/bin/mega65r1.bit -k ../mega65-core/bin/KICKUP.M65 -R build/mega65.rom -4
-testremote: build/kernal_custom.rom build/basic_custom.rom build/symbols_custom.vs
- x64 -kernal build/kernal_custom.rom -basic build/basic_custom.rom -moncommands build/symbols_custom.vs -remotemonitor
+testremote: build/kernal_custom.rom build/basic_custom.rom $(TARGET_CHR_PXL) build/symbols_custom.vs
+ x64 -kernal build/kernal_custom.rom -basic build/basic_custom.rom -chargen $(TARGET_CHR_PXL) -moncommands build/symbols_custom.vs -remotemonitor
testsimilarity: $(TOOL_SIMILARITY) $(DIR_GEN)/OUTx_x.BIN kernal basic
$(TOOL_SIMILARITY) kernal $(DIR_GEN)/OUTx_x.BIN
diff --git a/STATUS.md b/STATUS.md
index 796b2b6c..ba005490 100644
--- a/STATUS.md
+++ b/STATUS.md
@@ -18,7 +18,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8
* `LIST` command should never damage the screen if trying to list memory content which is not a BASIC program
* high performance garbage collector
-* turbo tape load support (as device 7, or using `←L` / `←M`, optionally with a file name), quite sophisticated: up to 250 blocks (can store bytes under I/O), automatically adjusts for tape speed differences
+* turbo tape load support (as device 7, or using `←L` / `←M`, optionally with a file name), quite sophisticated: up to 250 blocks (can store bytes under I/O), on MEGA65 motherboard automatically adjusts itself for tape speed differences
* normal tape load error log is limited by free stack space only (no artificial limitation like in original ROMs)
* tape format autodetection; normal vs turbo is mostly transparent to user
* improved support for tape adapters (for using regular casette players and other audio devices instead of Datasette) and emulators
diff --git a/assets/cartridge/header-cart.bin b/assets/cartridge/header-cart.bin
new file mode 100644
index 00000000..648e9263
Binary files /dev/null and b/assets/cartridge/header-cart.bin differ
diff --git a/assets/cartridge/header-seg0.bin b/assets/cartridge/header-seg0.bin
new file mode 100644
index 00000000..93ce79c4
Binary files /dev/null and b/assets/cartridge/header-seg0.bin differ
diff --git a/assets/cartridge/header-seg1.bin b/assets/cartridge/header-seg1.bin
new file mode 100644
index 00000000..08c3a860
Binary files /dev/null and b/assets/cartridge/header-seg1.bin differ
diff --git a/assets/cartridge/header-seg2.bin b/assets/cartridge/header-seg2.bin
new file mode 100644
index 00000000..ce639ff4
Binary files /dev/null and b/assets/cartridge/header-seg2.bin differ
diff --git a/assets/cartridge/header-seg3.bin b/assets/cartridge/header-seg3.bin
new file mode 100644
index 00000000..7410e4d3
Binary files /dev/null and b/assets/cartridge/header-seg3.bin differ
diff --git a/bin/README.md b/bin/README.md
new file mode 100644
index 00000000..b7c980d7
--- /dev/null
+++ b/bin/README.md
@@ -0,0 +1,36 @@
+
+Follow these rules, or bad things will happen!
+
+* Don't mix ROMs for different platforms - use generic BASIC with generic KERNAL, Ultimate64 BASIC with Ultimate64 KERNAL, etc.
+
+* Don't mix these ROMs with any other ROMs; exceptions:
+
+ - kernal_hybrid\*.rom, which is meant to be used (and has to be used) with the original BASIC ROM;
+ however, these hybrid ROMs cannot be distributed due to legal/copyright reasons; see [here](./../doc/Hybrid-build.md) for instruction how to create them
+
+ - chargen_*.rom - these ones are fully interchangeable
+
+* Don't mix ROMs from different builds/versions (again, CHARGEN is an exception).
+
+* The generic ROM set should be compatible with any C64-compatible machine; platform-specific ROMs might not work on other platforms.
+
+
+
+For Ultimate 64 motherboard the following settings are recommended:
+
+* U64 Specific Settings -> Turbo Control -> U64 Turbo Registers
+
+
+
+The \*\_crt ROM set is a special version, with some code moved to external ROM on the cartridge - thus, more features could be enabled. It needs all the 3 files (BASIC, Kernal, cartridge) to be operable.
+
+
+
+Have fun!
+
+
+
+------
+
+
+PXL font was created by Retrofan, we got a permission to include it with Open ROMs under GNU Lesser General Public License 3.0, see [here](https://www.forum64.de/index.php?thread/84000-neuer-c64-systemfont-auch-plus4-c128-atari/&postID=1493383#post1493383).
diff --git a/bin/README.txt b/bin/README.txt
deleted file mode 100644
index 806e59cf..00000000
--- a/bin/README.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-
-Follow these rules, or bad things will happen!
-
-
-- Don't mix ROMs for different platforms - use generic BASIC with generic KERNAL, Ultimate64 BASIC with Ultimate64 KERNAL, etc.
-
-- Don't mix these ROMs with any other ROMs; exceptions:
-
- - kernal_hybrid.rom, which is meant to be used (and has to be used) with the original BASIC ROM;
- however, this hybrid ROM cannot be distributed due to legal/copyright reasons
-
- - chargen_*.rom - these ones are fully interchangeable
-
-- Don't mix ROMs from different builds/versions (again, CHARGEN is an exception).
-
-- The generic ROM set should be compatible with any C64-compatible machine; platform-specific ROMs might not work on other platforms.
-
-
-Have fun!
-
-
-------
-
-
-PXL font was created by Retrofan, we got a permission to include it with Open ROMs under GNU Lesser General Public License 3.0, see:
-
-- https://www.forum64.de/index.php?thread/84000-neuer-c64-systemfont-auch-plus4-c128-atari/&postID=1493383#post1493383
diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom
index 4f9e17cb..6d8d0ed8 100644
Binary files a/bin/basic_generic.rom and b/bin/basic_generic.rom differ
diff --git a/bin/basic_generic_crt.rom b/bin/basic_generic_crt.rom
new file mode 100644
index 00000000..1a115f89
Binary files /dev/null and b/bin/basic_generic_crt.rom differ
diff --git a/bin/basic_ultimate64.rom b/bin/basic_ultimate64.rom
index cfe26a4d..029dbe3e 100644
Binary files a/bin/basic_ultimate64.rom and b/bin/basic_ultimate64.rom differ
diff --git a/bin/extrom_generic_crt.crt b/bin/extrom_generic_crt.crt
new file mode 100644
index 00000000..1dbfdc03
Binary files /dev/null and b/bin/extrom_generic_crt.crt differ
diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom
index 5d7381c1..9d6d01f0 100644
Binary files a/bin/kernal_generic.rom and b/bin/kernal_generic.rom differ
diff --git a/bin/kernal_generic_crt.rom b/bin/kernal_generic_crt.rom
new file mode 100644
index 00000000..a23ba2c6
Binary files /dev/null and b/bin/kernal_generic_crt.rom differ
diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom
index f278760c..1d5b01dc 100644
Binary files a/bin/kernal_ultimate64.rom and b/bin/kernal_ultimate64.rom differ
diff --git a/bin/mega65.rom b/bin/mega65.rom
index b5b722db..2b08841d 100644
Binary files a/bin/mega65.rom and b/bin/mega65.rom differ
diff --git a/bin/mega65_pxlfont.rom b/bin/mega65_pxlfont.rom
index 9afc3524..4c18426b 100644
Binary files a/bin/mega65_pxlfont.rom and b/bin/mega65_pxlfont.rom differ
diff --git a/doc/Development.md b/doc/Development.md
index 9d9ad202..a63ed9b9 100644
--- a/doc/Development.md
+++ b/doc/Development.md
@@ -78,26 +78,29 @@ Make sure to read the main [README](../README.md) first - although any help with
List of the most important make targets:
-| target | description |
-| :------------------ | :------------------------------------------------------------------------------ |
-| `all` | builds all ROMs, places them in 'build' subdirectory |
-| `clean` | removes all the compilation results and intermediate files |
-| `updatebin` | upates ROMs in 'bin' subdirectory - with embedded version string, for release |
-| `testsimilarity` | launches the similarity tool, see [README](../README.md) |
-| `test` | builds the 'custom' configuration, launches it using VICE emulator |
-| `test_generic` | builds the default ROMs, for generic C64/C128, launches using VICE |
-| `test_generic_x128` | as above, but launches C128 emulator instead |
-| `test_mega65` | builds the MEGA65 ROM, launches it using XEMU emulator |
-| `test_ultimate64` | builds the Ultimate 64 configuration, launches it using VICE emulator |
-| `test_hybrid` | builds a hybrid ROM (Open ROMs Kernal + original BASIC), launches it using VICE |
-| `test_testing` | builds a rather odd testing configuration, launches it using VICE emulator |
+| target | description |
+| :-------------------- | :------------------------------------------------------------------------------ |
+| `all` | builds all ROMs, places them in 'build' subdirectory |
+| `clean` | removes all the compilation results and intermediate files |
+| `updatebin` | upates ROMs in 'bin' subdirectory - with embedded version string, for release |
+| `testsimilarity` | launches the similarity tool, see [README](../README.md) |
+| `test` | builds the 'custom' configuration, launches it using VICE emulator |
+| `test_generic` | builds the default ROMs, for generic C64/C128, launches using VICE |
+| `test_generic_x128` | as above, but launches C128 emulator instead |
+| `test_generic_crt` | builds the default ROM with extended cartridge image, launches using VICE |
+| `test_mega65` | builds the MEGA65 ROM, launches it using XEMU emulator |
+| `test_ultimate64` | builds the Ultimate 64 configuration, launches it using VICE |
+| `test_ultimate64_crt` | as above, ROM with extended cartriodge image |
+| `test_hybrid` | builds a hybrid ROM (Open ROMs Kernal + original BASIC), launches it using VICE |
+| `test_testing` | builds a rather odd testing configuration, launches it using VICE |
### Code segments and ROM layouts
-Currently there are 3 ROM layouts defined:
+Currently there are 4 ROM layouts defined:
- `STD` - with 2 code segments: `BASIC` (`$A000-$E4D2`, where `$C000-$DFFF` is a skip-gap for RAM and I/O area) and `KERNAL` (`$E4D3 - $FFFF`)
+- `CRT` - where `BASIC` becames `BASIC_0` and `KERNAL` becames `KERNAL_0`, with additional `BASIC`/`KERNAL` segments are placed on the required cartridge image
- `M65` - where `BASIC` becames `BASIC_0` and `KERNAL` becames `KERNAL_0`, additional segments might be added to the build system in the future; at the moment of writing this document additional 16KB of ROM is defined as `BASIC_1` segment and additional 8KB of ROM is defined as `KERNAL_1` segment
- `X16` - memory layout for the Commander X16 machine
diff --git a/doc/Extended-BASIC.md b/doc/Extended-BASIC.md
index eeccfae3..1ea35116 100644
--- a/doc/Extended-BASIC.md
+++ b/doc/Extended-BASIC.md
@@ -1,7 +1,7 @@
# Extended BASIC
-NOTE: Command syntax, behaviour details, and tokens are still subject to change! Currently the availability of some depends on the build configuration, in the future most (if not all) extended commands will be available only on machines with extended ROM, like the MEGA65 or Ultimate 64.
+NOTE: Command syntax, behaviour details, and tokens are still subject to change! Currently the availability of some depends on the build configuration, in the future most (if not all) extended commands will be available only on machines with extended ROM, like the *MEGA65*, *Ultimate 64*, or a build utilizing cartridge with external ROM (build marked as *cart*).
## DOS Wedge
@@ -29,57 +29,61 @@ Sends the DOS command to the current unit.
## Tape Wedge
-The Tape Wedge commands are only available in direct mode, and they have to start from the first character of the line.
+The Tape Wedge commands are only available in direct mode, and they have to start from the first character of the line. It is designed to ressemble wedge from *BlackBox* series of cartridges and several tape turbo implementations.
### `←L ["file_name"]` (all)
-Loads the file from tape. Depending on the configuration, it tries to load the file in TurboTape 64 format, in the standard CBM format, or autodetects the file format.
+Loads the file from tape. Depending on the configuration, it tries to load the file:
+* in any format (standard/turbo) - if format autodetection is compiled in
+* in *TurboTape 64* format - if turbo support is compiled in
+* in the normal CBM format - if only this one is compiled in
### `←M ["file_name"]` (all)
Like above, but merges a BASIC program to the one already stored in memory.
-### `←H` (MEGA65)
+### `←H` or `←HF` (cart, MEGA65)
-Launches a built-in tape head alignment tool. Destroys program in memory. Press `RUN/STOP` to terminate the tool.
+Launches a built-in tape head alignment tool. Destroys program in memory. Press `RUN/STOP` to terminate the tool. `←HF` is for compatibility with the *BlackBox v3/v4/v8* cartridges.
## Additional BASIC commands - I/O
-### `MERGE "file_name" [, device_number]` (all)
+### Device numbers
+
+* if tape format autodetection is compiled-in, you can load file from tape using either device #1 (CBM compatible way) or from device #7 (in a way compatible with *Final* and *Action Replay* cartridges)
+* if autodetection is not available, than device #1 means normal CBM format, and device #7 means *Turbo Tape 64* format
+
+### `MERGE "file_name" [, device_number]` (cart, MEGA65)
Appends the BASIC program from a storage medium to the one currently present in memory.
-### `BLOAD "file_name", device_number, start_address` (all)
+### `BLOAD "file_name", device_number, start_address` (cart, MEGA65)
Loads a binary file starting from the given memory location. Does not clear variables, does not perform BASIC program relinking, etc. NOTE: for now syntax differs from the BASIC V3.5+ - this will be changed once the necessary BASIC infrastructure is implemented.
-### `BVERIFY "file_name", device_number, start_address` (all)
+### `BVERIFY "file_name", device_number, start_address` (cart, MEGA65)
Verify operation for the binary data starting from a given addres. NOTE: for now syntax differs from the BASIC V3.5+ - this will be changed once the necessary BASIC infrastructure is implemented.
-### `BSAVE "file_name", device_number, start_address, end_address` (all)
+### `BSAVE "file_name", device_number, start_address, end_address` (cart, MEGA65)
Saves the binary data from the given memory area. NOTE: for now syntax differs from the BASIC V3.5+ - this will be changed once the necessary BASIC infrastructure is implemented.
## Additional BASIC commands - misc
-### `COLD` (MEGA65)
+### `COLD` (cart, MEGA65)
Resets the machine. In direct mode asks for confirmation first.
-### `FAST` (all)
+### `FAST`, `SLOW` (all)
-Tries to switch the machine to turbo mode - details differ depending on the configured machine / motherboard.
-
-### `SLOW` (all)
-
-Tries to switch the machine back to 1 MHz operation mode.
+Tries to switch the machine to turbo mode (or back to 1MHz operation mode) - details differ depending on the configured machine / motherboard. On MEGA65 motherboard this is not available in native mode, it is not designed to run in 1MHz due to using compound CPU instructions usage.
### `OLD` (all)
Tries to restore program destroyed by the `NEW` command or a reset.
-### `MEM` (MEGA65)
+### `MEM` (cart, MEGA65)
Displays BASIC memory usage information:
* `TEXT` - size of BASIC program text, always at least 2 bytes are used
@@ -92,11 +96,11 @@ Displays BASIC memory usage information:
Displays various system information.
-### `CLEAR` (all)
+### `CLEAR` (cart, MEGA65)
Clears the screen content.
-### `DISPOSE` (all)
+### `DISPOSE` (cart, MEGA65)
Runs the garbage collector - disposes outdated strings.
@@ -110,4 +114,4 @@ Switches machine to C64 compatibility mode or to MEGA65 native mode. Performs `C
### `IF MEGA65 THEN`, `IF MEGA65 GOTO` (MEGA65)
-Special check for running under MEGA65. The `MEGA65` string is not tokenized, therefore it will be listed properly even under original BASIC V2. `MEGA65` is not a variable here - it is still possible to normally use the `ME` variable.
+Special check for running on *MEGA65* motherboard. The `MEGA65` string is not tokenized, therefore it will be listed properly even under original BASIC V2. `MEGA65` is not a variable here - it is still possible to normally use the `ME` variable.
diff --git a/doc/Hybrid-build.md b/doc/Hybrid-build.md
new file mode 100644
index 00000000..f3d54552
--- /dev/null
+++ b/doc/Hybrid-build.md
@@ -0,0 +1,15 @@
+
+The C64 ROM is typically distributed in 2 files 8 KB each, one called *kernal*, one *basic*. This might be misleading, as the C64 Kernal takes about 6.5 KB, and the BASIC about 9.5 KB - some parts of BASIC is therefore placed in the *kernal* file. This is the main reason you can't easily use the Open ROMs Kernal file with original C64 BASIC.
+
+But it is still possible to combine them:
+* copy the *kernal* file to the *open-roms* main directory
+* from the Linux command line type `make test_hybrid` on `make test_hybrid_u64` (for Ultimate 64 based Kernal build- this will crate the hybrid Kernal file, *open-roms/bin/kernal_hybrid.rom* or *open-roms/bin/kernal_hybrid_u64.rom*, and launch VICE emulator with it
+
+Unfortunately, some features will be lost this way - for example, the Open ROMs DOS Wedge is BASIC based, so it won't be available in the hybrid ROM.
+
+Sorry, no Windows support (but it should work under *Windows Subsystem for Linux* if GCC and libpng devel packages are installed), and no macOS support (I don't have a machine to test).
+
+Please note, that it is illegal to distribute such a hybrid ROM:
+
+* it contains proprietary Commodore/Microsoft code
+* it contains LGPL 3 licensed Open ROMs code combined with code not available under compatible license
diff --git a/doc/Protocol-DolphinDOS.md b/doc/Protocol-DolphinDOS.md
index 776cf55c..cd95e738 100644
--- a/doc/Protocol-DolphinDOS.md
+++ b/doc/Protocol-DolphinDOS.md
@@ -21,7 +21,7 @@ Timing is no more strict than standard IEC protocol - I have checked using VICE
Detection happens after `OPEN` (0xF0 - 0xFF) or `REOPEN` (0x60 - 0x6F) IEC command is sent from the controller and is very simple.
-The CIA2 port B has to be set for reading (interrupts for the port are disabled by writing $7F to $DD0D). The controller constantly reads (not sure if there is a countdown or timeout in the original DolphinDOS ROM, countdoown started from $20 seems more than enough) the CIA2 interrupt control and port B registers; when ICR reads $10 (again - not sure if just the bit is checked, or the whole register), bus controller assumes the receiver talks the DolphinDOS protocol.
+The CIA2 port B has to be set for reading (interrupts for the port are disabled by writing $7F to $DD0D). The controller constantly reads (not sure if there is a countdown or timeout in the original DolphinDOS ROM, countdown started from $20 seems more than enough) the CIA2 interrupt control and port B registers; when ICR reads $10 (again - not sure if just the bit is checked, or the whole register), bus controller assumes the receiver talks the DolphinDOS protocol.
Note: detection only works under ATN, should be performed before the controller performs a turnover to listener!
diff --git a/src/,,config_custom.s b/src/,,config_custom.s
index 5362fb5d..17fa482c 100644
--- a/src/,,config_custom.s
+++ b/src/,,config_custom.s
@@ -39,12 +39,14 @@
;; #CONFIG# IEC YES
;; #CONFIG# IEC_DOLPHINDOS YES
-;; #CONFIG# IEC_DOLPHINDOS_FAST YES
+;; #CONFIG# IEC_DOLPHINDOS_FAST NO
;; #CONFIG# IEC_JIFFYDOS YES
;; #CONFIG# IEC_JIFFYDOS_BLANK NO
;; #CONFIG# IEC_BURST_CIA1 NO ; please keep disabled for now
;; #CONFIG# IEC_BURST_CIA2 NO ; please keep disabled for now
+;; #CONFIG# IEC_JD_TEST NO ; temporary setting, for JiffyDOS development
+
; --- Tape deck configuration
diff --git a/src/,,config_cx16.s b/src/,,config_cx16.s
index 89e55b4a..b1f3b2c8 100644
--- a/src/,,config_cx16.s
+++ b/src/,,config_cx16.s
@@ -1,5 +1,5 @@
-;; #CONFIG# ID $04 ; should be 1 byte, different for each config file!
+;; #CONFIG# ID $E0 ; should be 1 byte, different for each config file!
;
; Please read CONFIG.md before modifying this file!
diff --git a/src/,,config_generic.s b/src/,,config_generic.s
index 970f7cde..ba3b0c5d 100644
--- a/src/,,config_generic.s
+++ b/src/,,config_generic.s
@@ -71,8 +71,8 @@
;; #CONFIG# KEY_REPEAT_DEFAULT NO
;; #CONFIG# KEY_REPEAT_ALWAYS NO
;; #CONFIG# KEY_FAST_SCAN YES
-;; #CONFIG# JOY1_CURSOR YES
-;; #CONFIG# JOY2_CURSOR YES
+;; #CONFIG# JOY1_CURSOR NO
+;; #CONFIG# JOY2_CURSOR NO
;; #CONFIG# PROGRAMMABLE_KEYS YES
diff --git a/src/,,config_generic_crt.s b/src/,,config_generic_crt.s
new file mode 100644
index 00000000..045a4632
--- /dev/null
+++ b/src/,,config_generic_crt.s
@@ -0,0 +1,133 @@
+
+;; #CONFIG# ID $11 ; should be 1 byte, different for each config file!
+
+;
+; Please read CONFIG.md before modifying this file!
+;
+
+; Idea:
+; - sane defaults for the Commodore 64/128 emulators
+; - use RetroRelplay cartridge image as a ROM extension
+; - do not enable features which are a significant compatibility risk
+
+
+
+; --- Hardware platform and brand
+
+;; #CONFIG# PLATFORM_COMMODORE_64 YES
+;; #CONFIG# ROM_CRT YES
+;; #CONFIG# BRAND_GENERIC YES
+
+
+; --- Processor instruction set
+
+;; #CONFIG# CPU_MOS_6502 YES
+;; #CONFIG# CPU_DTV_6502 NO
+;; #CONFIG# CPU_RCW_65C02 NO
+;; #CONFIG# CPU_WDC_65C02 NO
+;; #CONFIG# CPU_WDC_65816 NO
+;; #CONFIG# CPU_CSG_65CE02 NO
+
+
+; --- Memory model
+
+;; #CONFIG# MEMORY_MODEL_38K NO
+;; #CONFIG# MEMORY_MODEL_46K NO
+;; #CONFIG# MEMORY_MODEL_50K YES
+;; #CONFIG# MEMORY_MODEL_60K NO
+
+
+; --- IEC bus configuration
+
+;; #CONFIG# IEC YES
+;; #CONFIG# IEC_DOLPHINDOS YES
+;; #CONFIG# IEC_DOLPHINDOS_FAST YES
+;; #CONFIG# IEC_JIFFYDOS YES
+;; #CONFIG# IEC_JIFFYDOS_BLANK YES
+
+
+; --- Tape deck configuration
+
+;; #CONFIG# TAPE_NORMAL YES
+;; #CONFIG# TAPE_TURBO YES
+;; #CONFIG# TAPE_AUTODETECT YES
+;; #CONFIG# TAPE_NO_KEY_SENSE NO
+;; #CONFIG# TAPE_NO_MOTOR_CONTROL NO
+
+
+; --- Sound support
+
+;; #CONFIG# SID_2ND_ADDRESS NO
+;; #CONFIG# SID_3RD_ADDRESS NO
+;; #CONFIG# SID_D4XX NO
+;; #CONFIG# SID_D5XX NO
+;; #CONFIG# SID_D6XX NO
+;; #CONFIG# SID_D7XX NO
+
+
+; --- Keyboard settings
+
+;; #CONFIG# LEGACY_SCNKEY NO
+;; #CONFIG# KEYBOARD_C128 NO
+;; #CONFIG# KEYBOARD_C128_CAPS_LOCK NO
+;; #CONFIG# KEY_REPEAT_DEFAULT NO
+;; #CONFIG# KEY_REPEAT_ALWAYS NO
+;; #CONFIG# KEY_FAST_SCAN YES
+;; #CONFIG# JOY1_CURSOR NO
+;; #CONFIG# JOY2_CURSOR NO
+
+;; #CONFIG# PROGRAMMABLE_KEYS YES
+
+;; #CONFIG# KEYCMD_RUN "\5FL"
+
+;; #CONFIG# KEYCMD_F1 "@8$"
+;; #CONFIG# KEYCMD_F2 "LOAD"
+;; #CONFIG# KEYCMD_F3 "@9$"
+;; #CONFIG# KEYCMD_F4 "RUN:"
+;; #CONFIG# KEYCMD_F5 "@10$"
+;; #CONFIG# KEYCMD_F6 NO
+;; #CONFIG# KEYCMD_F7 "@11$"
+;; #CONFIG# KEYCMD_F8 NO
+
+;; #CONFIG# KEYCMD_HELP "LIST"
+
+;; #CONFIG# KEYCMD_F9 NO
+;; #CONFIG# KEYCMD_F10 NO
+;; #CONFIG# KEYCMD_F11 NO
+;; #CONFIG# KEYCMD_F12 NO
+;; #CONFIG# KEYCMD_F13 NO
+;; #CONFIG# KEYCMD_F14 NO
+
+
+; --- Screen editor
+
+;; #CONFIG# EDIT_STOPQUOTE YES
+;; #CONFIG# EDIT_TABULATORS NO
+
+
+; --- Software features
+
+;; #CONFIG# PANIC_SCREEN YES
+;; #CONFIG# DOS_WEDGE YES
+;; #CONFIG# TAPE_WEDGE YES
+;; #CONFIG# TAPE_HEAD_ALIGN YES
+;; #CONFIG# BCD_SAFE_INTERRUPTS YES
+
+
+; --- Eye candy
+
+;; #CONFIG# COLORS_BRAND YES
+;; #CONFIG# BANNER_SIMPLE NO
+;; #CONFIG# BANNER_FANCY YES
+;; #CONFIG# SHOW_FEATURES YES
+
+
+; --- Debug options
+
+;; #CONFIG# DBG_STUBS_BRK NO
+;; #CONFIG# DBG_PRINTF NO
+
+
+; --- Other
+
+;; #CONFIG# COMPRESSION_LVL_2 NO
diff --git a/src/,,config_mega65.s b/src/,,config_mega65.s
index 95856675..823fb077 100644
--- a/src/,,config_mega65.s
+++ b/src/,,config_mega65.s
@@ -94,6 +94,8 @@
; --- Built-in DOS configuration
+;; #CONFIG# CMDRDOS NO ; do not change, DOS is not implemented yet
+
;; #CONFIG# UNIT_SDCARD 0 ; do not change, DOS is not implemented yet
;; #CONFIG# UNIT_FLOPPY 0 ; do not change, DOS is not implemented yet
;; #CONFIG# UNIT_RAMDISK 0 ; do not change, DOS is not implemented yet
diff --git a/src/,,config_ultimate64.s b/src/,,config_ultimate64.s
index edd352c7..e295751d 100644
--- a/src/,,config_ultimate64.s
+++ b/src/,,config_ultimate64.s
@@ -61,8 +61,8 @@
;; #CONFIG# KEY_REPEAT_DEFAULT NO
;; #CONFIG# KEY_REPEAT_ALWAYS NO
;; #CONFIG# KEY_FAST_SCAN YES
-;; #CONFIG# JOY1_CURSOR YES
-;; #CONFIG# JOY2_CURSOR YES
+;; #CONFIG# JOY1_CURSOR NO
+;; #CONFIG# JOY2_CURSOR NO
;; #CONFIG# PROGRAMMABLE_KEYS YES
diff --git a/src/,,config_ultimate64_crt.s b/src/,,config_ultimate64_crt.s
new file mode 100644
index 00000000..566868c0
--- /dev/null
+++ b/src/,,config_ultimate64_crt.s
@@ -0,0 +1,123 @@
+
+;; #CONFIG# ID $13 ; should be 1 byte, different for each config file!
+
+;
+; Please read CONFIG.md before modifying this file!
+;
+
+; Idea:
+; - sane defaults for the Ultimate 64 FPGA computer
+; - use RetroRelplay cartridge image as a ROM extension
+; - do not enable features which are a significant compatibility risk
+
+
+
+; --- Hardware platform and brand
+
+;; #CONFIG# PLATFORM_COMMODORE_64 YES
+;; #CONFIG# MB_U64 YES
+;; #CONFIG# ROM_CRT YES
+
+
+; --- Memory model
+
+;; #CONFIG# MEMORY_MODEL_38K NO
+;; #CONFIG# MEMORY_MODEL_46K NO
+;; #CONFIG# MEMORY_MODEL_50K YES
+;; #CONFIG# MEMORY_MODEL_60K NO
+
+
+; --- IEC bus configuration
+
+;; #CONFIG# IEC YES
+;; #CONFIG# IEC_DOLPHINDOS YES
+;; #CONFIG# IEC_DOLPHINDOS_FAST YES
+;; #CONFIG# IEC_JIFFYDOS YES
+;; #CONFIG# IEC_JIFFYDOS_BLANK YES
+
+
+; --- Tape deck configuration
+
+;; #CONFIG# TAPE_NORMAL YES
+;; #CONFIG# TAPE_TURBO YES
+;; #CONFIG# TAPE_AUTODETECT YES
+;; #CONFIG# TAPE_NO_KEY_SENSE NO
+;; #CONFIG# TAPE_NO_MOTOR_CONTROL NO
+
+
+; --- Sound support
+
+;; #CONFIG# SID_2ND_ADDRESS NO
+;; #CONFIG# SID_3RD_ADDRESS NO
+;; #CONFIG# SID_D4XX YES
+;; #CONFIG# SID_D5XX YES
+;; #CONFIG# SID_D6XX NO
+;; #CONFIG# SID_D7XX NO
+
+
+; --- Keyboard settings
+
+;; #CONFIG# LEGACY_SCNKEY NO
+;; #CONFIG# KEYBOARD_C128 NO
+;; #CONFIG# KEYBOARD_C128_CAPS_LOCK NO
+;; #CONFIG# KEY_REPEAT_DEFAULT NO
+;; #CONFIG# KEY_REPEAT_ALWAYS NO
+;; #CONFIG# KEY_FAST_SCAN YES
+;; #CONFIG# JOY1_CURSOR NO
+;; #CONFIG# JOY2_CURSOR NO
+
+;; #CONFIG# PROGRAMMABLE_KEYS YES
+
+;; #CONFIG# KEYCMD_RUN "\5FL"
+
+;; #CONFIG# KEYCMD_F1 "@8$"
+;; #CONFIG# KEYCMD_F2 "LOAD"
+;; #CONFIG# KEYCMD_F3 "@9$"
+;; #CONFIG# KEYCMD_F4 "RUN:"
+;; #CONFIG# KEYCMD_F5 "@10$"
+;; #CONFIG# KEYCMD_F6 NO
+;; #CONFIG# KEYCMD_F7 "@11$"
+;; #CONFIG# KEYCMD_F8 NO
+
+;; #CONFIG# KEYCMD_HELP "LIST"
+
+;; #CONFIG# KEYCMD_F9 NO
+;; #CONFIG# KEYCMD_F10 NO
+;; #CONFIG# KEYCMD_F11 NO
+;; #CONFIG# KEYCMD_F12 NO
+;; #CONFIG# KEYCMD_F13 NO
+;; #CONFIG# KEYCMD_F14 NO
+
+
+; --- Screen editor
+
+;; #CONFIG# EDIT_STOPQUOTE YES
+;; #CONFIG# EDIT_TABULATORS NO
+
+
+; --- Software features
+
+;; #CONFIG# PANIC_SCREEN YES
+;; #CONFIG# DOS_WEDGE YES
+;; #CONFIG# TAPE_WEDGE YES
+;; #CONFIG# TAPE_HEAD_ALIGN YES
+;; #CONFIG# BCD_SAFE_INTERRUPTS YES
+
+
+; --- Eye candy
+
+;; #CONFIG# COLORS_BRAND YES
+;; #CONFIG# BANNER_SIMPLE NO
+;; #CONFIG# BANNER_FANCY YES
+;; #CONFIG# SHOW_FEATURES YES
+
+
+; --- Debug options
+
+;; #CONFIG# DBG_STUBS_BRK NO
+;; #CONFIG# DBG_PRINTF NO
+
+
+; --- Other
+
+;; #CONFIG# COMPRESSION_LVL_2 NO
diff --git a/src/aliases/,aliases_config.s b/src/aliases/,aliases_config.s
index f6cd8a46..de9bbbeb 100644
--- a/src/aliases/,aliases_config.s
+++ b/src/aliases/,aliases_config.s
@@ -24,7 +24,7 @@
!if (counter > 1) { !error "Please select at most one CONFIG_MB_* option" }
!ifdef ROM_LAYOUT_M65 { !ifndef CONFIG_MB_M65 { !error "ROM layout requires CONFIG_MB_M65 option" } }
-!ifdef ROM_LAYOUT_U16 { !ifndef CONFIG_MB_U64 { !error "ROM layout requires CONFIG_MB_U64 option" } }
+!ifdef ROM_LAYOUT_U64 { !ifndef CONFIG_MB_U64 { !error "ROM layout requires CONFIG_MB_U64 option" } }
!ifdef CONFIG_MB_M65 { !ifndef ROM_LAYOUT_M65 { !error "CONFIG_MB_M65 can only be used with appropriate ROM layout" } }
; !ifdef CONFIG_MB_U64 { !ifndef ROM_LAYOUT_U64 { !error "CONFIG_MB_U64 can only be used with appropriate ROM layout" } }
@@ -51,6 +51,12 @@
!error "Please select exactly one CONFIG_BRAND_* option"
}
+!ifdef CONFIG_ROM_CRT { !ifndef ROM_LAYOUT_CRT {
+ !error "ROM_LAYOUT_CRT needs standard CONFIG_ROM_CRT set and vice-versa"
+}}
+!ifdef ROM_LAYOUT_CRT { !ifndef CONFIG_ROM_CRT {
+ !error "ROM_LAYOUT_CRT needs standard CONFIG_ROM_CRT set and vice-versa"
+}}
; Check that processor configuration is correct
@@ -86,6 +92,9 @@
!ifdef CONFIG_MB_M65 {
!ifdef CONFIG_MEMORY_MODEL_60K { !error "Do not use CONFIG_MEMORY_MODEL_60K options for MEGA65 motherboard" }
}
+!ifdef ROM_LAYOUT_CRT {
+ !ifdef CONFIG_MEMORY_MODEL_60K { !error "Do not use CONFIG_MEMORY_MODEL_60K options for CRT ROM layout" }
+}
!ifdef CONFIG_PLATFORM_COMMANDER_X16 {
!ifndef CONFIG_MEMORY_MODEL_38K { !error "Select CONFIG_MEMORY_MODEL_38K options for Commander X16 platform" }
}
@@ -241,6 +250,13 @@
+; Check that internal DOS configuration is correct
+
+!ifdef CONFIG_CMDRDOS { !ifndef CONFIG_MB_M65 {
+ !error "CONFIG_CMDRDOS requires CONFIG_MB_M65"
+} }
+
+
; Check that startup banner configuration is correct
!set counter = 0
@@ -262,6 +278,13 @@
;
+; Handle platform/mothjerboard configuration
+
+
+!ifdef PLATFORM_COMMODORE_64 { !ifndef CONFIG_MB_M65 { !ifndef CONFIG_MB_U64 {
+ !set HAS_128_POSSIBILITY = 1
+} } }
+
; Handle CPU configuration
@@ -415,12 +438,30 @@
+; Handle non-LGPL3 code
+
+!ifdef CONFIG_CMDRDOS { !set HAS_NOLGPL3_WARN = 1 }
+
+
+
; Determine if we need space-savings in BASIC code
-!ifndef CONFIG_MB_M65 {
+!ifndef CONFIG_MB_M65 { !ifndef ROM_LAYOUT_CRT {
!set HAS_SMALL_BASIC = 1
+} }
+
+
+
+; Determine if it is OK to include tape autocalibration routines; they are too slow to be safely used at 1 MHz CPU speed
+
+!ifdef HAS_TAPE {
+ !ifdef CONFIG_MB_M65 {
+ !set HAS_TAPE_AUTOCALIBRATE = 1
+ }
}
+; XXX adapt autocalibration to Ultimate64 once additional Kernal bank is available
+
; Defines for multi-segment ROMs
@@ -429,4 +470,12 @@
!ifdef SEGMENT_BASIC_0 { !set SEGMENT_M65_BASIC_0 = 1 }
!ifdef SEGMENT_BASIC_1 { !set SEGMENT_M65_BASIC_1 = 1 }
!ifdef SEGMENT_KERNAL_0 { !set SEGMENT_M65_KERNAL_0 = 1 }
+ !ifdef SEGMENT_KERNAL_1 { !set SEGMENT_M65_KERNAL_1 = 1 }
+}
+
+!ifdef ROM_LAYOUT_CRT {
+ !ifdef SEGMENT_BASIC_0 { !set SEGMENT_CRT_BASIC_0 = 1 }
+ !ifdef SEGMENT_BASIC_1 { !set SEGMENT_CRT_BASIC_1 = 1 }
+ !ifdef SEGMENT_KERNAL_0 { !set SEGMENT_CRT_KERNAL_0 = 1 }
+ !ifdef SEGMENT_KERNAL_1 { !set SEGMENT_CRT_KERNAL_1 = 1 }
}
diff --git a/src/aliases/,aliases_hardware.s b/src/aliases/,aliases_hardware.s
index 5b6d5167..ada42e87 100644
--- a/src/aliases/,aliases_hardware.s
+++ b/src/aliases/,aliases_hardware.s
@@ -71,6 +71,14 @@
!addr VIC_CLKRATE = $D030 ; C128 only
} }
+!ifdef CONFIG_MB_U64 {
+
+ ; Ultimate 64 registers
+
+ !addr U64_TURBOBIT = $D030 ; 0 = 1 MHz + badlines, 1 = settings from menu
+ !addr U64_TURBOCTL = $D031 ; bit 0-3 = CPU speed (index), bit 7 = disable badlines, $FF = not available
+}
+
; SID registers
!addr __SID_BASE = $D400 ; base address of the chip
diff --git a/src/aliases/,aliases_hardware_m65.s b/src/aliases/,aliases_hardware_m65.s
index b05afa32..8a03c46e 100644
--- a/src/aliases/,aliases_hardware_m65.s
+++ b/src/aliases/,aliases_hardware_m65.s
@@ -38,6 +38,13 @@
!addr SD_ADDR = $D681 ; 4 bytes
!addr SD_ERRCODE = $D6DA
+ ; SD card sector buffer, $FFFD6E00
+
+ !set SD_SECBUF_0 = $00
+ !set SD_SECBUF_1 = $6E
+ !set SD_SECBUF_2 = $FD
+ !set SD_SECBUF_3 = $0F
+
; DMAgic
!addr DMA_ADDRLSBTRIG = $D700
@@ -59,4 +66,30 @@
!set __SID_R2_OFFSET = $20 ; right SID 2, $D420
!set __SID_L1_OFFSET = $40 ; left SID 1, $D440
!set __SID_L2_OFFSET = $60 ; left SID 2, $D460
+
+
+
+ ; SD card commands
+ ;
+ ; XXX command codes taken from XEMU emulator, to be updated when official documentation exists
+
+ !set CARD_CMD_RESET = $00 ; reset SD card
+ !set CARD_CMD_RESET_FL = $10 ; reset with flags, XXX what's this?
+ !set CARD_CMD_END_RESET = $01 ; end reset
+ !set CARD_CMD_END_RESET_FL = $11 ; end reset with flags
+ !set CARD_CMD_READ = $02 ; read sector
+ !set CARD_CMD_WRITE = $03 ; write sector
+ !set CARD_CMD_WRITE_1 = $04 ; multi-sector write, 1st sector
+ !set CARD_CMD_WRITE_2 = $05 ; multi-sector write
+ !set CARD_CMD_WRITE_3 = $06 ; multi-sector write, last sector
+ !set CARD_CMD_FLUSH = $0C
+ !set CARD_CMD_SDHC_OFF = $40 ; for older cores only?
+ !set CARD_CMD_SDHC_ON = $41 ; for older cores only?
+ ; XXX $44, $45 - completely unclear to me
+ !set CARD_CMD_MAP_BUF = $81
+ !set CARD_CMD_UNMAP_BUF = $82
+ !set CARD_CMD_FILL_ON = $83
+ !set CARD_CMD_FILL_OFF = $84
+ !set CARD_CMD_SELECT_INT = $C0 ; select internal slot
+ !set CARD_CMD_SELECT_EXT = $C1 ; select external slot
}
diff --git a/src/aliases/,aliases_ram_lowmem.s b/src/aliases/,aliases_ram_lowmem.s
index 50f8edec..151c261a 100644
--- a/src/aliases/,aliases_ram_lowmem.s
+++ b/src/aliases/,aliases_ram_lowmem.s
@@ -121,7 +121,7 @@
!ifndef CONFIG_LEGACY_SCNKEY {
!addr BITTS = $B4 ; -- NOT IMPLEMENTED --
}
- !addr NXTBIT = $B5 ; -- NOT IMPLEMENTED --
+ !addr NXTBIT = $B5 ; -- NOT IMPLEMENTED -- [!] also used by tape routine to store CPU turbo settings
!ifndef CONFIG_LEGACY_SCNKEY {
!addr RODATA = $B6 ; -- NOT IMPLEMENTED --
}
@@ -310,11 +310,14 @@
!ifdef HAS_TAPE {
+!ifdef HAS_TAPE_AUTOCALIBRATE {
+
!addr __normal_time_S = IRQTMP+0 ; duration of the short pulse
!addr __normal_time_M = IRQTMP+1 ; duration of the medium pulse
!addr __turbo_half_S = IRQTMP+0 ; half-duration of the short pulse
!addr __turbo_half_L = IRQTMP+1 ; half-duration of the long pulse
+}
!addr __pulse_threshold = SVXT ; pulse classification threshold
!addr __pulse_threshold_ML = SYNO ; M/L pulse classification threshold, for normal only
diff --git a/src/basic/,imports.s b/src/basic/,imports.s
index 62a37c08..fa3bb638 100644
--- a/src/basic/,imports.s
+++ b/src/basic/,imports.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_0 #TAKE
;; #LAYOUT# M65 BASIC_0 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
;; #LAYOUT# * * #IGNORE
@@ -29,11 +30,21 @@
;; #ALIAS# SELDEV = KERNAL_0.SELDEV
+;
+; MEGA65 specific parts
+;
+
;; #ALIAS# map_end = KERNAL_0.map_end
;; #ALIAS# map_NORMAL = KERNAL_0.map_NORMAL
+;; #ALIAS# map_BASIC_1 = KERNAL_0.map_BASIC_1
;; #ALIAS# M65_MODEGET = KERNAL_0.M65_MODEGET
;; #ALIAS# M65_MODESET = KERNAL_0.M65_MODESET
-;; #ALIAS# M65_SLOW = KERNAL_0.M65_SLOW
-;; #ALIAS# M65_FAST = KERNAL_0.M65_FAST
;; #ALIAS# M65_SETWIN_Y = KERNAL_0.M65_SETWIN_Y
+
+;
+; Ultimate 64 specific parts
+;
+
+;; #ALIAS# U64_SLOW = KERNAL_0.U64_SLOW
+;; #ALIAS# U64_FAST = KERNAL_0.U64_FAST
diff --git a/src/basic/ab1e.strout.s b/src/basic/ab1e.strout.s
index 3f88c657..13daaf5d 100644
--- a/src/basic/ab1e.strout.s
+++ b/src/basic/ab1e.strout.s
@@ -1,6 +1,7 @@
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
;; #LAYOUT# * BASIC_0 #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE-FLOAT
;; #LAYOUT# M65 BASIC_1 #TAKE-FLOAT
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/assets/packed_as_1n.s b/src/basic/assets/packed_as_1n.s
index 4deeadcf..c8874aa6 100644
--- a/src/basic/assets/packed_as_1n.s
+++ b/src/basic/assets/packed_as_1n.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/assets/packed_as_3n.s b/src/basic/assets/packed_as_3n.s
index f7e85a7c..f0d6b833 100644
--- a/src/basic/assets/packed_as_3n.s
+++ b/src/basic/assets/packed_as_3n.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/assets/packed_dictionary.s b/src/basic/assets/packed_dictionary.s
index f53559cc..c56b26bc 100644
--- a/src/basic/assets/packed_dictionary.s
+++ b/src/basic/assets/packed_dictionary.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/assets/packed_errors.s b/src/basic/assets/packed_errors.s
index ded0d7e1..303bd668 100644
--- a/src/basic/assets/packed_errors.s
+++ b/src/basic/assets/packed_errors.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/assets/packed_keywords.s b/src/basic/assets/packed_keywords.s
index df83fd3b..307e1b08 100644
--- a/src/basic/assets/packed_keywords.s
+++ b/src/basic/assets/packed_keywords.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/assets/packed_keywords_01.s b/src/basic/assets/packed_keywords_01.s
index b743b433..f2f77efc 100644
--- a/src/basic/assets/packed_keywords_01.s
+++ b/src/basic/assets/packed_keywords_01.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/assets/packed_keywords_02.s b/src/basic/assets/packed_keywords_02.s
deleted file mode 100644
index 34c1334b..00000000
--- a/src/basic/assets/packed_keywords_02.s
+++ /dev/null
@@ -1,11 +0,0 @@
-;; #LAYOUT# STD * #TAKE
-;; #LAYOUT# M65 BASIC_1 #TAKE
-;; #LAYOUT# X16 BASIC_0 #TAKE
-;; #LAYOUT# * * #IGNORE
-
-!ifndef HAS_SMALL_BASIC {
-
-packed_freq_keywords_02:
-
- +PUT_PACKED_FREQ_keywords_02
-}
diff --git a/src/basic/assets/packed_keywords_03.s b/src/basic/assets/packed_keywords_03.s
deleted file mode 100644
index d7f57653..00000000
--- a/src/basic/assets/packed_keywords_03.s
+++ /dev/null
@@ -1,12 +0,0 @@
-;; #LAYOUT# STD * #TAKE
-;; #LAYOUT# M65 BASIC_1 #TAKE
-;; #LAYOUT# X16 BASIC_0 #TAKE
-;; #LAYOUT# * * #IGNORE
-
-!ifdef CONFIG_MB_M65 {
-
-packed_freq_keywords_03:
-
- +PUT_PACKED_FREQ_keywords_03
-
-}
\ No newline at end of file
diff --git a/src/basic/assets/packed_keywords_04.s b/src/basic/assets/packed_keywords_04.s
new file mode 100644
index 00000000..d80ac41b
--- /dev/null
+++ b/src/basic/assets/packed_keywords_04.s
@@ -0,0 +1,7 @@
+;; #LAYOUT# M65 BASIC_1 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+
+packed_freq_keywords_04:
+
+ +PUT_PACKED_FREQ_keywords_04
diff --git a/src/basic/assets/packed_keywords_06.s b/src/basic/assets/packed_keywords_06.s
new file mode 100644
index 00000000..77d1eac9
--- /dev/null
+++ b/src/basic/assets/packed_keywords_06.s
@@ -0,0 +1,7 @@
+;; #LAYOUT# M65 BASIC_1 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+
+packed_freq_keywords_06:
+
+ +PUT_PACKED_FREQ_keywords_06
diff --git a/src/basic/assets/packed_misc.s b/src/basic/assets/packed_misc.s
index d87ddb3b..bbfc7c6c 100644
--- a/src/basic/assets/packed_misc.s
+++ b/src/basic/assets/packed_misc.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/assets/startup_banner.s b/src/basic/assets/startup_banner.s
index e45e5ca8..b1c0f552 100644
--- a/src/basic/assets/startup_banner.s
+++ b/src/basic/assets/startup_banner.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -13,11 +14,19 @@
!pet "open roms "
+CONFIG_BRAND_CUSTOM
} else ifdef CONFIG_BRAND_GENERIC {
- !pet "open roms generic build"
+ !ifdef CONFIG_ROM_CRT {
+ !pet "open roms crt generic build"
+ } else {
+ !pet "open roms generic build"
+ }
} else ifdef CONFIG_BRAND_TESTING {
!pet "open roms testing build"
-} else ifdef CONFIG_BRAND_ULTIMATE_64 {
- !pet "open roms for ultimate 64"
+} else ifdef CONFIG_MB_U64 {
+ !ifdef CONFIG_ROM_CRT {
+ !pet "open roms crt for ultimate 64"
+ } else {
+ !pet "open roms for ultimate 64"
+ }
}
}
@@ -37,15 +46,33 @@ startup_banner:
rainbow_logo:
- !set SET_COLOR_0 = $05
- !set SET_COLOR_1 = $1C
- !set SET_COLOR_2 = $9E
- !set SET_COLOR_3 = $1E
- !set SET_COLOR_4 = $9F
+ !set BANNER_COLOR_0 = $05
+ !set BANNER_COLOR_1 = $1C
+ !set BANNER_COLOR_2 = $81
+ !set BANNER_COLOR_3 = $9E
+ !set BANNER_COLOR_4 = $1E
+ !set BANNER_COLOR_5 = $9F
+
+!ifdef CONFIG_MB_U64 {
+
+ !byte BANNER_COLOR_1, $B8, $B8, $20, $20, $B8, $B8, $0D
+ !byte BANNER_COLOR_2, $B8, $B8, $20, $20, $B8, $B8, $0D
+ !byte BANNER_COLOR_3, $B8, $B8, $20, $20, $B8, $B8, $0D
+ !byte BANNER_COLOR_4, $B8, $B8, $20, $20, $B8, $B8, $0D
+ !byte $20, BANNER_COLOR_5, $B8, $B8, $B8, $B8, $0D
+ !byte BANNER_COLOR_0, $00
+
+ !set BANNER_SPACING = $09
+
+} else {
+
+ !byte BANNER_COLOR_1, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $0D
+ !byte BANNER_COLOR_3, $12, $A4, $A4, $A4, $A4, $A4, $A4, $0D
+ !byte BANNER_COLOR_4, $12, $A4, $A4, $A4, $A4, $A4, $0D
+ !byte BANNER_COLOR_5, $12, $A4, $A4, $A4, $A4, $92
+ !byte BANNER_COLOR_0, $00
+
+ !set BANNER_SPACING = $0A
+}
- !byte SET_COLOR_1, $12, $A4, $A4, $A4, $A4, $A4, $A4, $A4, $0D
- !byte SET_COLOR_2, $12, $A4, $A4, $A4, $A4, $A4, $A4, $0D
- !byte SET_COLOR_3, $12, $A4, $A4, $A4, $A4, $A4, $0D
- !byte SET_COLOR_4, $12, $A4, $A4, $A4, $A4, $92
- !byte SET_COLOR_0, $00
}
diff --git a/src/basic/assets/str_nolgpl3_warn.s b/src/basic/assets/str_nolgpl3_warn.s
new file mode 100644
index 00000000..88bf8fa9
--- /dev/null
+++ b/src/basic/assets/str_nolgpl3_warn.s
@@ -0,0 +1,15 @@
+;; #LAYOUT# M65 BASIC_1 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+
+
+!ifdef HAS_NOLGPL3_WARN {
+
+str_nonlgpl3_warn:
+
+ !byte $0D, $0D, $0D, $0D
+ !pet "build contains non-lgpl3 code"
+ !byte $0D
+ !pet " *** do not distribute ***"
+ !byte $0D, $0D, $00
+}
diff --git a/src/basic/basic_commands_01/cmd__jumptable_01.s b/src/basic/basic_commands_01/cmd__jumptable_01.s
index 12152493..ad3a7490 100644
--- a/src/basic/basic_commands_01/cmd__jumptable_01.s
+++ b/src/basic/basic_commands_01/cmd__jumptable_01.s
@@ -6,42 +6,42 @@
; Jumptable for BASIC commands with tokens prefixed by $01
;
-!ifdef CONFIG_MB_M65 {
+!set ITEM_01 = cmd_slow
+!set ITEM_02 = cmd_fast
+!set ITEM_03 = cmd_old
-!set ITEM_00 = M65_SLOW
-!set ITEM_01 = M65_FAST
+!ifndef HAS_SMALL_BASIC {
-} else {
-
-!set ITEM_00 = cmd_slow
-!set ITEM_01 = cmd_fast
+!set ITEM_04 = cmd_clear
+!set ITEM_05 = varstr_garbage_collect ; cmd_dispose
+!set ITEM_06 = cmd_merge
+!set ITEM_07 = cmd_bload
+!set ITEM_08 = cmd_bsave
+!set ITEM_09 = cmd_bverify
+!set ITEM_0A = cmd_cold
+!set ITEM_0B = cmd_mem
}
-!set ITEM_02 = cmd_old
-
- ; NOTE! These commands are temporarily placed here, they should be a part of list 02!
-
-!set ITEM_03 = cmd_merge
-
-!set ITEM_04 = cmd_bload
-!set ITEM_05 = cmd_bsave
-!set ITEM_06 = cmd_bverify
-
-!set ITEM_07 = cmd_clear
-!set ITEM_08 = varstr_garbage_collect ; cmd_dispose
!ifndef HAS_OPCODES_65C02 {
command_01_jumptable_lo:
- !byte <(ITEM_00-1), <(ITEM_01-1), <(ITEM_02-1), <(ITEM_03-1), <(ITEM_04-1), <(ITEM_05-1), <(ITEM_06-1), <(ITEM_07-1), <(ITEM_08-1)
+ !byte <(ITEM_01-1), <(ITEM_02-1), <(ITEM_03-1)
+!ifndef HAS_SMALL_BASIC {
+ !byte <(ITEM_04-1), <(ITEM_05-1), <(ITEM_06-1), <(ITEM_07-4), <(ITEM_08-1), <(ITEM_09-1), <(ITEM_0A-1), <(ITEM_0B-1)
+}
command_01_jumptable_hi:
- !byte >(ITEM_00-1), >(ITEM_01-1), >(ITEM_02-1), >(ITEM_03-1), >(ITEM_04-1), >(ITEM_05-1), >(ITEM_06-1), >(ITEM_07-1), >(ITEM_08-1)
+ !byte >(ITEM_01-1), >(ITEM_02-1), >(ITEM_03-1)
+
+!ifndef HAS_SMALL_BASIC {
+ !byte >(ITEM_04-1), >(ITEM_05-1), >(ITEM_06-1), >(ITEM_07-4), >(ITEM_08-1), >(ITEM_09-1), >(ITEM_0A-1), >(ITEM_0B-1)
+}
} else { ; HAS_OPCODES_65C02
@@ -49,5 +49,10 @@ command_01_jumptable:
; Note: 65C02 has the page boundary vector bug fixed!
- !word ITEM_00, ITEM_01, ITEM_02, ITEM_03, ITEM_04, ITEM_05, ITEM_06, ITEM_07, ITEM_08
+ !word ITEM_01, ITEM_02, ITEM_03
+
+!ifndef HAS_SMALL_BASIC {
+ !word ITEM_04, ITEM_05, ITEM_06, ITEM_07, ITEM_08, ITEM_09, ITEM_0A, ITEM_0B
+}
+
}
diff --git a/src/basic/basic_commands_02/cmd_bload_bverify.s b/src/basic/basic_commands_01/cmd_bload_bverify.s
similarity index 96%
rename from src/basic/basic_commands_02/cmd_bload_bverify.s
rename to src/basic/basic_commands_01/cmd_bload_bverify.s
index 87ab76d8..2e31c215 100644
--- a/src/basic/basic_commands_02/cmd_bload_bverify.s
+++ b/src/basic/basic_commands_01/cmd_bload_bverify.s
@@ -3,6 +3,8 @@
;; #LAYOUT# * * #IGNORE
+!ifndef HAS_SMALL_BASIC {
+
cmd_bverify:
; LOAD and VERIFY are very similar, from BASIC perspective there is almost no difference;
@@ -40,3 +42,4 @@ cmd_bload:
; Execute next statement
rts
+}
\ No newline at end of file
diff --git a/src/basic/basic_commands_02/cmd_bsave.s b/src/basic/basic_commands_01/cmd_bsave.s
similarity index 95%
rename from src/basic/basic_commands_02/cmd_bsave.s
rename to src/basic/basic_commands_01/cmd_bsave.s
index f702a295..9a6ba5c9 100644
--- a/src/basic/basic_commands_02/cmd_bsave.s
+++ b/src/basic/basic_commands_01/cmd_bsave.s
@@ -3,6 +3,8 @@
;; #LAYOUT# * * #IGNORE
+!ifndef HAS_SMALL_BASIC {
+
cmd_bsave:
; Set default device and secondary address
@@ -40,3 +42,4 @@ cmd_bsave:
; Perform SAVE - reuse regular command
jmp cmd_save_do
+}
\ No newline at end of file
diff --git a/src/basic/basic_commands_02/cmd_clear.s b/src/basic/basic_commands_01/cmd_clear.s
similarity index 86%
rename from src/basic/basic_commands_02/cmd_clear.s
rename to src/basic/basic_commands_01/cmd_clear.s
index a4af3508..1f4333db 100644
--- a/src/basic/basic_commands_02/cmd_clear.s
+++ b/src/basic/basic_commands_01/cmd_clear.s
@@ -3,8 +3,11 @@
;; #LAYOUT# * * #IGNORE
+!ifndef HAS_SMALL_BASIC {
+
cmd_clear:
; XXX in the future add separate implementation for graphics screen
jmp clear_screen
+}
diff --git a/src/basic/basic_commands_02/cmd_cold.s b/src/basic/basic_commands_01/cmd_cold.s
similarity index 100%
rename from src/basic/basic_commands_02/cmd_cold.s
rename to src/basic/basic_commands_01/cmd_cold.s
diff --git a/src/basic/basic_commands_02/cmd_dispose.s b/src/basic/basic_commands_01/cmd_dispose.s
similarity index 100%
rename from src/basic/basic_commands_02/cmd_dispose.s
rename to src/basic/basic_commands_01/cmd_dispose.s
diff --git a/src/basic/basic_commands_01/cmd_fast_slow.s b/src/basic/basic_commands_01/cmd_fast_slow.s
index 8789c50a..84e33241 100644
--- a/src/basic/basic_commands_01/cmd_fast_slow.s
+++ b/src/basic/basic_commands_01/cmd_fast_slow.s
@@ -5,21 +5,47 @@
!ifdef CONFIG_MB_M65 {
+; NOTE: In native mode the system should not run at 1 MHz speed - it's dangerous,
+; as it uses compound instructions, which are not safe in 1MHz mode
+
+cmd_slow: ; set CPU speed to 1 MHz
+
+ jsr helper_ensure_legacy_mode
+
+ lda #$40
+ bra cmd_slow_fast_common
+
+ ; FALLTROUGH
+
+cmd_fast: ; set CPU speed to 40 MHz
+
+ jsr helper_ensure_legacy_mode
+
+ lda #$41
+
+ ; FALLTROUGH
+
+cmd_slow_fast_common:
+
+ sta CPU_D6510
+ rts
+
+
; For MEGA65 Kernal routines are called directly
} else ifdef CONFIG_MB_U64 {
- ; Command implementation for Ultimate 64 - SuperCPU compatible way should be enough
+ ; Command implementation for Ultimate 64
cmd_slow:
- sta SCPU_SPEED_NORMAL
- rts
+ sta SCPU_SPEED_NORMAL ; any value will do
+ jmp U64_SLOW ; to set turbo in $D031 too
cmd_fast:
- sta SCPU_SPEED_TURBO
- rts
+ sta SCPU_SPEED_TURBO ; any value will do
+ jmp U64_FAST ; to set turbo in $D031 too
} else ifdef CONFIG_PLATFORM_COMMODORE_64 {
diff --git a/src/basic/basic_commands_02/cmd_mem.s b/src/basic/basic_commands_01/cmd_mem.s
similarity index 85%
rename from src/basic/basic_commands_02/cmd_mem.s
rename to src/basic/basic_commands_01/cmd_mem.s
index 19c53e03..af06307a 100644
--- a/src/basic/basic_commands_02/cmd_mem.s
+++ b/src/basic/basic_commands_01/cmd_mem.s
@@ -1,38 +1,50 @@
;; #LAYOUT# STD * #TAKE
-;; #LAYOUT# M65 * #TAKE
-;; #LAYOUT# X16 BASIC_0 #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
+;; #LAYOUT# M65 BASIC_1 #TAKE
+;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
!ifndef HAS_SMALL_BASIC {
+ ; First perform the garbage collection - to be able to determine real values
+
!ifdef SEGMENT_M65_BASIC_0 {
cmd_mem:
- ; First perform the garbage collection - to be able to determine real values
-
jsr varstr_garbage_collect
-
jsr map_BASIC_1
jsr (VB1__cmd_mem_cont)
jmp map_NORMAL
+} else ifdef SEGMENT_CRT_BASIC_0 {
+
+cmd_mem:
+
+ jsr varstr_garbage_collect
+
+ jsr map_BASIC_1
+ jsr JB1__cmd_mem_cont
+ jmp map_NORMAL
+
} else ifdef SEGMENT_M65_BASIC_1 {
cmd_mem_cont:
+} else ifdef SEGMENT_CRT_BASIC_1 {
+
+cmd_mem_cont:
+
} else {
cmd_mem:
- ; First perform the garbage collection - to be able to determine real values
-
jsr varstr_garbage_collect
}
-!ifndef SEGMENT_M65_BASIC_0 {
+!ifndef SEGMENT_BASIC_0 {
; Print header
diff --git a/src/basic/basic_commands_02/cmd_merge.s b/src/basic/basic_commands_01/cmd_merge.s
similarity index 96%
rename from src/basic/basic_commands_02/cmd_merge.s
rename to src/basic/basic_commands_01/cmd_merge.s
index 75e5bc44..e9740c36 100644
--- a/src/basic/basic_commands_02/cmd_merge.s
+++ b/src/basic/basic_commands_01/cmd_merge.s
@@ -3,6 +3,8 @@
;; #LAYOUT# * * #IGNORE
+!ifndef HAS_SMALL_BASIC {
+
cmd_merge:
lda #$00 ; mark operation as LOAD
@@ -45,3 +47,4 @@ cmd_merge_no_error:
; Relink loaded program, clear variables, execute next statement
jmp update_LINKPRG_VARTAB_do_clr
+}
\ No newline at end of file
diff --git a/src/basic/basic_commands_02/helper_ask_if_sure.s b/src/basic/basic_commands_01/helper_ask_if_sure.s
similarity index 89%
rename from src/basic/basic_commands_02/helper_ask_if_sure.s
rename to src/basic/basic_commands_01/helper_ask_if_sure.s
index 5f52d7b9..5c5f456a 100644
--- a/src/basic/basic_commands_02/helper_ask_if_sure.s
+++ b/src/basic/basic_commands_01/helper_ask_if_sure.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -19,6 +20,12 @@ helper_ask_if_sure:
jsr (VB1__helper_ask_if_sure)
jmp map_NORMAL
+} else ifdef SEGMENT_CRT_BASIC_0 {
+
+ jsr map_BASIC_1
+ jsr JB1__helper_ask_if_sure
+ jmp map_NORMAL
+
} else {
; First check, if we are in direct mode,; if not, do not ask
diff --git a/src/basic/basic_commands_02/helper_bload_fetch_address.s b/src/basic/basic_commands_01/helper_bload_fetch_address.s
similarity index 92%
rename from src/basic/basic_commands_02/helper_bload_fetch_address.s
rename to src/basic/basic_commands_01/helper_bload_fetch_address.s
index f3ab147f..940ec192 100644
--- a/src/basic/basic_commands_02/helper_bload_fetch_address.s
+++ b/src/basic/basic_commands_01/helper_bload_fetch_address.s
@@ -7,6 +7,8 @@
;
+!ifndef HAS_SMALL_BASIC {
+
helper_bload_fetch_address:
jsr injest_comma
@@ -20,3 +22,4 @@ helper_bload_fetch_address:
ldy LINNUM+1
rts
+}
\ No newline at end of file
diff --git a/src/basic/basic_commands_02/helper_bload_fetch_filename.s b/src/basic/basic_commands_01/helper_bload_fetch_filename.s
similarity index 94%
rename from src/basic/basic_commands_02/helper_bload_fetch_filename.s
rename to src/basic/basic_commands_01/helper_bload_fetch_filename.s
index e1b238de..6ad5ad74 100644
--- a/src/basic/basic_commands_02/helper_bload_fetch_filename.s
+++ b/src/basic/basic_commands_01/helper_bload_fetch_filename.s
@@ -7,6 +7,8 @@
;
+!ifndef HAS_SMALL_BASIC {
+
helper_bload_fetch_filename:
; Fetch the file name
@@ -24,3 +26,4 @@ helper_bload_fetch_filename:
sta FNLEN
@1:
rts
+}
\ No newline at end of file
diff --git a/src/basic/basic_commands_01/helper_ensure_legacy_mode_m65.s b/src/basic/basic_commands_01/helper_ensure_legacy_mode_m65.s
new file mode 100644
index 00000000..c49b21d2
--- /dev/null
+++ b/src/basic/basic_commands_01/helper_ensure_legacy_mode_m65.s
@@ -0,0 +1,10 @@
+;; #LAYOUT# M65 BASIC_0 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+
+helper_ensure_legacy_mode:
+
+ jsr M65_MODEGET
+ +bcc do_LEGACY_MODE_ONLY_error
+
+ rts
diff --git a/src/basic/basic_commands_02/helper_mem_tab_str.s b/src/basic/basic_commands_01/helper_mem_tab_str.s
similarity index 92%
rename from src/basic/basic_commands_02/helper_mem_tab_str.s
rename to src/basic/basic_commands_01/helper_mem_tab_str.s
index eca887b1..b336b964 100644
--- a/src/basic/basic_commands_02/helper_mem_tab_str.s
+++ b/src/basic/basic_commands_01/helper_mem_tab_str.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/basic_commands_02/helper_mem_tab_x.s b/src/basic/basic_commands_01/helper_mem_tab_x.s
similarity index 91%
rename from src/basic/basic_commands_02/helper_mem_tab_x.s
rename to src/basic/basic_commands_01/helper_mem_tab_x.s
index 825d0a59..7b9939bc 100644
--- a/src/basic/basic_commands_02/helper_mem_tab_x.s
+++ b/src/basic/basic_commands_01/helper_mem_tab_x.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/basic_commands_02/helper_mem_tab_y.s b/src/basic/basic_commands_01/helper_mem_tab_y.s
similarity index 91%
rename from src/basic/basic_commands_02/helper_mem_tab_y.s
rename to src/basic/basic_commands_01/helper_mem_tab_y.s
index 083817d8..7735ccce 100644
--- a/src/basic/basic_commands_02/helper_mem_tab_y.s
+++ b/src/basic/basic_commands_01/helper_mem_tab_y.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/basic_commands_02/cmd__jumptable_02.s b/src/basic/basic_commands_02/cmd__jumptable_02.s
deleted file mode 100644
index deb3dc4d..00000000
--- a/src/basic/basic_commands_02/cmd__jumptable_02.s
+++ /dev/null
@@ -1,44 +0,0 @@
-;; #LAYOUT# STD * #TAKE
-;; #LAYOUT# * BASIC_0 #TAKE
-;; #LAYOUT# * * #IGNORE
-
-;
-; Jumptable for BASIC commands with tokens prefixed by $02
-;
-
-!ifndef HAS_SMALL_BASIC {
-
- ; NOTE! These commands are temporarily placed in list 01!
-
- ; cmd_merge,
-
- ; cmd_bload,
- ; cmd_bsave,
- ; cmd_bverify,
-
- ; cmd_clear,
- ; varstr_garbage_collect, ; cmd_dispose
-
-!set ITEM_00 = cmd_cold
-!set ITEM_01 = cmd_mem
-!set ITEM_02 = cmd_sysinfo
-
-
-!ifndef HAS_OPCODES_65C02 {
-
-command_02_jumptable_lo:
-
- !byte <(ITEM_00-1), <(ITEM_01-1), <(ITEM_02-1)
-
-command_02_jumptable_hi:
-
- !byte >(ITEM_00-1), >(ITEM_01-1), >(ITEM_02-1)
-
-} else { ; HAS_OPCODES_65C02
-
-command_02_jumptable:
-
- ; Note: 65C02 has the page boundary vector bug fixed!
-
- !word ITEM_00, ITEM_01, ITEM_02
-} }
diff --git a/src/basic/basic_commands_03_m65/cmd__jumptable_03.s b/src/basic/basic_commands_03_m65/cmd__jumptable_03.s
deleted file mode 100644
index cd3b7b54..00000000
--- a/src/basic/basic_commands_03_m65/cmd__jumptable_03.s
+++ /dev/null
@@ -1,15 +0,0 @@
-;; #LAYOUT# M65 BASIC_0 #TAKE
-;; #LAYOUT# * * #IGNORE
-
-;
-; Jumptable for BASIC commands with tokens prefixed by $03
-;
-
-!set ITEM_00 = cmd_rem ; XXX just for testing
-
-
-command_03_jumptable:
-
- ; Note: 65C02 has the page boundary vector bug fixed!
-
- !word ITEM_00
diff --git a/src/basic/basic_commands_04/cmd__jumptable_04.s b/src/basic/basic_commands_04/cmd__jumptable_04.s
new file mode 100644
index 00000000..4b623071
--- /dev/null
+++ b/src/basic/basic_commands_04/cmd__jumptable_04.s
@@ -0,0 +1,29 @@
+;; #LAYOUT# M65 * #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;
+; Jumptable for BASIC commands with tokens prefixed by $04
+;
+
+!set ITEM_01 = cmd_sysinfo
+
+
+
+!ifndef HAS_OPCODES_65C02 {
+
+command_04_jumptable_lo:
+
+ !byte <(ITEM_01-1)
+
+command_04_jumptable_hi:
+
+ !byte >(ITEM_01-1)
+
+} else { ; HAS_OPCODES_65C02
+
+command_04_jumptable:
+
+ ; Note: 65C02 has the page boundary vector bug fixed!
+
+ !word ITEM_01
+}
diff --git a/src/basic/basic_commands_02/cmd_sysinfo.s b/src/basic/basic_commands_04/cmd_sysinfo.s
similarity index 100%
rename from src/basic/basic_commands_02/cmd_sysinfo.s
rename to src/basic/basic_commands_04/cmd_sysinfo.s
diff --git a/src/basic/basic_functions_06/fun__jumptable_06.s b/src/basic/basic_functions_06/fun__jumptable_06.s
new file mode 100644
index 00000000..63213301
--- /dev/null
+++ b/src/basic/basic_functions_06/fun__jumptable_06.s
@@ -0,0 +1,28 @@
+;; #LAYOUT# M65 BASIC_0 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;
+; Jumptable for BASIC commands with tokens prefixed by $03
+;
+
+!set ITEM_01 = do_NOT_IMPLEMENTED_error ; just for testing
+
+
+!ifndef HAS_OPCODES_65C02 {
+
+function_06_jumptable_lo:
+
+ !byte <(ITEM_01-1)
+
+function_06_jumptable_hi:
+
+ !byte >(ITEM_01-1)
+
+} else { ; HAS_OPCODES_65C02
+
+function_06_jumptable:
+
+ ; Note: 65C02 has the page boundary vector bug fixed!
+
+ !word ITEM_01
+}
diff --git a/src/basic/board_crt/8000.crt_vectable_basic_1.s b/src/basic/board_crt/8000.crt_vectable_basic_1.s
new file mode 100644
index 00000000..7e2f0fa1
--- /dev/null
+++ b/src/basic/board_crt/8000.crt_vectable_basic_1.s
@@ -0,0 +1,54 @@
+;; #LAYOUT# CRT BASIC_0 #TAKE-FLOAT
+;; #LAYOUT# CRT BASIC_1 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;
+; Definitions for communication with cartridge segment BASIC_1 from BASIC_0
+;
+
+
+!ifdef SEGMENT_BASIC_0 {
+
+
+ ; Label definitions
+
+ !addr JB1__INITMSG = $8000 + 3 * 0
+ !addr JB1__LINKPRG = $8000 + 3 * 1
+ !addr JB1__tokenise_line = $8000 + 3 * 2
+ !addr JB1__list_single_line = $8000 + 3 * 3
+ !addr JB1__print_packed_error = $8000 + 3 * 4
+ !addr JB1__print_packed_misc_str = $8000 + 3 * 5
+ !addr JB1__do_new = $8000 + 3 * 6
+ !addr JB1__do_clr = $8000 + 3 * 7
+ !addr JB1__do_restore = $8000 + 3 * 8
+ !addr JB1__cmd_mem_cont = $8000 + 3 * 9
+ !addr JB1__prepare_direct_execution = $8000 + 3 * 10
+ !addr JB1__helper_ask_if_sure = $8000 + 3 * 11
+
+!ifdef CONFIG_DOS_WEDGE {
+ !addr JB1__wedge_dos = $8000 + 3 * 12
+}
+
+} else {
+
+ ; Jump table (Open ROMs private!)
+
+ jmp INITMSG
+ jmp LINKPRG
+ jmp tokenise_line
+ jmp list_single_line
+ jmp print_packed_error
+ jmp print_packed_misc_str
+ jmp do_new
+ jmp do_clr
+ jmp do_restore
+ jmp cmd_mem_cont
+ jmp prepare_direct_execution
+ jmp helper_ask_if_sure
+
+!ifdef CONFIG_DOS_WEDGE {
+ jmp wedge_dos
+}
+
+
+}
diff --git a/src/basic/board_crt/8000.interop b/src/basic/board_crt/8000.interop
new file mode 100644
index 00000000..7acd2a6f
--- /dev/null
+++ b/src/basic/board_crt/8000.interop
@@ -0,0 +1 @@
+This particular address is not for interoperability - we had to choose some fixed location for the extended ROM jumptable, beginning of the mapped memory block is just sane.
diff --git a/src/basic/board_crt/crt_imports.s b/src/basic/board_crt/crt_imports.s
new file mode 100644
index 00000000..678029af
--- /dev/null
+++ b/src/basic/board_crt/crt_imports.s
@@ -0,0 +1,41 @@
+;; #LAYOUT# CRT BASIC_1 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;; #IMPORT# BASIC_0 = BASIC_0_combined.sym
+;; #IMPORT# KERNAL_0 = KERNAL_0_combined.sym
+
+;
+; Definitions for calling segments BASIC_0 and KERNAL_0 routines from BASIC_1
+;
+
+;; #ALIAS# peek_via_OLDTXT = BASIC_0.proxy_B1_peek_via_OLDTXT
+;; #ALIAS# poke_via_OLDTXT = BASIC_0.proxy_B1_poke_via_OLDTXT
+;; #ALIAS# JCHROUT = BASIC_0.proxy_B1_JCHROUT
+;; #ALIAS# JCLALL = BASIC_0.proxy_B1_JCLALL
+;; #ALIAS# plot_set = BASIC_0.proxy_B1_plot_set
+
+;; #ALIAS# JCLOSE = BASIC_0.proxy_B1_JCLOSE
+;; #ALIAS# JOPEN = BASIC_0.proxy_B1_JOPEN
+;; #ALIAS# JMEMTOP = KERNAL_0.JMEMTOP
+;; #ALIAS# JSETFLS = KERNAL_0.JSETFLS
+;; #ALIAS# JSETNAM = KERNAL_0.JSETNAM
+;; #ALIAS# JGETIN = KERNAL_0.JGETIN
+;; #ALIAS# JCHKIN = BASIC_0.proxy_B1_JCHKIN
+;; #ALIAS# JCHRIN = BASIC_0.proxy_B1_JCHRIN
+;; #ALIAS# JREADST = KERNAL_0.JREADST
+;; #ALIAS# JSCREEN = KERNAL_0.JSCREEN
+;; #ALIAS# SELDEV = KERNAL_0.SELDEV
+;; #ALIAS# init_oldtxt = BASIC_0.init_oldtxt
+;; #ALIAS# tmpstr_free_all_reset = BASIC_0.tmpstr_free_all_reset
+;; #ALIAS# print_hex_byte = BASIC_0.proxy_B1_print_hex_byte
+;; #ALIAS# print_integer = BASIC_0.proxy_B1_print_integer
+;; #ALIAS# print_return = BASIC_0.proxy_B1_print_return
+;; #ALIAS# print_space = BASIC_0.proxy_B1_print_space
+;; #ALIAS# print_features = BASIC_0.proxy_B1_print_features
+;; #ALIAS# do_error_fetch = BASIC_0.do_error_fetch
+;; #ALIAS# do_basic_error = BASIC_0.do_basic_error
+;; #ALIAS# str_rev_question = BASIC_0.str_rev_question
+;; #ALIAS# fetch_character = BASIC_0.proxy_B1_fetch_character
+;; #ALIAS# fetch_character_skip_spaces = BASIC_0.proxy_B1_fetch_character_skip_spaces
+;; #ALIAS# fetch_uint8 = BASIC_0.proxy_B1_fetch_uint8
+;; #ALIAS# shell_main_loop = BASIC_0.proxy_B1_shell_main_loop
diff --git a/src/basic/board_crt/crt_proxies.s b/src/basic/board_crt/crt_proxies.s
new file mode 100644
index 00000000..200367c0
--- /dev/null
+++ b/src/basic/board_crt/crt_proxies.s
@@ -0,0 +1,130 @@
+;; #LAYOUT# CRT BASIC_0 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;
+; Proxies for calling segment BASIC_0 and KERNAL_0 routines from BASIC_1
+;
+
+proxy_B1_peek_via_OLDTXT:
+
+ jsr map_NORMAL
+
+!ifdef CONFIG_MEMORY_MODEL_60K {
+ !error "not implemented"
+} else ifdef CONFIG_MEMORY_MODEL_46K_OR_50K {
+ jsr peek_under_roms_via_OLDTXT
+ cmp #$00
+} else { ; CONFIG_MEMORY_MODEL_38K
+ lda (OLDTXT),y
+}
+ jmp map_BASIC_1 ; do not do 'bra' - we want this one as fast as possible
+
+
+proxy_B1_poke_via_OLDTXT:
+
+ jsr map_NORMAL
+!ifdef CONFIG_MEMORY_MODEL_60K {
+ !error "not implemented"
+} else { ; CONFIG_MEMORY_MODEL_38K || CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
+ sta (OLDTXT),y
+}
+
+ jmp map_BASIC_1
+
+
+proxy_B1_JCLALL:
+
+ jsr map_NORMAL
+ jsr JCLALL
+ jmp map_BASIC_1
+
+
+!ifdef CONFIG_DOS_WEDGE {
+
+proxy_B1_JCLOSE:
+
+ jsr map_NORMAL
+ jsr JCLOSE
+ jmp map_BASIC_1
+
+proxy_B1_JOPEN:
+
+ jsr map_NORMAL
+ jsr JOPEN
+ jmp map_BASIC_1
+}
+
+proxy_B1_JCHKIN:
+
+ jsr map_NORMAL
+ jsr JCHKIN
+ jmp map_BASIC_1
+
+proxy_B1_JCHRIN:
+
+ jsr map_NORMAL
+ jsr JCHRIN
+ jmp map_BASIC_1
+
+proxy_B1_JCHROUT:
+
+ jsr map_NORMAL
+ jsr JCHROUT
+ jmp map_BASIC_1
+
+proxy_B1_print_hex_byte:
+
+ jsr map_NORMAL
+ jsr print_hex_byte
+ jmp map_BASIC_1
+
+proxy_B1_print_integer:
+
+ jsr map_NORMAL
+ jsr print_integer
+ jmp map_BASIC_1
+
+proxy_B1_print_return:
+
+ jsr map_NORMAL
+ jsr print_return
+ jmp map_BASIC_1
+
+proxy_B1_print_space:
+
+ jsr map_NORMAL
+ jsr print_space
+ jmp map_BASIC_1
+
+proxy_B1_plot_set:
+
+ jsr map_NORMAL
+ jsr plot_set
+ jmp map_BASIC_1
+
+!ifdef CONFIG_DOS_WEDGE {
+
+proxy_B1_fetch_character:
+
+ jsr map_NORMAL
+ jsr fetch_character
+ jmp map_BASIC_1
+
+proxy_B1_fetch_character_skip_spaces:
+
+ jsr map_NORMAL
+ jsr fetch_character_skip_spaces
+ jmp map_BASIC_1
+
+proxy_B1_fetch_uint8:
+
+ jsr map_NORMAL
+ jsr fetch_uint8
+ jmp map_BASIC_1
+
+proxy_B1_shell_main_loop:
+
+ jsr map_NORMAL
+ jmp shell_main_loop
+}
+
diff --git a/src/basic/board_m65/4000.interop b/src/basic/board_m65/4000.interop
new file mode 100644
index 00000000..7acd2a6f
--- /dev/null
+++ b/src/basic/board_m65/4000.interop
@@ -0,0 +1 @@
+This particular address is not for interoperability - we had to choose some fixed location for the extended ROM jumptable, beginning of the mapped memory block is just sane.
diff --git a/src/basic/engine_editor/a533.linkprg.s b/src/basic/engine_editor/a533.linkprg.s
index f13fd6eb..3e518f9e 100644
--- a/src/basic/engine_editor/a533.linkprg.s
+++ b/src/basic/engine_editor/a533.linkprg.s
@@ -1,4 +1,6 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_0 #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE-FLOAT
;; #LAYOUT# M65 BASIC_0 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE-FLOAT
;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
@@ -19,6 +21,12 @@ LINKPRG:
jsr (VB1__LINKPRG)
jmp map_NORMAL
+} else ifdef SEGMENT_CRT_BASIC_0 {
+
+ jsr map_BASIC_1
+ jsr JB1__LINKPRG
+ jmp map_NORMAL
+
} else {
; Start by getting pointer to the first line
@@ -30,6 +38,8 @@ linkprg_loop:
!ifdef CONFIG_MB_M65 {
jsr peek_via_OLDTXT
+} else ifdef ROM_LAYOUT_CRT {
+ jsr peek_via_OLDTXT
} else ifdef CONFIG_MEMORY_MODEL_60K {
ldx #packed_freq_keywords_02
- sta FRESPC+1
-
- jsr tk_search
- bcc tokenise_line_keyword_02 ; branch if keyword identified
-}
-
!ifdef CONFIG_MB_M65 {
- lda #packed_freq_keywords_03
+ lda #>packed_freq_keywords_04
sta FRESPC+1
jsr tk_search
- bcc tokenise_line_keyword_03 ; branch if keyword identified
+ bcc tokenise_line_keyword_04 ; branch if keyword identified
+
+ lda #packed_freq_keywords_06
+ sta FRESPC+1
+
+ jsr tk_search
+ bcc tokenise_line_keyword_06 ; branch if keyword identified
}
; Shorten packed keyword candidate and try again
@@ -180,23 +186,18 @@ tokenise_line_char:
!ifdef CONFIG_MB_M65 {
-tokenise_line_keyword_03:
+tokenise_line_keyword_04:
; Store the token list index
- lda #$03
+ lda #$04
+skip_2_bytes_trash_nvz
- ; FALLTROUGH
-}
-
-!ifndef HAS_SMALL_BASIC {
-
-tokenise_line_keyword_02:
+tokenise_line_keyword_06:
; Store the token list index
- lda #$02
+ lda #$06
+skip_2_bytes_trash_nvz
; FALLTROUGH
diff --git a/src/basic/engine_runtime/do_error.s b/src/basic/engine_runtime/do_error.s
index baf57e47..068f8504 100644
--- a/src/basic/engine_runtime/do_error.s
+++ b/src/basic/engine_runtime/do_error.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -46,12 +47,22 @@ do_kernal_error: ; .A = KERNAL error code, also almost mat
dex
!ifdef SEGMENT_M65_BASIC_1 {
jmp do_basic_error
+} else ifdef SEGMENT_CRT_BASIC_1 {
+ jmp do_basic_error
} else {
bpl do_basic_error ; branch always
}
; Error messages specific to Open ROMs BASIC dialect
+!ifdef CONFIG_MB_M65 {
+
+do_LEGACY_MODE_ONLY_error:
+ !byte $E6
+do_NATIVE_MODE_ONLY_error:
+ !byte $E6
+}
+
do_MEMORY_CORRUPT_error:
!byte $E6
@@ -144,9 +155,9 @@ do_TO_MANY_FILES_error:
!byte $EA
!ifdef SEGMENT_M65_BASIC_1 {
-
jmp do_error_fetch
-
+} else ifdef SEGMENT_CRT_BASIC_1 {
+ jmp do_error_fetch
} else {
; FALLTROUGH
@@ -177,8 +188,11 @@ do_error_fetch:
do_basic_error: ; error code in .X
-!ifdef ROM_LAYOUT_M65 {
; Make sure we are back with normal memory map
+
+!ifdef ROM_LAYOUT_M65 {
+ jsr map_NORMAL
+} else ifdef ROM_LAYOUT_CRT {
jsr map_NORMAL
}
diff --git a/src/basic/engine_runtime/do_new_clr_restore.s b/src/basic/engine_runtime/do_new_clr_restore.s
index 9a96cc25..0b002c62 100644
--- a/src/basic/engine_runtime/do_new_clr_restore.s
+++ b/src/basic/engine_runtime/do_new_clr_restore.s
@@ -1,5 +1,8 @@
;; #LAYOUT# STD * #TAKE
-;; #LAYOUT# M65 * #TAKE
+;; #LAYOUT# CRT BASIC_0 #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
+;; #LAYOUT# M65 BASIC_0 #TAKE
+;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -32,6 +35,24 @@ do_restore_end:
jmp map_NORMAL
+} else ifdef SEGMENT_CRT_BASIC_0 {
+
+ jsr map_BASIC_1
+ jsr JB1__do_new
+ jmp map_NORMAL
+
+do_clr:
+
+ jsr map_BASIC_1
+ jsr JB1__do_clr
+ jmp map_NORMAL
+
+do_restore:
+
+ jsr map_BASIC_1
+ jsr JB1__do_restore
+ jmp map_NORMAL
+
} else {
; See Computes Mapping the Commodore 64 - page 96
diff --git a/src/basic/engine_runtime/execute_line_statements.s b/src/basic/engine_runtime/execute_line_statements.s
index 1c500524..ea128073 100644
--- a/src/basic/engine_runtime/execute_line_statements.s
+++ b/src/basic/engine_runtime/execute_line_statements.s
@@ -39,23 +39,19 @@ execute_statements:
; Check if token is valid for execution
-!ifdef HAS_SMALL_BASIC {
+!ifndef CONFIG_MB_M65 {
cpx #$01
beq execute_statements_01
} else {
-!ifdef CONFIG_MB_M65 {
- cpx #$04
-} else {
- cpx #$03
-}
+ cpx #$05
bcc execute_statements_extended
}
cpx #$CB
- +beq cmd_go ; 'GO' command has a strange token, placed after function tokens
+ +beq cmd_go ; 'GO' command has a strange token, placed after function tokens
cpx #$7F
+bcc execute_statements_var_assign ; not a token - try variable assign
@@ -84,25 +80,17 @@ execute_statements:
jmp (command_jumptable, x)
}
-!ifndef HAS_SMALL_BASIC {
+!ifdef CONFIG_MB_M65 {
execute_statements_extended:
; Support for extended BASIC commands
- ; XXX consider jumpable here
-
cpx #$01
beq execute_statements_01
- cpx #$02
- beq execute_statements_02
-
-!ifdef CONGIH_MB_M65 {
-
- cpx #$03
- beq execute_statements_03
-}
+ cpx #$04
+ beq execute_statements_04
jmp do_SYNTAX_error
}
@@ -141,9 +129,9 @@ execute_statements_01:
jmp (command_01_jumptable - 2, x)
}
-!ifndef HAS_SMALL_BASIC {
+!ifdef CONFIG_MB_M65 {
-execute_statements_02:
+execute_statements_04:
; Get the sub-token, check that it is valid
@@ -151,7 +139,7 @@ execute_statements_02:
cmp #$00
+beq do_SYNTAX_error
- cmp #(TK__MAXTOKEN_keywords_02+1)
+ cmp #(TK__MAXTOKEN_keywords_04+1)
+bcs do_SYNTAX_error
; Execute command
@@ -161,9 +149,9 @@ execute_statements_02:
; Get the jump table entry for it, push it on the stack, and then RTS to start it.
tax
- lda command_02_jumptable_hi - 1, x
+ lda command_04_jumptable_hi - 1, x
pha
- lda command_02_jumptable_lo - 1, x
+ lda command_04_jumptable_lo - 1, x
pha
rts
@@ -174,31 +162,10 @@ execute_statements_02:
asl
tax
- jmp (command_02_jumptable - 2, x)
+ jmp (command_04_jumptable - 2, x)
}
-} ; !HAS_SMALL_BASIC
-
-!ifdef CONFIG_MB_M65 {
-
-execute_statements_03:
-
- ; Get the sub-token, check that it is valid
-
- jsr fetch_character
- cmp #$00
- +beq do_SYNTAX_error
-
- cmp #(TK__MAXTOKEN_keywords_03+1)
- +bcs do_SYNTAX_error
-
- ; Use jumptable to go to the command routine
-
- asl
- tax
- jmp (command_03_jumptable - 2, x)
-
-} ; CONFIG_MB_M65
+}
execute_statements_end_of_line:
diff --git a/src/basic/engine_runtime/is_alphanumeric.s b/src/basic/engine_runtime/is_alphanumeric.s
index 317833a0..cd72a3c6 100644
--- a/src/basic/engine_runtime/is_alphanumeric.s
+++ b/src/basic/engine_runtime/is_alphanumeric.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/engine_runtime/prepare_direct_execution.s b/src/basic/engine_runtime/prepare_direct_execution.s
index 858a4ea1..75c46e7b 100644
--- a/src/basic/engine_runtime/prepare_direct_execution.s
+++ b/src/basic/engine_runtime/prepare_direct_execution.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -15,6 +16,12 @@ prepare_direct_execution:
jsr (VB1__prepare_direct_execution)
jmp map_NORMAL
+} else ifdef SEGMENT_CRT_BASIC_0 {
+
+ jsr map_BASIC_1
+ jsr JB1__prepare_direct_execution
+ jmp map_NORMAL
+
} else {
; Setup pointer to the statement
diff --git a/src/basic/init/e422.initmsg.jmp.s b/src/basic/init/e422.initmsg.jmp.s
index 37cbe78e..f0028ddc 100644
--- a/src/basic/init/e422.initmsg.jmp.s
+++ b/src/basic/init/e422.initmsg.jmp.s
@@ -29,6 +29,12 @@ INITMSG_autoswitch:
jsr (VB1__INITMSG_autoswitch)
bra INITMSG_end
+} else ifdef ROM_LAYOUT_CRT {
+
+ jsr map_BASIC_1
+ jsr JB1__INITMSG
+ jmp map_NORMAL
+
} else {
jmp initmsg_real
diff --git a/src/basic/init/initmsg_bytes_free.s b/src/basic/init/initmsg_bytes_free.s
index 379365bf..fb5ac582 100644
--- a/src/basic/init/initmsg_bytes_free.s
+++ b/src/basic/init/initmsg_bytes_free.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -28,7 +29,7 @@ initmsg_bytes_free:
sec ; Read, not write value
jsr JMEMTOP
- cpx #$80
+ cpy #$80
beq @1
!ifdef CONFIG_MEMORY_MODEL_60K {
lda #>$F7FF
diff --git a/src/basic/init/initmsg_m65.s b/src/basic/init/initmsg_m65.s
index baedbe52..f0fa4b64 100644
--- a/src/basic/init/initmsg_m65.s
+++ b/src/basic/init/initmsg_m65.s
@@ -59,9 +59,18 @@ INITMSG_end:
jsr initmsg_bytes_free
+!ifdef HAS_NOLGPL3_WARN {
+
+ lda #str_nonlgpl3_warn
+ jmp STROUT
+
+} else {
+
ldx #$09
ldy #$00
jmp plot_set
+}
INITMSG_main_banner:
diff --git a/src/basic/init/initmsg_real.s b/src/basic/init/initmsg_real.s
index b470d316..d8a21c32 100644
--- a/src/basic/init/initmsg_real.s
+++ b/src/basic/init/initmsg_real.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -6,8 +7,16 @@
; Routine is too long to fit in the original location
+!ifdef ROM_LAYOUT_CRT {
+
+INITMSG:
+
+} else {
+
initmsg_real:
+}
+
; Clear the screen first, some cartridges (like IEEE-488) are leaving a mess on the screen
lda #147
jsr JCHROUT
@@ -60,7 +69,7 @@ initmsg_real:
jsr STROUT
ldx #$00
- ldy #$0A
+ ldy #BANNER_SPACING
jsr plot_set
lda #packed_freq_keywords_01
bne print_freq_packed_string ; branch always
-!ifndef HAS_SMALL_BASIC {
-
-print_packed_keyword_02: ; .X - token number
-
- lda #packed_freq_keywords_02
- bne print_freq_packed_string ; branch always
-}
-
!ifdef CONFIG_MB_M65 {
-print_packed_keyword_03: ; .X - token number
+print_packed_keyword_04: ; .X - token number
- lda #packed_freq_keywords_03
+ lda #packed_freq_keywords_04
+ bne print_freq_packed_string ; branch always
+
+print_packed_keyword_06: ; .X - token number
+
+ lda #packed_freq_keywords_06
bne print_freq_packed_string ; branch always
}
diff --git a/src/basic/print/print_packed_search.s b/src/basic/print/print_packed_search.s
index 8012727c..37457e89 100644
--- a/src/basic/print/print_packed_search.s
+++ b/src/basic/print/print_packed_search.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# X16 BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/rom_revision/bf52.rom_revision_basic.s b/src/basic/rom_revision/bf52.rom_revision_basic.s
index c185b3d9..6bc6892e 100644
--- a/src/basic/rom_revision/bf52.rom_revision_basic.s
+++ b/src/basic/rom_revision/bf52.rom_revision_basic.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE-OFFSET -1F66
;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/basic/wedge/wedge_dos.s b/src/basic/wedge/wedge_dos.s
index f451d4a6..2059c1d2 100644
--- a/src/basic/wedge/wedge_dos.s
+++ b/src/basic/wedge/wedge_dos.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT BASIC_1 #TAKE
;; #LAYOUT# M65 BASIC_1 #TAKE
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -17,6 +18,12 @@ wedge_dos:
jsr (VB1__wedge_dos)
jmp map_NORMAL
+} else ifdef SEGMENT_CRT_BASIC_0 {
+
+ jsr map_BASIC_1
+ jsr JB1__wedge_dos
+ jmp map_NORMAL
+
} else {
; Prepare buffer - finish it with '0'
diff --git a/src/basic/wedge/wedge_tape.s b/src/basic/wedge/wedge_tape.s
index dfa2478e..0b83dc15 100644
--- a/src/basic/wedge/wedge_tape.s
+++ b/src/basic/wedge/wedge_tape.s
@@ -19,8 +19,12 @@ wedge_tape:
cmp #$4C ; 'L'
beq wedge_arrow_L
+
+!ifndef HAS_SMALL_BASIC {
+
cmp #$4D ; 'M'
beq wedge_arrow_M
+}
!ifdef CONFIG_TAPE_HEAD_ALIGN {
@@ -28,6 +32,10 @@ wedge_tape:
beq wedge_arrow_H
}
+ ; FALLTROUGH
+
+wedge_tape_syntax_error:
+
jmp do_SYNTAX_error
!ifdef CONFIG_TAPE_HEAD_ALIGN {
@@ -39,7 +47,16 @@ wedge_arrow_H:
jsr fetch_character_skip_spaces
cmp #$00
- +bne do_SYNTAX_error
+ beq wedge_arrow_H_or_HF
+ cmp #$46 ; 'F'
+ bne wedge_tape_syntax_error
+
+ jsr fetch_character_skip_spaces
+
+ cmp #$00
+ bne wedge_tape_syntax_error
+
+wedge_arrow_H_or_HF:
jsr tape_head_align
@@ -55,6 +72,9 @@ wedge_arrow_L:
jmp cmd_load_got_params
+
+!ifndef HAS_SMALL_BASIC {
+
wedge_arrow_M:
jsr wedge_tape_prepare_load
@@ -64,5 +84,6 @@ wedge_arrow_M:
; Perform merging
jmp cmd_merge_got_params
+}
} ; CONFIG_TAPE_WEDGE
diff --git a/src/dos_m65/,aliases_dos.s b/src/dos_m65/,aliases_dos.s
index 93cad552..954435dd 100644
--- a/src/dos_m65/,aliases_dos.s
+++ b/src/dos_m65/,aliases_dos.s
@@ -2,17 +2,41 @@
; Memory locations for the DOS
;
+; NOTES:
+; - DOS zeropage is mirrored at $8000
+; - starting from $8000, 16KB RAM is available (starting from $10000 in C65 address space)
+; - additional 16KB RAM is reserved for DOS too ($14000-$17FFF), and can be banked-in if needed
+
+
+
;
; Page 0
;
- !addr MAGICSTR = $00 ; magic string; if not matching, DOS considered non-functional
+ !addr MAGICSTR = $00 ; magic string; if not matching, DOS considered non-functional
- !addr UNIT_SDCARD = $05
- !addr UNIT_FLOPPY = $06
- !addr UNIT_RAMDISK = $07
+ ; General DOS configuration
- ; NOTES:
- ; - DOS zeropage is mirrored at $8000
- ; - starting from $8000, 16KB RAM is available (starting from $10000 in C65 address space)
- ; - additional 16KB RAM is reserved for DOS too ($14000-$17FFF), and can be banked-in if needed
+ !addr UNIT_SDCARD = $05
+ !addr UNIT_FLOPPY = $06
+ !addr UNIT_RAMDISK = $07
+
+ ; SD/SDHC card variables
+
+ !addr CARD_INIT_DONE = $08 ; $80 - init done, $00 - init not done
+ !addr CARD_IS_SDHC = $09 ; $00 = SD, $80 = SDHC
+ !addr CARD_SIZE = $0A ; 4 bytes
+ !addr CARD_SECNUM = $0E ; 4 bytes - sector number
+
+ !addr CARD_TMP_STEP = $12 ; 4 bytes
+ !addr CARD_TMP_RETRIES = $16 ; 1 byte
+
+ !addr CARD_BUFPNT = $FC ; 4 bytes - pointer to hardware sector buffer XXX replace copy routines with DMAgic
+
+
+
+ ;
+ ; High memory
+ ;
+
+ !addr CARD_BUF = $8100 ; 512 bytes, up to $82FF - buffer for reading/writing data
diff --git a/src/dos_m65/cmdrdos/,check_nonlgpl3.s b/src/dos_m65/cmdrdos/,check_nonlgpl3.s
new file mode 100644
index 00000000..a5e16f82
--- /dev/null
+++ b/src/dos_m65/cmdrdos/,check_nonlgpl3.s
@@ -0,0 +1,4 @@
+
+!ifndef HAS_NOLGPL3_WARN {
+ !error "No LGPL3 incompatible warning issued"
+}
diff --git a/src/dos_m65/dos_init.s b/src/dos_m65/dos_init.s
index 8cc6e213..5654e923 100644
--- a/src/dos_m65/dos_init.s
+++ b/src/dos_m65/dos_init.s
@@ -26,6 +26,9 @@ dos_INIT:
lda #CONFIG_UNIT_RAMDISK
sta UNIT_RAMDISK
- ; XXX initialize drivers, etc.
+ ; Mark SD card as not initialized
+
+ lda #$00
+ sta CARD_INIT_DONE
rts
diff --git a/src/dos_m65/m65_sdcard.s b/src/dos_m65/m65_sdcard.s
deleted file mode 100644
index e0f474a1..00000000
--- a/src/dos_m65/m65_sdcard.s
+++ /dev/null
@@ -1,321 +0,0 @@
-
-;
-; MEGA65 SD/SDHC card support
-;
-
-; Based on https://github.com/MEGA65/mega65-libc/blob/master/cc65/src/sdcard.c
-
-
-
-; Permanent values XXX addresses are temporary
-
-!addr CARD_IS_SDHC = $80 ; $00 = SD, $80 = SDHC
-!addr CARD_SIZE = $81 ; 4 bytes
-!addr CARD_SECNUM = $85 ; 4 bytes - sector number
-
-
-; Temporary data XXX addresses are temporary
-
-!addr TMP_STEP = $89 ; 4 bytes
-!addr TMP_RETRIES = $8D ; 1 byte
-
-
-; XXX hardware address SD_SECTORBUF = 0xffd6e00L;
-
-
-; External entry points:
-; - m65_sdcard_init
-; - m65_sdcard_readsector
-
-
-
-m65_sdcard_init:
-
- lda #$00
- sta CARD_IS_SDHC
-
- jsr m65_sdcard_reset
-
- ; Try to read first sector to see if card is operable
-
- lda #$00
- sta SD_ADDR+0
- sta SD_ADDR+1
- sta SD_ADDR+2
- sta SD_ADDR+3
-
- jsr m65_sdcard_read
- bcc m65_sdcard_init_operable
-
- ; XXX if we are here, mark card as not operable and quit
-
-m65_sdcard_init_operable:
-
- ; Work out if this is SD or SDHC card - SD cards can't read at non-sector aligned addresses
-
- lda #$02
- sta SD_ADDR+0
- lda #$00
- sta SD_ADDR+1
- sta SD_ADDR+2
- sta SD_ADDR+3
-
- jsr m65_sdcard_read
-
- lda SD_CTL
- beq m65_sdcard_init_sdsc
-
- ; FALLTROUGH
-
-m65_sdcard_init_sdhc:
-
- lda #$80
- sta CARD_IS_SDHC
-
- ; Prepare data for determining card size - put $00200000 to TMP_STEP and CARD_SECNUM
-
- ; SDHC claims 32GB limit, and reading from beyond that might cause
- ; trouble. However, 32bits x 512byte sectors = 16TB addressable.
- ; It thus seems that the top byte of the address may not be safe to use,
- ; or at least the top few bits.
-
- ; XXX this should be initialized to 0 in a loop
- ; XXX is it needed for anything
-
- lda #$00
- sta CARD_SECNUM+0
- sta TMP_STEP+0
- sta CARD_SECNUM+1
- sta TMP_STEP+1
- sta CARD_SECNUM+2
- sta TMP_STEP+2
-
- lda #$02
- sta CARD_SECNUM+3
- sta TMP_STEP+3
-
- bra m65_sdcard_init_getsize
-
-m65_sdcard_init_sdsc:
-
- lda #$00
- sta CARD_IS_SDHC
- lda #$40 ; use byte addressing
- sta SD_CTL
-
- ; Prepare data for determining card size - put $00200000 to TMP_STEP and CARD_SECNUM
-
- ; XXX this should be initialized to 0 in a loop
- ; XXX is it needed for anything
-
- lda #$00
- sta CARD_SECNUM+0
- sta TMP_STEP+0
- sta CARD_SECNUM+1
- sta TMP_STEP+1
- sta CARD_SECNUM+3
- sta TMP_STEP+3
-
- lda #$02
- sta CARD_SECNUM+2
- sta TMP_STEP+2
-
- ; FALLTROUGH
-
-m65_sdcard_init_getsize:
-
- ; Work out size of SD card in a safe way
- ; (binary search of sector numbers is NOT safe for some reason.
- ; It frequently reports bigger than the size of the card)
-
- lda #$00
- sta CARD_SECNUM+0
- sta CARD_SECNUM+1
- sta CARD_SECNUM+2
- sta CARD_SECNUM+3
-
- ; step = 16*2048
-
- sta TMP_STEP+0
- sta TMP_STEP+2
- sta TMP_STEP+3
- lda #$08
- sta TMP_STEP+1
-
- ; XXX finish the implementation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-m65_sdcard_readsector: ; XXX reads sector CARD_SECNUM
-
- ; Set read address, depending on card type
-
- bit CARD_IS_SDHC
- bpl m65_sdcard_readsector_sdsc
-
-m65_sdcard_readsector_sdhc:
-
- lda CARD_SECNUM+0
- sta SD_ADDR+0
- lda CARD_SECNUM+1
- sta SD_ADDR+1
- lda CARD_SECNUM+2
- sta SD_ADDR+2
- lda CARD_SECNUM+3
- sta SD_ADDR+3
-
- bra m65_sdcard_readsector_read
-
-
-m65_sdcard_readsector_sdsc: ; multiply sector number by 512
-
- lda #$00
- sta SD_ADDR+0
- clc
- lda CARD_SECNUM+0
- rol
- sta SD_ADDR+1
- lda CARD_SECNUM+1
- rol
- sta SD_ADDR+2
- lda CARD_SECNUM+2
- rol
- sta SD_ADDR+3
- bcs m65_sdcard_readsector_fail ; branch if sector number too large for SD card
- lda CARD_SECNUM+3
- bne m65_sdcard_readsector_fail ; branch if sector number too large for SD card
-
- ; FALLTROUGH
-
-m65_sdcard_readsector_read:
-
- ; Wait till card is ready
-
-
-
-
-
-
- ; Set number of retries
-
- lda #$0A
- sta TMP_RETRIES
-
- ; XXX
-
-
-
-
-
-
-
-
-m65_sdcard_readsector_fail:
-
- sec
- rts
-
-
-
-
-
-
-
-
-
-
-
-
-m65_sdcard_read:
-
- ; Trigger read
-
- lda #$02
- sta SD_CTL
-
- ; Wait for result
-
- ldx #90
-@1:
- jsr m65_sdcard_wait_16000_usec
- lda SD_CTL
- and #$03
- beq @2
- dex
- bne @1
-
- ; Read failed
-
- sec
- rts
-@2:
- ;; Success
-
- clc
- rts
-
-
-
-
-
-m65_sdcard_reset:
-
- ldx #$40
- stx SD_CTL
- ldy #$00
- sty SD_CTL
- iny ; $01
- sty SD_CTL
-
- ; Wait till SD card resets
-@3:
- lda SD_CTL
- and #$03
- bne @3
-
- ; For SDHC card set appropriate mode
-
- bit CARD_IS_SDHC
- bpl @4
- inx ; $41
- stx SD_CTL
-@4:
- rts
-
-
-
-m65_sdcard_wait_16000_usec:
-
- ; Uses VIC-II raster register; wait time is not exactly precise, but should be
- ; a good approximation
-
- phx
- pha
-
- ldx #$FF
-
- ; XXX wait below is same as in KKERNAL, wait_x_lines - consider importing and reusing
- lda VIC_RASTER
-@w1:
- cmp VIC_RASTER
- beq @w1
- lda VIC_RASTER
- dex
- bne @w1
-
- pla
- plx
-
- rts
diff --git a/src/dos_m65/sdcard/sdcard_helpers.s b/src/dos_m65/sdcard/sdcard_helpers.s
new file mode 100644
index 00000000..053af35f
--- /dev/null
+++ b/src/dos_m65/sdcard/sdcard_helpers.s
@@ -0,0 +1,93 @@
+
+;
+; Various helper routines for SD card support
+;
+
+; Based on https://github.com/MEGA65/mega65-libc/blob/master/cc65/src/sdcard.c
+
+
+
+;
+; Sets read/write address
+;
+; Input: CARD_SECNUM, CARD_IS_SDHC
+; Output: Carry set = error
+; Preserves: .X, .Y, .Z
+;
+
+sdcard_set_addr:
+
+ bit CARD_IS_SDHC
+ bpl sdcard_set_addr_sdsc
+
+sdcard_set_addr_sdhc:
+
+ lda CARD_SECNUM+0
+ sta SD_ADDR+0
+ lda CARD_SECNUM+1
+ sta SD_ADDR+1
+ lda CARD_SECNUM+2
+ sta SD_ADDR+2
+ lda CARD_SECNUM+3
+ sta SD_ADDR+3
+
+ ; FALLTROUGH
+
+sdcard_set_addr_done:
+
+ clc
+ rts
+
+sdcard_set_addr_sdsc:
+
+ ; Multiply sector number by 512
+
+ lda #$00
+ sta SD_ADDR+0
+ clc
+ lda CARD_SECNUM+0
+ rol
+ sta SD_ADDR+1
+ lda CARD_SECNUM+1
+ rol
+ sta SD_ADDR+2
+ lda CARD_SECNUM+2
+ rol
+ sta SD_ADDR+3
+ bcs sdcard_helper_fail ; branch if sector number too large for SD card
+ lda CARD_SECNUM+3
+ beq sdcard_set_addr_done ; do not branch if sector number too large for SD card
+
+ ; FALLTROUGH
+
+sdcard_helper_fail:
+
+ sec
+ rts
+
+
+;
+; Wait till card is ready
+;
+; Input: none
+; Output: Carry set = error
+; Preserves: .Y, .Z
+
+sdcard_wait_ready:
+
+ ; XXX if card does not get ready, try to reset it
+
+ lda SD_CTL
+ ; Sometimes we see this result, i.e., sdcard.vhdl thinks it is done,
+ ; but sdcardio.vhdl thinks not. This means a read error.
+ cmp #$01
+ beq sdcard_helper_fail
+ tax
+ and #$40
+ bne sdcard_helper_fail
+ txa
+ and #$03
+ bne sdcard_wait_ready
+
+ clc
+ rts
diff --git a/src/dos_m65/sdcard/sdcard_init.s b/src/dos_m65/sdcard/sdcard_init.s
new file mode 100644
index 00000000..9ed9878d
--- /dev/null
+++ b/src/dos_m65/sdcard/sdcard_init.s
@@ -0,0 +1,136 @@
+
+;
+; Initialize memory card, determine it's type and size
+;
+
+; Based on https://github.com/MEGA65/mega65-libc/blob/master/cc65/src/sdcard.c
+
+
+
+; XXX finish the routine
+
+
+sdcard_init:
+
+ ; Initialize most important variables
+
+ lda #$00
+ sta CARD_IS_SDHC
+
+ lda #SD_SECBUF_0
+ sta CARD_BUFPNT+0
+ lda #SD_SECBUF_1
+ sta CARD_BUFPNT+1
+ lda #SD_SECBUF_2
+ sta CARD_BUFPNT+2
+ lda #SD_SECBUF_3
+ sta CARD_BUFPNT+3
+
+ ; Reset the card
+
+ jsr sdcard_reset
+
+ ; Try to read first sector to see if card is operable
+
+ lda #$00
+ sta SD_ADDR+0
+ sta SD_ADDR+1
+ sta SD_ADDR+2
+ sta SD_ADDR+3
+
+ jsr sdcard_init_read
+ bcc sdcard_init_operable
+
+ ; XXX if we are here, mark card as not operable and quit
+
+sdcard_init_operable:
+
+ ; Work out if this is SD or SDHC card - SD cards can't read at non-sector aligned addresses
+
+ lda #$02
+ sta SD_ADDR+0
+ lda #$00
+ sta SD_ADDR+1
+ sta SD_ADDR+2
+ sta SD_ADDR+3
+
+ jsr sdcard_init_read
+
+ lda SD_CTL
+ beq sdcard_init_sdsc
+
+ ; FALLTROUGH
+
+sdcard_init_sdhc:
+
+ lda #$80
+ sta CARD_IS_SDHC
+
+ bra sdcard_init_getsize
+
+sdcard_init_sdsc:
+
+ lda #$00
+ sta CARD_IS_SDHC
+ lda #CARD_CMD_SDHC_OFF ; $40 - use byte addressing
+ sta SD_CTL
+
+ ; FALLTROUGH
+
+sdcard_init_getsize:
+
+ ; Work out size of SD card in a safe way
+ ; (binary search of sector numbers is NOT safe for some reason.
+ ; It frequently reports bigger than the size of the card)
+
+ lda #$00
+ sta CARD_SECNUM+0
+ sta CARD_SECNUM+1
+ sta CARD_SECNUM+2
+ sta CARD_SECNUM+3
+
+ ; step = 16*2048
+
+ sta CARD_TMP_STEP+0
+ sta CARD_TMP_STEP+2
+ sta CARD_TMP_STEP+3
+ lda #$08
+ sta CARD_TMP_STEP+1
+
+ ; XXX finish the implementation
+
+
+
+
+;
+; Helper routines
+;
+
+
+sdcard_init_read:
+
+ ; Trigger read
+
+ lda #CARD_CMD_READ ; $02
+ sta SD_CTL
+
+ ; Wait for result
+
+ ldx #90
+@1:
+ jsr sdcard_wait_16000_usec
+ lda SD_CTL
+ and #$03
+ beq @2
+ dex
+ bne @1
+
+ ; Read failed
+
+ sec
+ rts
+@2:
+ ;; Success
+
+ clc
+ rts
diff --git a/src/dos_m65/sdcard/sdcard_readsector.s b/src/dos_m65/sdcard/sdcard_readsector.s
new file mode 100644
index 00000000..c2523185
--- /dev/null
+++ b/src/dos_m65/sdcard/sdcard_readsector.s
@@ -0,0 +1,97 @@
+
+;
+; Reads the sector from the SD card
+;
+
+; Based on https://github.com/MEGA65/mega65-libc/blob/master/cc65/src/sdcard.c
+
+
+; XXX provide documentation
+
+
+sdcard_readsector:
+
+ ; XXX check if card initialized and operable
+
+ ; Set read address
+
+ jsr sdcard_set_addr
+ bcs sdcard_readsector_fail
+
+ ; FALLTROUGH
+
+sdcard_readsector_read:
+
+ ; Set number of retries
+
+ lda #$0A
+ sta CARD_TMP_RETRIES
+
+ ; FALLTROUGH
+
+sdcard_readsector_try_loop:
+
+ ; Wait till card is ready
+
+ jsr sdcard_wait_ready
+ bcs sdcard_readsector_fail
+
+ ; Read command
+
+ lda #CARD_CMD_READ ; $02
+ sta SD_CTL
+
+ ; Wait for command completion
+
+ jsr sdcard_wait_ready
+ bcs sdcard_readsector_fail
+
+ lda SD_CTL
+ and #$67
+ bne sdcard_readsector_copy_data
+
+ jsr sdcard_reset
+ dec CARD_TMP_RETRIES
+ bne sdcard_readsector_try_loop
+
+ ; FALLTROUGH
+
+sdcard_readsector_fail:
+
+ sec
+ rts
+
+
+;
+; Helper routines
+;
+
+sdcard_readsector_copy_data:
+
+ ; XXX use DMAgic for this
+
+ phz
+ phx
+
+ ldx #$00
+ ldz #$00
+
+@1:
+ lda [CARD_BUFPNT],z
+ sta CARD_BUF,x
+ inc CARD_BUFPNT+1
+ lda [CARD_BUFPNT],z
+ sta CARD_BUF+$100,x
+ dec CARD_BUFPNT+1
+
+ inz
+ inx
+ bne @1
+
+ ; Restore registers and quit
+
+ plx
+ plz
+
+ clc
+ rts
diff --git a/src/dos_m65/sdcard/sdcard_reset.s b/src/dos_m65/sdcard/sdcard_reset.s
new file mode 100644
index 00000000..244233bf
--- /dev/null
+++ b/src/dos_m65/sdcard/sdcard_reset.s
@@ -0,0 +1,32 @@
+
+;
+; Resets the SD card
+;
+
+; Based on https://github.com/MEGA65/mega65-libc/blob/master/cc65/src/sdcard.c
+
+
+
+sdcard_reset:
+
+ ldx #CARD_CMD_SDHC_OFF ; $40
+ stx SD_CTL
+ ldy #CARD_CMD_RESET ; $00
+ sty SD_CTL
+ ldy #CARD_CMD_END_RESET ; $01
+ sty SD_CTL
+
+ ; Wait till SD card resets
+@1:
+ lda SD_CTL
+ and #$03
+ bne @1
+
+ ; For SDHC card set appropriate mode
+
+ bit CARD_IS_SDHC
+ bpl @2
+ ldx #CARD_CMD_SDHC_ON ; $41
+ stx SD_CTL
+@2:
+ rts
diff --git a/src/dos_m65/sdcard/sdcard_wait.s b/src/dos_m65/sdcard/sdcard_wait.s
new file mode 100644
index 00000000..59f89cb7
--- /dev/null
+++ b/src/dos_m65/sdcard/sdcard_wait.s
@@ -0,0 +1,26 @@
+
+
+
+sdcard_wait_16000_usec:
+
+ ; Uses VIC-II raster register; wait time is not exactly precise, but should be
+ ; a good approximation
+
+ phx
+ pha
+
+ ldx #$FF
+
+ ; XXX wait below is same as in KKERNAL, wait_x_lines - consider importing and reusing
+ lda VIC_RASTER
+@1:
+ cmp VIC_RASTER
+ beq @1
+ lda VIC_RASTER
+ dex
+ bne @1
+
+ pla
+ plx
+
+ rts
diff --git a/src/dos_m65/sdcard/sdcard_writesector.s b/src/dos_m65/sdcard/sdcard_writesector.s
new file mode 100644
index 00000000..833719fe
--- /dev/null
+++ b/src/dos_m65/sdcard/sdcard_writesector.s
@@ -0,0 +1,143 @@
+
+;
+; Writes the sector to the SD card
+;
+
+; Based on https://github.com/MEGA65/mega65-libc/blob/master/cc65/src/sdcard.c
+
+
+; XXX finish, provide documentation
+
+
+sdcard_writesector:
+
+ ; XXX check if card initialized and operable
+
+ lda SD_CTL
+ and #$03
+ bne sdcard_writesector ; XXX add a timer here
+
+ ; End reset XXX is this needed? should this be done for sector reading too?
+
+ lda #CARD_CMD_END_RESET ; $01
+ sta SD_CTL
+
+ ; Set write address
+
+ jsr sdcard_set_addr
+ bcs sdcard_writesector_fail
+
+ ; FALLTROUGH
+
+sdcard_writesector_write:
+
+ ; Set number of retries
+
+ lda #$0A
+ sta CARD_TMP_RETRIES
+
+ ; FALLTROUGH
+
+sdcard_writesector_try_loop:
+
+ jsr sdcard_writesector_copy_data
+
+ ; Wait till card is ready
+
+ jsr sdcard_wait_ready
+ bcs sdcard_writesector_fail
+
+ ; Write command
+
+ lda #CARD_CMD_WRITE ; $03
+ sta SD_CTL
+
+ ; Wait for command completion
+
+ jsr sdcard_wait_ready
+ bcs sdcard_writesector_fail
+
+ ; Check result
+
+ lda SD_CTL
+ and #$67
+ bne sdcard_writesector_verify
+
+ ; Write failed - retry
+
+ jsr sdcard_reset
+ dec CARD_TMP_RETRIES
+ bne sdcard_writesector_try_loop
+
+ ; FALLTROUGH
+
+sdcard_writesector_fail:
+
+ sec
+ rts
+
+sdcard_writesector_verify:
+
+ ; There is a bug in the SD controller; you have to read between writes,
+ ; or it gets really upset
+
+@1:
+ lda SD_CTL
+ and #$03
+ bne @1
+
+ lda #CARD_CMD_READ ; $02
+ sta SD_CTL
+
+@2:
+ lda SD_CTL
+ and #$03
+ beq @2
+
+@3: ; XXX deduplicate this ppart
+ lda SD_CTL
+ and #$03
+ bne @3
+
+ ; XXX verify - compare buffer
+
+
+
+
+
+
+
+
+;
+; Helper routines
+;
+
+sdcard_writesector_copy_data:
+
+ ; XXX use DMAgic for this
+
+ phz
+ phx
+
+ ldx #$00
+ ldz #$00
+
+@1:
+ lda CARD_BUF,x
+ sta [CARD_BUFPNT],z
+ inc CARD_BUFPNT+1
+ lda CARD_BUF+$100,x
+ sta [CARD_BUFPNT],z
+ dec CARD_BUFPNT+1
+
+ inz
+ inx
+ bne @1
+
+ ; Restore registers and quit
+
+ plx
+ plz
+
+ clc
+ rts
diff --git a/src/kernal/assets/kernal_messages.s b/src/kernal/assets/kernal_messages.s
index 5c816750..6eb9fb56 100644
--- a/src/kernal/assets/kernal_messages.s
+++ b/src/kernal/assets/kernal_messages.s
@@ -19,9 +19,8 @@
!ifdef HAS_TAPE {
!addr __MSG_KERNAL_PRESS_PLAY = __msg_kernalplay - __msg_kernal_first
!addr __MSG_KERNAL_FOUND = __msg_kernalfound - __msg_kernal_first
-!ifdef CONFIG_MB_M65 {
-!addr __MSG_KERNAL_OK_SEARCHING = __msg_kernaloksearching - __msg_kernal_first
-} }
+!addr __MSG_KERNAL_OK_SEARCH = __msg_kernaloksearch - __msg_kernal_first
+}
!ifdef CONFIG_PANIC_SCREEN {
!addr __MSG_KERNAL_PANIC = __msg_kernalpanic - __msg_kernal_first
@@ -70,14 +69,12 @@ __msg_kernalfound:
!pet "found"
!byte $80 + $20 ; end of string mark + space
-!ifdef CONFIG_MB_M65 {
-
-__msg_kernaloksearching:
+__msg_kernaloksearch:
!pet "ok"
!byte $0D, $0D
!pet "searchin"
!byte $80 + $47 ; end of string mark + 'G'
-} }
+}
!ifdef CONFIG_PANIC_SCREEN {
diff --git a/src/kernal/board_crt/8000.crt_vectable_kernal_1.s b/src/kernal/board_crt/8000.crt_vectable_kernal_1.s
new file mode 100644
index 00000000..9b3a1c00
--- /dev/null
+++ b/src/kernal/board_crt/8000.crt_vectable_kernal_1.s
@@ -0,0 +1,40 @@
+;; #LAYOUT# CRT KERNAL_0 #TAKE-FLOAT
+;; #LAYOUT# CRT KERNAL_1 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;
+; Definitions for communication with cartridge segment KERNAL_1 from KERNAL_0
+;
+
+
+!ifdef SEGMENT_KERNAL_0 {
+
+ ; Label definitions
+
+ !addr JK1__load_tape_normal = $8000 + 3 * 0
+ !addr JK1__load_tape_turbo = $8000 + 3 * 1
+ !addr JK1__load_tape_auto = $8000 + 3 * 2
+ !addr JK1__tape_head_align = $8000 + 3 * 3
+
+} else {
+
+ ; Jump table (Open ROMs private!)
+
+!ifdef CONFIG_TAPE_NORMAL { !ifndef CONFIG_TAPE_AUTODETECT {
+ jmp load_tape_normal
+} else { !byte $00, $00, $00 } } else { !byte $00, $00, $00 }
+
+!ifdef CONFIG_TAPE_TURBO { !ifndef CONFIG_TAPE_AUTODETECT {
+ jmp load_tape_turbo
+} else { !byte $00, $00, $00 } } else { !byte $00, $00, $00 }
+
+!ifdef CONFIG_TAPE_AUTODETECT {
+ jmp load_tape_auto
+} else { !byte $00, $00, $00 }
+
+!ifdef CONFIG_TAPE_HEAD_ALIGN {
+ jmp tape_head_align
+} else { !byte $00, $00, $00 }
+
+
+}
diff --git a/src/kernal/board_crt/8000.interop b/src/kernal/board_crt/8000.interop
new file mode 100644
index 00000000..7acd2a6f
--- /dev/null
+++ b/src/kernal/board_crt/8000.interop
@@ -0,0 +1 @@
+This particular address is not for interoperability - we had to choose some fixed location for the extended ROM jumptable, beginning of the mapped memory block is just sane.
diff --git a/src/kernal/board_crt/crt_imports.s b/src/kernal/board_crt/crt_imports.s
new file mode 100644
index 00000000..86a5c251
--- /dev/null
+++ b/src/kernal/board_crt/crt_imports.s
@@ -0,0 +1,55 @@
+;; #LAYOUT# CRT KERNAL_1 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;; #IMPORT# KERNAL_0 = KERNAL_0_combined.sym
+
+;
+; Definitions for calling cartridge segment KERNAL_0 routines from KERNAL_1
+;
+
+;; #ALIAS# STOP = KERNAL_0.STOP
+;; #ALIAS# IOINIT = KERNAL_0.proxy_K1_IOINIT
+
+;; #ALIAS# map_NORMAL = KERNAL_0.map_NORMAL
+;; #ALIAS# map_KERNAL_1 = KERNAL_0.map_KERNAL_1
+
+;; #ALIAS# screen_on = KERNAL_0.screen_on
+;; #ALIAS# screen_off = KERNAL_0.screen_off
+
+;; #ALIAS# hw_entry_reset = KERNAL_0.hw_entry_reset
+;; #ALIAS# return_from_interrupt = KERNAL_0.return_from_interrupt
+;; #ALIAS# udtim_keyboard = KERNAL_0.udtim_keyboard
+;; #ALIAS# wait_x_bars = KERNAL_0.wait_x_bars
+
+;; #ALIAS# tape_motor_on = KERNAL_0.tape_motor_on
+;; #ALIAS# tape_motor_off = KERNAL_0.tape_motor_off
+
+;; #ALIAS# lvs_display_loading_verifying = KERNAL_0.proxy_K1_lvs_display_loading_verifying
+;; #ALIAS# lvs_display_done = KERNAL_0.proxy_K1_lvs_display_done
+;; #ALIAS# lvs_return_last_address = KERNAL_0.proxy_K1_lvs_return_last_address
+;; #ALIAS# lvs_device_not_found_error = KERNAL_0.proxy_K1_lvs_device_not_found_error
+;; #ALIAS# lvs_load_verify_error = KERNAL_0.proxy_K1_lvs_load_verify_error
+;; #ALIAS# lvs_check_EAL = KERNAL_0.lvs_check_EAL
+;; #ALIAS# lvs_STAL_to_MEMUSS = KERNAL_0.lvs_STAL_to_MEMUSS
+;; #ALIAS# lvs_advance_MEMUSS = KERNAL_0.lvs_advance_MEMUSS
+
+;; #ALIAS# kernalerror_ROUTINE_TERMINATED = KERNAL_0.proxy_K1_kernalerror_ROUTINE_TERMINATED
+
+;; #ALIAS# print_kernal_message = KERNAL_0.proxy_K1_print_kernal_message
+;; #ALIAS# print_return = KERNAL_0.proxy_K1_print_return
+
+;; #ALIAS# __MSG_KERNAL_PRESS_PLAY = KERNAL_0.__MSG_KERNAL_PRESS_PLAY
+;; #ALIAS# __MSG_KERNAL_OK_SEARCH = KERNAL_0.__MSG_KERNAL_OK_SEARCH
+;; #ALIAS# __MSG_KERNAL_FOUND = KERNAL_0.__MSG_KERNAL_FOUND
+
+;; #ALIAS# tape_normal_byte_store = KERNAL_0.tape_normal_byte_store
+
+;; #ALIAS# CLALL = KERNAL_0.proxy_K1_CLALL
+;; #ALIAS# nmi_lock = KERNAL_0.nmi_lock
+
+;
+; Ultimate 64 specific entries
+;
+
+;; #ALIAS# U64_SLOW = KERNAL_0.U64_SLOW
+;; #ALIAS# U64_FAST = KERNAL_0.U64_FAST
diff --git a/src/kernal/board_crt/crt_init_map.s b/src/kernal/board_crt/crt_init_map.s
new file mode 100644
index 00000000..b1eced5e
--- /dev/null
+++ b/src/kernal/board_crt/crt_init_map.s
@@ -0,0 +1,100 @@
+;; #LAYOUT# CRT KERNAL_0 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+
+; Register meaning according to http://wiki.icomp.de/wiki/Retro_Replay
+;
+; $DE00 - write:
+; bit 7 - bit 15 of ROM bank address
+; bit 6 - needed by freeze, not useful for Open ROMs
+; bit 5 - 0 = ROM, 1 = RAM
+; bit 4 - bit 14 of ROM/RAM bank address
+; bit 3 - bit 13 of ROM/RAM bank address
+; bit 2 - 1 = disable cartridge
+; bit 1 - EXROM, 0 = assert
+; bit 0 - GAME, 0 = assert
+;
+; $DE01 - write:
+; bit 7 - bit 15 of ROM bank address
+; bit 6 - 1 = REU compatible memory map
+; bit 5 - needed by flash mode, not useful for Open ROMs
+; bit 4 - bit 14 of ROM/RAM bank address
+; bit 3 - bit 13 of ROM/RAM bank address
+; bit 2 - NoFreeze, 1 = disable freeze function
+; bit 1 - AllowBank, 1 = enables banking of RAM in $DF00/$DE02 area
+; bit 0 - 1 = enables accessory connector
+;
+; $DE00 / $DE01 - read:
+; bit 7 - bit 15 of ROM bank address
+; bit 6 - 1 = REU compatible memory map
+; bit 5 - needed by flash mode, not useful for Open ROMs
+; bit 4 - bit 14 of ROM/RAM bank address
+; bit 3 - bit 13 of ROM/RAM bank address
+; bit 2 - 1 = FREEZE button pressed
+; bit 1 - AllowBank
+; bit 0 - 1 = flash mode activated by jumper
+
+
+crt_init_fail:
+
+ +panic P_ERR_ROM_MISMATCH
+
+crt_init:
+
+ ; Setup the cart
+
+ lda #%01000100 ; REU compatible memory map, no freezing
+ sta $DE01
+
+ ; Bank-in the first ROM bank
+
+ jsr map_BASIC_1
+
+ ; Check if ROM revision matches the cartridge
+
+ ldy #$FF
+@1:
+ iny
+ lda $E4B9, y ; Kernal ROM revision address
+ cmp $9FEC, y ; cartridge ROM revision address
+ bne crt_init_fail
+ cmp #$00
+ bne @1
+
+ ; FALLTROUGH
+
+map_NORMAL:
+
+ ; Unmap cartridge memory
+
+ php
+ pha
+
+ lda #%00000010
+
+ ; FALLTROUGH
+
+map_NORMAL_common:
+
+ sta $DE00
+
+ pla
+ plp
+
+ rts
+
+map_BASIC_1:
+
+ php
+ pha
+
+ lda #%00000000
+ beq map_NORMAL_common
+
+map_KERNAL_1:
+
+ php
+ pha
+
+ lda #%00010000
+ bne map_NORMAL_common
diff --git a/src/kernal/board_crt/crt_proxies.s b/src/kernal/board_crt/crt_proxies.s
new file mode 100644
index 00000000..6db895d4
--- /dev/null
+++ b/src/kernal/board_crt/crt_proxies.s
@@ -0,0 +1,72 @@
+;; #LAYOUT# CRT KERNAL_0 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;
+; Proxies for calling cartridge segment KERNAL_0 routines from KERNAL_1
+;
+
+
+
+!ifdef HAS_TAPE {
+
+proxy_K1_kernalerror_ROUTINE_TERMINATED:
+
+ jsr map_NORMAL
+ jmp kernalerror_ROUTINE_TERMINATED
+
+proxy_K1_lvs_display_loading_verifying:
+
+ jsr map_NORMAL
+ jsr lvs_display_loading_verifying
+ jmp map_KERNAL_1
+
+proxy_K1_lvs_display_done:
+
+ jsr map_NORMAL
+ jsr lvs_display_done
+ jmp map_KERNAL_1
+
+proxy_K1_lvs_return_last_address:
+
+ jsr map_NORMAL
+ jmp lvs_return_last_address
+
+proxy_K1_lvs_device_not_found_error:
+
+ jsr map_NORMAL
+ jmp lvs_device_not_found_error
+
+proxy_K1_lvs_load_verify_error:
+
+ jsr map_NORMAL
+ jmp lvs_load_verify_error
+
+proxy_K1_print_kernal_message:
+
+ jsr map_NORMAL
+ jsr print_kernal_message
+ jmp map_KERNAL_1
+
+proxy_K1_print_return:
+
+ jsr map_NORMAL
+ jsr print_return
+ jmp map_KERNAL_1
+}
+
+
+!ifdef CONFIG_TAPE_HEAD_ALIGN {
+
+proxy_K1_CLALL:
+
+ jsr map_NORMAL
+ jsr CLALL
+ jmp map_KERNAL_1
+
+proxy_K1_IOINIT:
+
+ jsr map_NORMAL
+ jsr IOINIT
+ jmp map_KERNAL_1
+
+}
diff --git a/src/kernal/board_crt/crt_redirect_tape.s b/src/kernal/board_crt/crt_redirect_tape.s
new file mode 100644
index 00000000..c520c122
--- /dev/null
+++ b/src/kernal/board_crt/crt_redirect_tape.s
@@ -0,0 +1,46 @@
+;; #LAYOUT# CRT KERNAL_0 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;
+; ROM routine call redirect for tape routines
+;
+
+
+!ifdef CONFIG_TAPE_NORMAL { !ifndef CONFIG_TAPE_AUTODETECT {
+
+load_tape_normal:
+
+ jsr map_KERNAL_1
+ jsr JK1__load_tape_normal
+ jmp map_NORMAL
+} }
+
+
+!ifdef CONFIG_TAPE_TURBO { !ifndef CONFIG_TAPE_AUTODETECT {
+
+load_tape_turbo:
+
+ jsr map_KERNAL_1
+ jsr JK1__load_tape_turbo
+ jmp map_NORMAL
+} }
+
+
+!ifdef CONFIG_TAPE_AUTODETECT {
+
+load_tape_auto:
+
+ jsr map_KERNAL_1
+ jsr JK1__load_tape_auto
+ jmp map_NORMAL
+}
+
+
+!ifdef CONFIG_TAPE_HEAD_ALIGN {
+
+tape_head_align:
+
+ jsr map_KERNAL_1
+ jsr JK1__tape_head_align
+ jmp map_NORMAL
+}
diff --git a/src/kernal/board_crt/crt_tape_normal_byte_store.s b/src/kernal/board_crt/crt_tape_normal_byte_store.s
new file mode 100644
index 00000000..9569548b
--- /dev/null
+++ b/src/kernal/board_crt/crt_tape_normal_byte_store.s
@@ -0,0 +1,17 @@
+;; #LAYOUT# CRT KERNAL_0 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;
+; Tape (normal) helper routine - byte storage when banking change is needed
+;
+
+
+!ifdef CONFIG_TAPE_NORMAL {
+
+
+tape_normal_byte_store:
+
+ jsr map_NORMAL
+ sta (MEMUSS), y
+ jmp map_KERNAL_1
+}
diff --git a/src/kernal/board_m65/4000.interop b/src/kernal/board_m65/4000.interop
index 7b399af5..7acd2a6f 100644
--- a/src/kernal/board_m65/4000.interop
+++ b/src/kernal/board_m65/4000.interop
@@ -1 +1 @@
-This particular address is not for interoperability - we had to choose some fixed location foor the extended ROM jumptable, beginning of the mapped memory block is just sane.
+This particular address is not for interoperability - we had to choose some fixed location for the extended ROM jumptable, beginning of the mapped memory block is just sane.
diff --git a/src/kernal/board_m65/4000.mega65_vectable_kernal_1.s b/src/kernal/board_m65/4000.mega65_vectable_kernal_1.s
index 38f47421..68767abe 100644
--- a/src/kernal/board_m65/4000.mega65_vectable_kernal_1.s
+++ b/src/kernal/board_m65/4000.mega65_vectable_kernal_1.s
@@ -43,7 +43,6 @@
!word load_tape_turbo
} else { !word $0000 } } else { !word $0000 }
-
!ifdef CONFIG_TAPE_AUTODETECT {
!word load_tape_auto
} else { !word $0000 }
diff --git a/src/kernal/board_m65/mega65_hypervisor_reset.s b/src/kernal/board_m65/mega65_hypervisor_reset.s
index 64bc98eb..db451919 100644
--- a/src/kernal/board_m65/mega65_hypervisor_reset.s
+++ b/src/kernal/board_m65/mega65_hypervisor_reset.s
@@ -3,8 +3,6 @@
; Reset (hardware initialization) to be used when Open ROMs is used under hypervisor
-; XXX size-optimize this; share code with regular reset
-
m65_hypervisor_reset:
@@ -13,6 +11,9 @@ m65_hypervisor_reset:
sei ; disable the interrupts, as fast as possible
cld ; Kernal is not designed to operate in decimal mode
+ lda #$00
+ sta NMINV+1 ; soft-disable custom NMI interrupt handler
+
; Do not reset the stack (see, ldx #$FF, txs) - we need to know where to return
jsr m65_reset_part ; init MEGA65 specific hardware, shutdown VIC-IV, clear native mode mark
@@ -20,9 +21,7 @@ m65_hypervisor_reset:
stx VIC_SCROLX
jsr IOINIT_skip_DOS ; better not to initialize DOS under hypervisor, risk of incompatibility
- jsr JRAMTAS
- jsr JRESTOR
- jsr JCINT
+ jsr m65_reset_common ; RAMTAS, RESTOR, CINT
; Restore hypervisor memory mapping and quit
@@ -42,3 +41,9 @@ m65_hypervisor_reset:
cli
rts
+
+m65_reset_common:
+
+ jsr JRAMTAS
+ jsr JRESTOR
+ jmp JCINT
diff --git a/src/kernal/board_m65/mega65_iec_slow_fast.s b/src/kernal/board_m65/mega65_iec_slow_fast.s
new file mode 100644
index 00000000..310df6e3
--- /dev/null
+++ b/src/kernal/board_m65/mega65_iec_slow_fast.s
@@ -0,0 +1,45 @@
+;; #LAYOUT# M65 KERNAL_0 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;
+; Checks if system is in MEGA65 native mode; if so, switches CPU speed to fast/slow - for IEC routines;
+; Alters only status bits, all remaining registers preserved
+;
+
+!ifdef CONFIG_IEC {
+
+
+m65_iec_slow:
+
+ jsr M65_MODEGET
+ bcs m65_iec_fast_slow_done
+
+ ; Switch CPU speed
+
+ pha
+ lda VIC_CTRLB
+ and #%10111111
+ bra m65_iec_fast_slow_common
+
+m65_iec_fast:
+
+ jsr M65_MODEGET
+ bcs m65_iec_fast_slow_done
+
+ pha
+ lda VIC_CTRLB
+ ora #%01000000
+
+ ; FALLTROUGH
+
+m65_iec_fast_slow_common:
+
+ sta VIC_CTRLB
+ pla
+
+ ; FALLTROUGH
+
+m65_iec_fast_slow_done:
+
+ rts
+}
diff --git a/src/kernal/board_m65/mega65_imports.s b/src/kernal/board_m65/mega65_imports.s
index 5c093e5c..60a496f9 100644
--- a/src/kernal/board_m65/mega65_imports.s
+++ b/src/kernal/board_m65/mega65_imports.s
@@ -9,8 +9,6 @@
;; #ALIAS# CHROUT = KERNAL_0.proxy_K1_CHROUT
;; #ALIAS# STOP = KERNAL_0.STOP
-;; #ALIAS# M65_SLOW = KERNAL_0.M65_SLOW
-;; #ALIAS# M65_FAST = KERNAL_0.M65_FAST
;; #ALIAS# M65_MODEGET = KERNAL_0.M65_MODEGET
;; #ALIAS# M65_SETWIN_XY = KERNAL_0.M65_SETWIN_XY
;; #ALIAS# M65_SETWIN_WH = KERNAL_0.M65_SETWIN_WH
@@ -72,7 +70,7 @@
;; #ALIAS# print_return = KERNAL_0.proxy_K1_print_return
;; #ALIAS# __MSG_KERNAL_PRESS_PLAY = KERNAL_0.__MSG_KERNAL_PRESS_PLAY
-;; #ALIAS# __MSG_KERNAL_OK_SEARCHING = KERNAL_0.__MSG_KERNAL_OK_SEARCHING
+;; #ALIAS# __MSG_KERNAL_OK_SEARCH = KERNAL_0.__MSG_KERNAL_OK_SEARCH
;; #ALIAS# __MSG_KERNAL_FOUND = KERNAL_0.__MSG_KERNAL_FOUND
;; #ALIAS# tape_normal_byte_store = KERNAL_0.tape_normal_byte_store
diff --git a/src/kernal/board_m65/mega65_tape_fast_cpu.s b/src/kernal/board_m65/mega65_tape_fast_cpu.s
new file mode 100644
index 00000000..0be56175
--- /dev/null
+++ b/src/kernal/board_m65/mega65_tape_fast_cpu.s
@@ -0,0 +1,31 @@
+;; #LAYOUT# M65 KERNAL_1 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;
+; Tape helper routine
+;
+; - unlocks VIC-IV
+; - switches CPU to fast processing mode and disables badlines
+; - stores previous VIC_CTRLB in NXTBIN
+;
+
+!ifdef HAS_TAPE {
+
+
+tape_fast_cpu:
+
+ jsr M65_MODEGET
+ bcc @1
+
+ jsr viciv_unhide
+@1:
+ lda VIC_CTRLB
+ ora #%01000000
+ sta VIC_CTRLB
+ sta NXTBIT
+
+ lda #$00
+ sta MISC_EMU
+
+ rts
+}
diff --git a/src/kernal/board_m65/mega65_viciv_init.s b/src/kernal/board_m65/mega65_viciv_init.s
index 91c2131c..e73f635a 100644
--- a/src/kernal/board_m65/mega65_viciv_init.s
+++ b/src/kernal/board_m65/mega65_viciv_init.s
@@ -17,10 +17,10 @@ viciv_init:
lda #$00
sta MISC_EMU
- ; Set misc VIC-IV flags
+ ; Set VIC-IV CTRL registers
- lda #%01000000 ; enable C65 character set
- sta VIC_CTRLA
+ lda #%01000000 ; enable C65 character set
+ jsr mega65_viciv_setctrl_AC ; also initialize remaining CTRLA / CTRLC bits; CTRLB will be set by screen editor
; Disable hot registers
diff --git a/src/kernal/board_m65/mega65_viciv_setctrl_AC.s b/src/kernal/board_m65/mega65_viciv_setctrl_AC.s
new file mode 100644
index 00000000..c49f31de
--- /dev/null
+++ b/src/kernal/board_m65/mega65_viciv_setctrl_AC.s
@@ -0,0 +1,18 @@
+;; #LAYOUT# M65 KERNAL_0 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;
+; Helper routine for setting VIC-IV control registers A and C
+;
+
+
+mega65_viciv_setctrl_AC:
+
+ sta VIC_CTRLA
+
+ lda VIC_CTRLC
+ and #%01101000
+ ora #%01000000 ; make C65/C128 fast modes switch to max MEGA65 CPU speed
+ sta VIC_CTRLC
+
+ rts
diff --git a/src/kernal/board_m65/mega65_viciv_shutdown.s b/src/kernal/board_m65/mega65_viciv_shutdown.s
index e53b6f0e..38cc0067 100644
--- a/src/kernal/board_m65/mega65_viciv_shutdown.s
+++ b/src/kernal/board_m65/mega65_viciv_shutdown.s
@@ -20,8 +20,8 @@ viciv_shutdown:
; Set misc VIC-IV flags
lda #%00000000
- sta VIC_CTRLA ; enable C64 character set
- sta VIC_CTRLB ; disable extended resolution and attributes
+ sta VIC_CTRLB ; disable extended resolution and attributes, disable 3.5 MHz mode
+ jsr mega65_viciv_setctrl_AC ; enable C64 character set, initialize remaining CTRLA / CTRLC bits
; Reenable hot registers
diff --git a/src/kernal/board_u64/ultimate64_slow_fast.s b/src/kernal/board_u64/ultimate64_slow_fast.s
new file mode 100644
index 00000000..5162e0e9
--- /dev/null
+++ b/src/kernal/board_u64/ultimate64_slow_fast.s
@@ -0,0 +1,22 @@
+;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# * KERNAL_0 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+
+!ifdef CONFIG_MB_U64 {
+
+U64_SLOW:
+
+ lda #$00 ; for U64_TURBOCTL - badlines, 1MHz
+
+ +skip_2_bytes_trash_nvz
+
+ ; FALLTROUGH
+
+U64_FAST: ; clears zero flag - important for tape code
+
+ lda #$0F ; for U64_TURBOCTL - badlines, 48MHz
+ sta U64_TURBOCTL
+
+ rts
+}
diff --git a/src/kernal/errors.s b/src/kernal/errors.s
index 5c021764..917317d7 100644
--- a/src/kernal/errors.s
+++ b/src/kernal/errors.s
@@ -90,5 +90,9 @@ kernalerror_TOP_MEM_RS232:
lda #K_ERR_TOP_MEM_RS232
+!ifdef CONFIG_MB_M65 {
+ ; If in native mode, switch back to fast mode
+ jsr m65_iec_fast
+}
sec
rts
diff --git a/src/kernal/extapi_m65/mega65__jumptable.s b/src/kernal/extapi_m65/mega65__jumptable.s
index c20b1b4f..301226a2 100644
--- a/src/kernal/extapi_m65/mega65__jumptable.s
+++ b/src/kernal/extapi_m65/mega65__jumptable.s
@@ -14,12 +14,6 @@ M65_JMODEGET:
M65_JISMODESET:
jsr M65_MODESET
-M65_JSLOW:
- jsr M65_SLOW
-
-M65_JFAST:
- jsr M65_FAST
-
M65_JSELDEV:
jsr SELDEV
diff --git a/src/kernal/extapi_m65/mega65_modeset.s b/src/kernal/extapi_m65/mega65_modeset.s
index 153a58a8..4dec329c 100644
--- a/src/kernal/extapi_m65/mega65_modeset.s
+++ b/src/kernal/extapi_m65/mega65_modeset.s
@@ -25,13 +25,15 @@ m65_mode64:
jsr viciv_shutdown
jsr vicii_init
- ; Reenable interrupts
+ ; Switch CPU speed to normal
+
+ lda #$40
+ sta CPU_D6510
+
+ ; Reenable interrupts and quit
cli
-
- ; Switch CPU speed back to slow and quit
-
- jmp M65_SLOW
+ rts
m65_mode65:
@@ -40,9 +42,10 @@ m65_mode65:
sei
- ; Switch CPU speed to fast
+ ; Switch CPU speed to normal; VIC-IV register will be used to set the maximum one
- jsr M65_FAST
+ lda #$40
+ sta CPU_D6510
; Set the magic string to mark native mode
diff --git a/src/kernal/extapi_m65/mega65_slow_fast.s b/src/kernal/extapi_m65/mega65_slow_fast.s
deleted file mode 100644
index 8e91796c..00000000
--- a/src/kernal/extapi_m65/mega65_slow_fast.s
+++ /dev/null
@@ -1,16 +0,0 @@
-;; #LAYOUT# M65 KERNAL_0 #TAKE
-;; #LAYOUT# * * #IGNORE
-
-
-M65_SLOW: ; set CPU speed to 1 MHz
-
- lda #$40
- +skip_2_bytes_trash_nvz
-
- ; FALLTROUGH
-
-M65_FAST: ; set CPU speed to 40 MHz
-
- lda #$41
- sta CPU_D6510
- rts
diff --git a/src/kernal/iec/iec_return.s b/src/kernal/iec/iec_return.s
index 4bf64b30..bf9972f7 100644
--- a/src/kernal/iec/iec_return.s
+++ b/src/kernal/iec/iec_return.s
@@ -20,9 +20,16 @@ iec_return_success:
; BSOUR is certainly not valid anymore
lda #$00
sta C3PO
+
; Restore registers
+ply_trash_a
+plx_trash_a
+
+!ifdef CONFIG_MB_M65 {
+ ; If in native mode, switch back to fast mode
+ jsr m65_iec_fast
+}
+
; Report success
clc
rts
@@ -31,12 +38,15 @@ iec_return_DEVICE_NOT_FOUND:
; Set IEC line to normal idle state
jsr iec_set_idle
+
; BSOUR is certainly not valid anymore
lda #$00
sta C3PO
+
; Restore registers
+ply_trash_a
+plx_trash_a
+
; Report error
jmp kernalerror_DEVICE_NOT_FOUND
}
diff --git a/src/kernal/iec/iec_rx_byte.s b/src/kernal/iec/iec_rx_byte.s
index 32d1deea..fc565c85 100644
--- a/src/kernal/iec/iec_rx_byte.s
+++ b/src/kernal/iec/iec_rx_byte.s
@@ -16,6 +16,11 @@
iec_rx_dispatch:
+!ifdef CONFIG_MB_M65 {
+ ; If in native mode, switch to 1 MHz
+ jsr m65_iec_slow
+}
+
lda IECPROTO
cmp #IEC_JIFFY
+beq jiffydos_rx_byte
@@ -27,6 +32,11 @@ iec_rx_dispatch:
iec_rx_byte:
+!ifdef CONFIG_MB_M65 { !ifndef CONFIG_IEC_JIFFYDOS {
+ ; If in native mode, switch to 1 MHz
+ jsr m65_iec_slow
+} }
+
; Store .X and .Y on the stack - preserve them
+phx_trash_a
+phy_trash_a
@@ -60,7 +70,7 @@ iec_rx_byte:
; For DolphinDOS just fetch the byte from parallel port
lda CIA2_PRB
pha
- jmp iec_rx_acknowledge
+ +bra iec_rx_acknowledge
iec_rx_no_dolphindos:
@@ -124,7 +134,7 @@ iec_rx_clk_wait2:
jsr kernalstatus_EOI
pla
- jmp iec_rx_end
+ +bra iec_rx_end
@2:
; More bits?
dex
@@ -150,6 +160,11 @@ iec_rx_acknowledge:
iec_rx_end:
+!ifdef CONFIG_MB_M65 {
+ ; If in native mode, switch back to fast mode
+ jsr m65_iec_fast
+}
+
+ply_trash_a
+plx_trash_a
lda TBTCNT
diff --git a/src/kernal/iec/iec_tx_byte.s b/src/kernal/iec/iec_tx_byte.s
index 785859b7..586bda40 100644
--- a/src/kernal/iec/iec_tx_byte.s
+++ b/src/kernal/iec/iec_tx_byte.s
@@ -18,6 +18,12 @@
iec_tx_dispatch:
php ; preserve C flag for EOI indication
+
+!ifdef CONFIG_MB_M65 {
+ ; If in native mode, switch to 1 MHz
+ jsr m65_iec_slow
+}
+
lda IECPROTO
cmp #IEC_JIFFY
bne @1
@@ -34,6 +40,11 @@ iec_tx_dispatch:
iec_tx_byte:
+!ifdef CONFIG_MB_M65 { !ifndef CONFIG_IEC_JIFFYDOS {
+ ; If in native mode, switch to 1 MHz
+ jsr m65_iec_slow
+} }
+
; Store .X and .Y on the stack - preserve them
+phx_trash_a
+phy_trash_a
@@ -84,7 +95,7 @@ iec_tx_common:
jsr iec_pull_clk_release_data_oneshot
; Finish the flow
- jmp iec_tx_common_finalize
+ +bra iec_tx_common_finalize
iec_tx_no_dolphindos:
@@ -122,7 +133,7 @@ iec_tx_common_sendbit:
; Bit is 0
jsr iec_release_clk_pull_data
- jmp iec_tx_common_bit_is_sent
+ +bra iec_tx_common_bit_is_sent
@4:
; Bit is 1
jsr iec_release_clk_data
diff --git a/src/kernal/iec_fast/dolphindos_load.s b/src/kernal/iec_fast/dolphindos_load.s
index 4b3487fa..7a8edd07 100644
--- a/src/kernal/iec_fast/dolphindos_load.s
+++ b/src/kernal/iec_fast/dolphindos_load.s
@@ -27,6 +27,11 @@ dolphindos_load:
ora #BIT_CIA2_PRA_DAT_OUT
sta TBTCNT ; pull DATA
}
+
+!ifdef CONFIG_MB_M65 {
+ ; If in native mode, switch to 1 MHz
+ jsr m65_iec_slow
+}
; FALLTROUGH
dolphindos_load_loop:
@@ -80,7 +85,7 @@ dolphindos_load_loop:
sta IECPROTO
; End of load loop
- jmp load_iec_loop_end
+ +bra load_iec_loop_end
dolphindos_load_no_eoi:
@@ -103,12 +108,16 @@ dolphindos_load_no_eoi:
iny
bne dolphindos_load_loop
inc EAL+1
- jmp dolphindos_load_loop
+ +bra dolphindos_load_loop
!ifndef CONFIG_IEC_DOLPHINDOS_FAST {
dolphindos_load_end:
+!ifdef CONFIG_MB_M65 {
+ ; If in native mode, switch back to fast mode
+ jsr m65_iec_fast
+}
; Update EAL
clc
jsr iec_update_EAL_by_Y
diff --git a/src/kernal/iec_fast/jiffydos_load.s b/src/kernal/iec_fast/jiffydos_load.s
index 5d05b8cd..12c59179 100644
--- a/src/kernal/iec_fast/jiffydos_load.s
+++ b/src/kernal/iec_fast/jiffydos_load.s
@@ -19,6 +19,132 @@
jiffydos_load:
+
+!ifdef CONFIG_IEC_JD_TEST {
+
+ ; XXX test implementation, not ready yet
+
+ ; Switch to optimized LOAD protocol
+ jsr UNTLK
+ lda FA
+ jsr TALK
+ bcs jiffydos_load_error
+
+ lda #$01
+ sta CIA2_DDRB ; XXX for test only
+
+ lda #$61
+ jsr TKSA
+
+ lda #$02
+ sta CIA2_DDRB ; XXX for test only
+
+ ; XXX flow below most likely takes too much time...
+
+ ; Timing is critical, do not allow interrupts
+ sei
+
+!ifdef CONFIG_IEC_JIFFYDOS_BLANK {
+
+!ifdef CONFIG_MB_U64 {
+
+ ; XXX implement for non-blank mode, use jiffydos_prepare_no_preserve_bits
+
+ ; Check if turbo register is available
+ lda U64_TURBOCTL
+ cmp #$FF
+ beq @1
+
+ ; Store turbo register content, disable badlines
+ sta TBTCNT
+ lda #$80
+ sta U64_TURBOCTL
+ bne @2
+
+ ; Normal flow - no turbo register
+}
+
+@1:
+ ; Preserve register with screen status (blank/visible)
+ lda VIC_SCROLY
+ sta TBTCNT
+
+ ; Blank screen to make sure no sprite/badline will interrupt
+ jsr screen_off
+@2:
+ ; Preserve 3 lowest bits of CIA2_PRA
+ jsr jiffydos_preserve_bits
+
+} else {
+
+@1:
+ ; Store previous sprite status in temporary variable
+ jsr jiffydos_prepare
+ sta TBTCNT
+@2:
+
+}
+ ; A trick to shorten EAL update time
+ ldy #$FF
+
+!ifdef CONFIG_MB_M65 {
+ ; If in native mode, switch to 1 MHz
+ jsr m65_iec_fast
+}
+ ; FALLTROUGH
+
+jiffydos_load_loop_esc:
+
+ ; We are now in 'escape mode' - release DATA, wait till receiver releases CLK
+ jsr iec_release_clk_data
+ jsr iec_wait_for_clk_release
+
+ ; Check DATA line
+ bmi jiffydos_load_check_status
+
+ +panic $01
+
+ ; XXX finish the implementation
+
+
+
+
+jiffydos_load_check_status:
+
+ ; Check if a device pulls CLK within the next 1100us (at least 1125 cycles, to be sure for NTSC)
+ ldx #$67 ; 2 cycles
+
+ ; FALLTROUGH
+
+jiffydos_load_check_loop:
+
+ lda CIA2_PRA ; 4 cycles
+ bvc jiffydos_load_end ; 2 cycles if not taken
+ dex ; 2 cycles
+ bne jiffydos_load_check_loop ; 3 cycles if taken
+
+ ; FALLTROUGH
+
+jiffydos_load_error:
+
+ lda #$F3
+ sta CIA2_DDRB ; XXX for test only
+
+ +panic $03
+
+ ; XXX finish the implementation
+
+
+jiffydos_load_end:
+
+ +panic $FF
+
+ ; XXX finish the implementation
+
+
+
+} else {
+
; XXX implement JiffyDOS optimized LOAD protocol, this one is ineffective
@@ -27,29 +153,51 @@ jiffydos_load:
!ifdef CONFIG_IEC_JIFFYDOS_BLANK {
+!ifdef CONFIG_MB_U64 {
+
+ ; XXX implement for non-blank mode, use jiffydos_prepare_no_preserve_bits
+
+ ; Check if turbo register is available
+ lda U64_TURBOCTL
+ cmp #$FF
+ beq @1
+
+ ; Store turbo register content, disable badlines
+ sta TBTCNT
+ lda #$80
+ sta U64_TURBOCTL
+ bne @2
+
+ ; Normal flow - no turbo register
+}
+
+@1:
; Preserve register with screen status (blank/visible)
lda VIC_SCROLY
sta TBTCNT
; Blank screen to make sure no sprite/badline will interrupt
jsr screen_off
-
- ; Preserve 3 lowest bits of CIA2_PRA XXX deduplicate this
-
- lda CIA2_PRA
- and #%00000111
- sta C3PO
+@2:
+ ; Preserve 3 lowest bits of CIA2_PRA
+ jsr jiffydos_preserve_bits
} else {
+@1:
; Store previous sprite status in temporary variable
jsr jiffydos_prepare
sta TBTCNT
-}
+@2:
+}
; A trick to shorten EAL update time
ldy #$FF
+!ifdef CONFIG_MB_M65 {
+ ; If in native mode, switch to 1 MHz
+ jsr m65_iec_slow
+}
; FALLTROUGH
jiffydos_load_loop:
@@ -127,10 +275,14 @@ jiffydos_load_loop:
cpy #$FF
bne jiffydos_load_loop
inc EAL+1
- jmp jiffydos_load_loop
+ +bra jiffydos_load_loop
jiffydos_load_end:
+!ifdef CONFIG_MB_M65 {
+ ; If in native mode, switch back to fast mode
+ jsr m65_iec_fast
+}
; Save last byte
tax
@@ -148,15 +300,34 @@ jiffydos_load_end:
!ifdef CONFIG_IEC_JIFFYDOS_BLANK {
+!ifdef CONFIG_MB_U64 {
+
+ ; Check if turbo register is available
+ lda U64_TURBOCTL
+ cmp #$FF
+ beq @3
+
+ ; Restore turbo register content
+ lda TBTCNT
+ sta U64_TURBOCTL
+ jmp @4
+
+ ; Normal flow - no turbo register
+}
+
+@3:
; Restore screen state
lda TBTCNT
sta VIC_SCROLY
+@4:
} else {
+@3:
; Re-enable sprites
lda TBTCNT
sta VIC_SPENA
+@4:
}
; Store last byte as unoptimized LOAD routine would
@@ -170,3 +341,5 @@ jiffydos_load_end:
} } ; CONFIG_IEC_JIFFYDOS and not CONFIG_MEMORY_MODEL_60K
+
+}
\ No newline at end of file
diff --git a/src/kernal/iec_fast/jiffydos_prepare.s b/src/kernal/iec_fast/jiffydos_prepare.s
index 244fb5f0..cf939906 100644
--- a/src/kernal/iec_fast/jiffydos_prepare.s
+++ b/src/kernal/iec_fast/jiffydos_prepare.s
@@ -12,12 +12,11 @@
jiffydos_prepare:
- ; We need to preserve 3 lowest bits of CIA2_PRA, they contain important
- ; data - fortunately, the bits are never changed by external devices
- ; Use C3PO for this, as afterwards we have to set there 0 nevertheless
- lda CIA2_PRA
- and #%00000111
- sta C3PO
+ jsr jiffydos_preserve_bits
+
+ ; FALLTROUGH
+
+jiffydos_prepare_no_preserve_bits:
; Hide sprites; JiffyDOS timing regime is very strict, before transmitting
; anything we need to make sure nothing will steal the cycles
diff --git a/src/kernal/iec_fast/jiffydos_preserve_bits.s b/src/kernal/iec_fast/jiffydos_preserve_bits.s
new file mode 100644
index 00000000..8a18019d
--- /dev/null
+++ b/src/kernal/iec_fast/jiffydos_preserve_bits.s
@@ -0,0 +1,23 @@
+;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# * KERNAL_0 #TAKE
+;; #LAYOUT# * * #IGNORE
+
+;
+; JiffyDOS transfer preparation routine
+;
+
+
+!ifdef CONFIG_IEC_JIFFYDOS {
+
+
+jiffydos_preserve_bits:
+
+ ; We need to preserve 3 lowest bits of CIA2_PRA, they contain important
+ ; data - fortunately, the bits are never changed by external devices
+ ; Use C3PO for this, as afterwards we have to set there 0 nevertheless
+ lda CIA2_PRA
+ and #%00000111
+ sta C3PO
+
+ rts
+}
diff --git a/src/kernal/init/e5a0.vicii_init.s b/src/kernal/init/e5a0.vicii_init.s
index 1657e714..20f4f732 100644
--- a/src/kernal/init/e5a0.vicii_init.s
+++ b/src/kernal/init/e5a0.vicii_init.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_0 #TAKE
;; #LAYOUT# M65 KERNAL_0 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE-FLOAT
;; #LAYOUT# X16 * #IGNORE
@@ -31,17 +32,6 @@ vicii_init:
dex
bpl @1
-!ifndef CONFIG_MB_M65 { !ifndef CONFIG_MB_U64 {
-
- ; Disable C128 extra keys - just to be sure they will not interfere with anything
-
- stx VIC_XSCAN
-
- ; Disable the C128 2MHz mode, it prevents VIC-II display from working correctly
-
- stx VIC_CLKRATE
-} }
-
; Set up default IO values
; - [CM64] page 129 - VIC_SCROLY
; - [CM64] pages 140-144 - VIC_SCROLX
diff --git a/src/kernal/init/fce2.hw_entry_reset.s b/src/kernal/init/fce2.hw_entry_reset.s
index 41c21683..3f4ac748 100644
--- a/src/kernal/init/fce2.hw_entry_reset.s
+++ b/src/kernal/init/fce2.hw_entry_reset.s
@@ -16,6 +16,9 @@ hw_entry_reset:
cld ; required for all CPUs - due to possibility of manual call
+ lda #$00
+ sta NMINV+1 ; soft-disable custom NMI interrupt handler
+
!ifdef HAS_OPCODES_65CE02 {
see ; disable extended stack
@@ -29,6 +32,12 @@ hw_entry_reset:
jsr m65_reset_part
}
+!ifdef CONFIG_MB_U64 {
+
+ jsr U64_SLOW
+ sta SCPU_SPEED_NORMAL
+}
+
!ifdef CONFIG_PLATFORM_COMMODORE_64 {
; The following routine is based on reading the public KERNAL jumptable routine
@@ -36,12 +45,14 @@ hw_entry_reset:
; Also, https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image was used
; as it shows example startup sequence, to be followe by cartridge creators
+!ifndef ROM_LAYOUT_CRT {
+
; C64 PRG p269
jsr cartridge_check
bne @1
jmp (ICART_COLD_START)
@1:
-
+}
; Disable the screen (and set 40 columns) to prevent visual glitches later
ldx #$28
stx VIC_SCROLX
@@ -49,6 +60,15 @@ hw_entry_reset:
; Initialising IO is obviously required. Also indicated by c64 prg p269.
jsr JIOINIT
+!ifdef CONFIG_MB_M65 {
+
+ jsr m65_reset_common ; RAMTAS, RESTOR, CINT
+
+ clc
+ jsr M65_MODESET ; on MEGA65 go to native mode by default
+
+} else {
+
; Setting up the screen and testing ram is obviously required
; also affirmed by p269 of c64 prg
jsr JRAMTAS ; called RANTAM on Codebase64 wiki
@@ -59,12 +79,14 @@ hw_entry_reset:
; "Compute's Mapping the 64" p236
jsr JCINT
-
-!ifdef CONFIG_MB_M65 {
-
- clc
- jsr M65_MODESET ; on MEGA65 go to native mode by default
}
+
+!ifdef ROM_LAYOUT_CRT {
+
+ ; Init external ROM
+ jsr crt_init
+}
+
; What do we do when finished? A C64 jumps into the BASIC ROM
cli ; allow interrupts to happen
diff --git a/src/kernal/init/fd50.ramtas.s b/src/kernal/init/fd50.ramtas.s
index d68d3f16..6d28c48f 100644
--- a/src/kernal/init/fd50.ramtas.s
+++ b/src/kernal/init/fd50.ramtas.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_0 #TAKE
;; #LAYOUT# M65 KERNAL_0 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE-FLOAT
;; #LAYOUT# X16 KERNAL_0 #TAKE
@@ -64,6 +65,17 @@ RAMTAS:
ldx #>$0800
stx MEMSTR+1
+
+!ifdef ROM_LAYOUT_CRT {
+
+ ; Set RAM size in MEMSIZEK - skip memory test
+
+ ldy #$A0
+ sty MEMSIZK+1
+ rts
+
+} else {
+
; Work out RAM size and put in MEMSIZK
; Try to modify $8000, if it fails then RAM ends at $7FFF, else $9FFF
@@ -100,6 +112,7 @@ ramtas_32k:
ldy #$80
bne ramtas_xxk ; branch always
+}
} else ifdef CONFIG_PLATFORM_COMMANDER_X16 {
diff --git a/src/kernal/init/fda3.ioinit.s b/src/kernal/init/fda3.ioinit.s
index e2243c7f..6d03d4d3 100644
--- a/src/kernal/init/fda3.ioinit.s
+++ b/src/kernal/init/fda3.ioinit.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_0 #TAKE
;; #LAYOUT# M65 KERNAL_0 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE-FLOAT
;; #LAYOUT# X16 * #IGNORE
@@ -62,7 +63,7 @@ IOINIT_skip_DOS:
stx CIA1_PRA ; $DC00
;
- ; Now silence the SID chip(s), depending on the configuration - we want them silent ASAP
+ ; Silence the SID chip(s), depending on the configuration - we want them silent ASAP
;
lda #$00
@@ -135,6 +136,18 @@ IOINIT_skip_DOS:
stx CIA1_DDRB ; $DC03
stx CIA2_DDRB ; $DD03 ; XXX this port is used for RS-232, value here is most likely wrong!
+!ifdef HAS_128_POSSIBILITY {
+
+ ; Disable C128 extra keys - just to be sure they will not interfere with anything
+
+ stx VIC_XSCAN ; store $FF
+
+ ; Disable the C128 2MHz mode, it prevents VIC-II display from working correctly
+
+ inx
+ stx VIC_CLKRATE ; store $00
+}
+
!ifdef CONFIG_KEYBOARD_C65_OR_CAPS_LOCK {
lda #$02
diff --git a/src/kernal/interrupts/hw_entry_nmi.s b/src/kernal/interrupts/hw_entry_nmi.s
index 006eb69d..6c541344 100644
--- a/src/kernal/interrupts/hw_entry_nmi.s
+++ b/src/kernal/interrupts/hw_entry_nmi.s
@@ -15,16 +15,12 @@ hw_entry_nmi:
; Call interrupt routine (only if initialised)
pha
-!ifndef CONFIG_MB_M65 { ; XXX temporarily disabled for MEGA65, seems to cause crash during startup - to be investigated
-
lda NMINV+1 ; consider zeropage NMI address as uninitialized vector
beq @1 ; this allows safer interrupt vector modifications
pla
jmp (NMINV)
@1:
-}
-
; Vector not initialized - call default interrupt routine
pla
jmp default_nmi_handler
diff --git a/src/kernal/screen/screen_off.s b/src/kernal/screen/screen_off.s
index 7e285bbd..664bdb6f 100644
--- a/src/kernal/screen/screen_off.s
+++ b/src/kernal/screen/screen_off.s
@@ -8,8 +8,8 @@
;
!set NEEDED = 0
-!ifdef HAS_TAPE { !set NEEDED = 1 }
-!ifdef CONFIG_IEC_JIFFYDOS { !ifndef CONFIG_MEMORY_MODEL_60K { !set NEEDED = 1 } }
+!ifdef HAS_TAPE { !ifndef CONFIG_MB_M65 { !set NEEDED = 1 } }
+!ifdef CONFIG_IEC_JIFFYDOS_BLANK { !set NEEDED = 1 }
!if NEEDED {
diff --git a/src/kernal/screen/screen_on.s b/src/kernal/screen/screen_on.s
index d05c5aba..f3409e5a 100644
--- a/src/kernal/screen/screen_on.s
+++ b/src/kernal/screen/screen_on.s
@@ -8,8 +8,8 @@
;
!set NEEDED = 0
-!ifdef HAS_TAPE { !set NEEDED = 1 }
-!ifdef CONFIG_IEC_JIFFYDOS { !ifndef CONFIG_MEMORY_MODEL_60K { !set NEEDED = 1 } }
+!ifdef HAS_TAPE { !ifndef CONFIG_MB_M65 { !set NEEDED = 1 } }
+!ifdef CONFIG_IEC_JIFFYDOS_BLANK { !set NEEDED = 1 }
!if NEEDED {
diff --git a/src/kernal/screen_m65/mega65_screen_tables_misc.s b/src/kernal/screen_m65/mega65_screen_tables_misc.s
index f0f6b684..8ec028f6 100644
--- a/src/kernal/screen_m65/mega65_screen_tables_misc.s
+++ b/src/kernal/screen_m65/mega65_screen_tables_misc.s
@@ -4,9 +4,9 @@
m65_scrtab_vic_ctrlb: ; parameters for VIC control register B
- !byte %00100000 ; 40x25 + extended attributes
- !byte %10100000 ; 80x25 + extended attributes
- !byte %10101000 ; 80x50 + extended attributes
+ !byte %01100000 ; 40x25 + extended attributes + VFAST
+ !byte %11100000 ; 80x25 + extended attributes + VFAST
+ !byte %11101000 ; 80x50 + extended attributes + VFAST
m65_scrtab_colviewmax_lo: ; maximum allowed color viewport start - low byte
diff --git a/src/kernal/tape/load_tape_normal.s b/src/kernal/tape/load_tape_normal.s
index f4478c30..d8beed39 100644
--- a/src/kernal/tape/load_tape_normal.s
+++ b/src/kernal/tape/load_tape_normal.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/load_tape_turbo.s b/src/kernal/tape/load_tape_turbo.s
index c4f08877..f4d205cd 100644
--- a/src/kernal/tape/load_tape_turbo.s
+++ b/src/kernal/tape/load_tape_turbo.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_common.s b/src/kernal/tape/tape_common.s
index 761927e0..45b4a12a 100644
--- a/src/kernal/tape/tape_common.s
+++ b/src/kernal/tape/tape_common.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -113,13 +114,10 @@ tape_prepare_reading:
} ; CONFIG_TAPE_HEAD_ALIGN
-!ifdef CONFIG_MB_M65 {
-
; Display confirmation
- ldx #__MSG_KERNAL_OK_SEARCHING
+ ldx #__MSG_KERNAL_OK_SEARCH
jsr print_kernal_message
-}
; Prepare for reading
diff --git a/src/kernal/tape/tape_common_autodetect.s b/src/kernal/tape/tape_common_autodetect.s
index 0a592b5e..4f963dbe 100644
--- a/src/kernal/tape/tape_common_autodetect.s
+++ b/src/kernal/tape/tape_common_autodetect.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_common_clean_sid.s b/src/kernal/tape/tape_common_clean_sid.s
index 0c44d2bd..dc5cccbd 100644
--- a/src/kernal/tape/tape_common_clean_sid.s
+++ b/src/kernal/tape/tape_common_clean_sid.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_common_ditch_verify.s b/src/kernal/tape/tape_common_ditch_verify.s
index 65514982..7db80ef6 100644
--- a/src/kernal/tape/tape_common_ditch_verify.s
+++ b/src/kernal/tape/tape_common_ditch_verify.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_common_get_pulse.s b/src/kernal/tape/tape_common_get_pulse.s
index 00591f0e..ad99950b 100644
--- a/src/kernal/tape/tape_common_get_pulse.s
+++ b/src/kernal/tape/tape_common_get_pulse.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_common_motor.s b/src/kernal/tape/tape_common_motor.s
index dc6c9171..b4b9d72a 100644
--- a/src/kernal/tape/tape_common_motor.s
+++ b/src/kernal/tape/tape_common_motor.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_0 #TAKE
;; #LAYOUT# * KERNAL_0 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_common_prepare_cia.s b/src/kernal/tape/tape_common_prepare_cia.s
index d6977c05..e07b5976 100644
--- a/src/kernal/tape/tape_common_prepare_cia.s
+++ b/src/kernal/tape/tape_common_prepare_cia.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_common_screen.s b/src/kernal/tape/tape_common_screen.s
index a1636149..51e251cd 100644
--- a/src/kernal/tape/tape_common_screen.s
+++ b/src/kernal/tape/tape_common_screen.s
@@ -1,9 +1,10 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
;
-; Handle screen (visible/blanked) + tape deck motor (on/off),
+; Handle screen (visible/blanked; on some hardware disable badlines instead) + tape deck motor (on/off),
; store/restore screen color
;
@@ -19,15 +20,32 @@ tape_screen_on_motor_off:
lda COLSTORE
sta VIC_EXTCOL
-!ifndef CONFIG_MB_M65 {
+!ifdef CONFIG_MB_M65 {
+ jsr M65_MODEGET
+ bcc @1
+
+ ; For compatibility mode, restore normal speed settings and hide VIC-IV
+
+ lda #$03
+ sta MISC_EMU
+
+ lda NXTBIT
+ sta VIC_CTRLB
+
+ sta VIC_KEY
+@1:
+ rts
+
+} else ifdef CONFIG_MB_U64 {
+
+ lda NXTBIT
+ sta U64_TURBOCTL ; restore turbo control settings
jmp screen_on
} else {
- jsr M65_MODEGET
- +bcs screen_on ; MEGA65 native mode does not have badlines, no need to enable/disable screen
- rts
+ jmp screen_on
}
@@ -44,18 +62,31 @@ tape_screen_off_motor_on:
lda VIC_EXTCOL
sta COLSTORE
-!ifndef CONFIG_MB_M65 {
+!ifdef CONFIG_MB_M65 {
+ ; On MEGA65 we need to switch banks everytim we retrieve byte to be stored in memory,
+ ; additionally we perform advanced tape speed autocallibration - this is all too expensive
+ ; to be handled by 1 MHz CPU - so in case of compatibility mode, switch CPU to fast speed
+ ; (and disable badlines, so we will not have to blank the screen)
+
+ jsr tape_fast_cpu
+
+} else ifdef CONFIG_MB_U64 {
+
+ lda U64_TURBOCTL
+ sta NXTBIT
+ cmp #$FF
+ beq @2 ; branch if no turbo control available
+
+ jsr U64_FAST ; max speed, no badlines
+ bne @3 ; branch always
+@2:
jsr screen_off
+@3:
} else {
- jsr M65_MODEGET
- ; XXX optimize this
- bcs @1 ; MEGA65 native mode does not have badlines, no need to enable/disable screen
jsr screen_off
-@1:
-
}
jmp tape_motor_on
diff --git a/src/kernal/tape/tape_head_align.s b/src/kernal/tape/tape_head_align.s
index 12ce37ab..2c3144e9 100644
--- a/src/kernal/tape/tape_head_align.s
+++ b/src/kernal/tape/tape_head_align.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -44,6 +45,17 @@ tape_head_align:
jsr nmi_lock
+ ; Switch CPU to fast mode
+
+!ifdef CONFIG_MB_M65 {
+ jsr tape_fast_cpu
+}
+
+!ifdef CONFIG_MB_U64 {
+ jsr U64_FAST
+ sta SCPU_SPEED_TURBO
+}
+
; Prepare CIA timers
ldx #$02 ; set timer A to 3 ticks
diff --git a/src/kernal/tape/tape_head_align_gen_code.s b/src/kernal/tape/tape_head_align_gen_code.s
index 30e4834a..66c13c5c 100644
--- a/src/kernal/tape/tape_head_align_gen_code.s
+++ b/src/kernal/tape/tape_head_align_gen_code.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_head_align_get_pulse.s b/src/kernal/tape/tape_head_align_get_pulse.s
index df1cacd4..df66d5b1 100644
--- a/src/kernal/tape/tape_head_align_get_pulse.s
+++ b/src/kernal/tape/tape_head_align_get_pulse.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_head_align_help.s b/src/kernal/tape/tape_head_align_help.s
index 243dab12..ca970b98 100644
--- a/src/kernal/tape/tape_head_align_help.s
+++ b/src/kernal/tape/tape_head_align_help.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_head_align_irq.s b/src/kernal/tape/tape_head_align_irq.s
index 0ff660c3..818d3d5e 100644
--- a/src/kernal/tape/tape_head_align_irq.s
+++ b/src/kernal/tape/tape_head_align_irq.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_normal_calibrate.s b/src/kernal/tape/tape_normal_calibrate.s
index 6dca34dc..9142fd77 100644
--- a/src/kernal/tape/tape_normal_calibrate.s
+++ b/src/kernal/tape/tape_normal_calibrate.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -9,7 +10,7 @@
;
-!ifdef CONFIG_TAPE_NORMAL {
+!ifdef CONFIG_TAPE_NORMAL { !ifdef HAS_TAPE_AUTOCALIBRATE {
tape_normal_calibrate_during_pilot: ; reecalibration during the pilot
@@ -121,4 +122,4 @@ tape_normal_calibrate_threshold_inc:
tape_normal_calibrate_done:
rts
-}
+} }
diff --git a/src/kernal/tape/tape_normal_get_bit.s b/src/kernal/tape/tape_normal_get_bit.s
index fd3b175d..33a5d355 100644
--- a/src/kernal/tape/tape_normal_get_bit.s
+++ b/src/kernal/tape/tape_normal_get_bit.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -21,13 +22,16 @@ tape_normal_get_bit:
; First impulse was short, second should be medium
+!ifdef HAS_TAPE_AUTOCALIBRATE {
jsr tape_normal_calibrate_after_S
+}
jsr tape_common_get_pulse
bcs tape_normal_get_bit_error
+!ifdef HAS_TAPE_AUTOCALIBRATE {
jsr tape_normal_calibrate_after_M
-
+}
; We have a bit '0'
lda #$00
@@ -45,13 +49,16 @@ tape_normal_get_bit_1:
; First impulse was medium, second should be short
+!ifdef HAS_TAPE_AUTOCALIBRATE {
jsr tape_normal_calibrate_after_M
+}
jsr tape_common_get_pulse
bcc tape_normal_get_bit_error
+!ifdef HAS_TAPE_AUTOCALIBRATE {
jsr tape_normal_calibrate_after_S
-
+}
; We have a bit '1'
clc
diff --git a/src/kernal/tape/tape_normal_get_byte.s b/src/kernal/tape/tape_normal_get_byte.s
index 35558dee..59e4b5ae 100644
--- a/src/kernal/tape/tape_normal_get_byte.s
+++ b/src/kernal/tape/tape_normal_get_byte.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_normal_get_data_1.s b/src/kernal/tape/tape_normal_get_data_1.s
index 9d3e49fd..2e27e66f 100644
--- a/src/kernal/tape/tape_normal_get_data_1.s
+++ b/src/kernal/tape/tape_normal_get_data_1.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_normal_get_data_2.s b/src/kernal/tape/tape_normal_get_data_2.s
index 9f5fffc1..c3c40dff 100644
--- a/src/kernal/tape/tape_normal_get_data_2.s
+++ b/src/kernal/tape/tape_normal_get_data_2.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_normal_get_marker.s b/src/kernal/tape/tape_normal_get_marker.s
index b3f62525..afcdbcfe 100644
--- a/src/kernal/tape/tape_normal_get_marker.s
+++ b/src/kernal/tape/tape_normal_get_marker.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -31,16 +32,17 @@ tape_normal_get_marker_type:
; Not an entry point!!!
-tape_normal_get_marker_while_sync_loop:
+tape_normal_get_marker_while_sync__loop:
+!ifdef HAS_TAPE_AUTOCALIBRATE {
jsr tape_normal_calibrate_during_pilot ; while sync use short pulses for calibration
-
+}
; FALLTROUGH
tape_normal_get_marker_while_sync:
jsr tape_common_get_pulse
- bcs tape_normal_get_marker_while_sync_loop ; branch if short pulse
+ bcs tape_normal_get_marker_while_sync__loop ; branch if short pulse
cmp __pulse_threshold_ML
bcs tape_normal_get_marker_while_sync ; too short for a long pulse
diff --git a/src/kernal/tape/tape_normal_get_pilot.s b/src/kernal/tape/tape_normal_get_pilot.s
index 40be7e60..433befc2 100644
--- a/src/kernal/tape/tape_normal_get_pilot.s
+++ b/src/kernal/tape/tape_normal_get_pilot.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -95,8 +96,9 @@ tape_normal_get_pilot_common_loop_inner:
@1:
}
+!ifdef HAS_TAPE_AUTOCALIBRATE {
jsr tape_normal_calibrate_during_pilot
-
+}
dey
bne tape_normal_get_pilot_common_loop_inner
diff --git a/src/kernal/tape/tape_normal_sync.s b/src/kernal/tape/tape_normal_sync.s
index 19cc3b83..183c63c2 100644
--- a/src/kernal/tape/tape_normal_sync.s
+++ b/src/kernal/tape/tape_normal_sync.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_normal_update_checksum.s b/src/kernal/tape/tape_normal_update_checksum.s
index 8f5010ec..dbc59f10 100644
--- a/src/kernal/tape/tape_normal_update_checksum.s
+++ b/src/kernal/tape/tape_normal_update_checksum.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_turbo_bytestore.s b/src/kernal/tape/tape_turbo_bytestore.s
index e178825f..8d5e4ad4 100644
--- a/src/kernal/tape/tape_turbo_bytestore.s
+++ b/src/kernal/tape/tape_turbo_bytestore.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -20,6 +21,8 @@
!ifdef CONFIG_MB_M65 {
!addr __tape_turbo_bytestore_defmap = __tape_turbo_bytestore + 10
+} else ifdef ROM_LAYOUT_CRT {
+!addr __tape_turbo_bytestore_defmap = __tape_turbo_bytestore + 12
} else {
!addr __tape_turbo_bytestore_defmap = __tape_turbo_bytestore + 7
}
@@ -30,8 +33,11 @@ tape_turbo_bytestore_source:
!ifdef CONFIG_MB_M65 {
jsr map_NORMAL
+} else ifdef ROM_LAYOUT_CRT {
+ ; 'jsr map_NORMAL' would take too much time
+ ldx #%00000010
+ stx $DE00
}
-
; Set all memory as RAM, tape motor ON
ldx #$00
stx CPU_R6510
@@ -40,12 +46,17 @@ tape_turbo_bytestore_source:
sta (MEMUSS), y
; Restore default memory layout
- ldx #$00 ; value will be determined later, offset from start: 7 bytes
+ ldx #$00 ; value will be determined later, offset from start: 7/10/12 bytes
stx CPU_R6510
!ifdef CONFIG_MB_M65 {
; Restore default map and quit
jmp map_KERNAL_1
+} else ifdef ROM_LAYOUT_CRT {
+ ; Restore default map and quit; 'jsr map_KERNAL_1' would take too much time
+ ldx #%00010000
+ stx $DE00
+ rts
} else {
; Go back
rts
diff --git a/src/kernal/tape/tape_turbo_get_bit.s b/src/kernal/tape/tape_turbo_get_bit.s
index 52416132..15789b7b 100644
--- a/src/kernal/tape/tape_turbo_get_bit.s
+++ b/src/kernal/tape/tape_turbo_get_bit.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -18,9 +19,12 @@ tape_turbo_get_bit:
jsr tape_common_get_pulse
bcs @1
+!ifdef HAS_TAPE_AUTOCALIBRATE {
+
clc
ror
sta __turbo_half_S ; store half of the last measurement result for short pulse
+}
lda #$01
!ifdef CONFIG_MB_M65 {
@@ -33,10 +37,15 @@ tape_turbo_get_bit:
sta VIC_EXTCOL
sec
rts
+
@1:
+
+!ifdef HAS_TAPE_AUTOCALIBRATE {
+
clc
ror
sta __turbo_half_L ; store half of the last measurement result for long pulse
+}
lda #$00
!ifdef CONFIG_MB_M65 {
diff --git a/src/kernal/tape/tape_turbo_get_byte.s b/src/kernal/tape/tape_turbo_get_byte.s
index 584bf9f9..424df5b2 100644
--- a/src/kernal/tape/tape_turbo_get_byte.s
+++ b/src/kernal/tape/tape_turbo_get_byte.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
@@ -26,6 +27,8 @@ tape_turbo_get_byte:
bcc @1 ; is the initial 1 shifted into carry already?
+plx_trash_a
+!ifdef HAS_TAPE_AUTOCALIBRATE {
+
; Compensate for tape speed variations
lda __turbo_half_S ; half of the last value for bit '0'
@@ -50,6 +53,7 @@ tape_turbo_get_byte:
beq tape_turbo_get_byte_done ; do not increase threshold too far no matter what
inc __pulse_threshold
+}
tape_turbo_get_byte_done:
diff --git a/src/kernal/tape/tape_turbo_sync.s b/src/kernal/tape/tape_turbo_sync.s
index 788d3b1b..3c64f2e4 100644
--- a/src/kernal/tape/tape_turbo_sync.s
+++ b/src/kernal/tape/tape_turbo_sync.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/src/kernal/tape/tape_turbo_sync_first.s b/src/kernal/tape/tape_turbo_sync_first.s
index 6ef93293..cd8d42df 100644
--- a/src/kernal/tape/tape_turbo_sync_first.s
+++ b/src/kernal/tape/tape_turbo_sync_first.s
@@ -1,4 +1,5 @@
;; #LAYOUT# STD * #TAKE
+;; #LAYOUT# CRT KERNAL_1 #TAKE
;; #LAYOUT# M65 KERNAL_1 #TAKE
;; #LAYOUT# * * #IGNORE
diff --git a/strings/0185C0A2 b/strings/0185C0A2
new file mode 100644
index 00000000..2f322ce3
--- /dev/null
+++ b/strings/0185C0A2
@@ -0,0 +1,3 @@
+$01 + STA $C0 + LDX#(value does not match)
+
+Instruction + some parts. Trivial - not copyrightable.
diff --git a/strings/20CAB44C b/strings/20CAB44C
new file mode 100644
index 00000000..3a3fb9fc
--- /dev/null
+++ b/strings/20CAB44C
@@ -0,0 +1,3 @@
+JSR $B4CA + JMP (address does not match)
+
+Instruction + some parts. Trivial - not copyrightable.
diff --git a/strings/534541524348494E b/strings/534541524348494E
new file mode 100644
index 00000000..d54aecd0
--- /dev/null
+++ b/strings/534541524348494E
@@ -0,0 +1,3 @@
+PETSCII string: SEARCHIN
+
+A single word - not copyrightable.
diff --git a/strings/AFC9FFD0 b/strings/AFC9FFD0
new file mode 100644
index 00000000..f99952e3
--- /dev/null
+++ b/strings/AFC9FFD0
@@ -0,0 +1,3 @@
+$AF + CMP #$FF + BNE (offset does not match)
+
+Instruction + some parts. Trivial - not copyrightable.
diff --git a/strings/F5A98085 b/strings/F5A98085
new file mode 100644
index 00000000..166260bd
--- /dev/null
+++ b/strings/F5A98085
@@ -0,0 +1,3 @@
+$F5 + LDA #$80 + STA (zeropage address does not match)
+
+Instruction + some parts. Trivial - not copyrightable.
diff --git a/tools/generate_strings.cc b/tools/generate_strings.cc
index 43d95f34..17440485 100644
--- a/tools/generate_strings.cc
+++ b/tools/generate_strings.cc
@@ -28,6 +28,7 @@ std::string CMD_cnfFile = "";
typedef struct StringEntry
{
bool enabledSTD; // whether enabled for standard build
+ bool enabledCRT; // whether enabled for standard build with extra ROM cartridge
bool enabledM65; // whether enabled for Mega 65 build
bool enabledU64; // whether enabled for Ultimate 64 build
bool enabledX16; // whether enabled for Commander X16 build
@@ -92,128 +93,122 @@ typedef std::vector StringEncodedList;
const StringEntryList GLOBAL_Keywords_V2 = { ListType::KEYWORDS, "keywords_V2",
{
- // STD M65 U64 X16
- { true, true, true, true, "KV2_80", "END", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_81", "FOR", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_82", "NEXT", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_83", "DATA", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_84", "INPUT#", 2 }, // https://www.atariarchives.org/creativeatari/Using_Disks_With_Atari_Basic.php
- { true, true, true, true, "KV2_85", "INPUT", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_86", "DIM", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_87", "READ", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_88", "LET", 2 }, // https://en.wikipedia.org/wiki/Atari_BASIC
- { true, true, true, true, "KV2_89", "GOTO", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_8A", "RUN", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_8B", "IF", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_8C", "RESTORE", 3 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_8D", "GOSUB", 3 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_8E", "RETURN", 3 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_8F", "REM", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_90", "STOP", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_91", "ON", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_92", "WAIT", 2 }, // http://www.picaxe.com/BASIC-Commands/Time-Delays/wait/
- { true, true, true, true, "KV2_93", "LOAD", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_94", "SAVE", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_95", "VERIFY", 2 }, // https://en.wikipedia.org/wiki/Sinclair_BASIC
- { true, true, true, true, "KV2_96", "DEF", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_97", "POKE", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_98", "PRINT#", 2 }, // https://www.atariarchives.org/creativeatari/Using_Disks_With_Atari_Basic.php
- { true, true, true, true, "KV2_99", "PRINT", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_9A", "CONT", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_9B", "LIST", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_9C", "CLR", 2 }, // Apple I Replica Creation: Back to the Garage, p125
- { true, true, true, true, "KV2_9D", "CMD", 2 }, // https://en.wikipedia.org/wiki/List_of_DOS_commands
- { true, true, true, true, "KV2_9E", "SYS", 2 }, // https://www.lifewire.com/dos-commands-4070427
- { true, true, true, true, "KV2_9F", "OPEN", 2 }, // https://www.atariarchives.org/creativeatari/Using_Disks_With_Atari_Basic.php
- // STD M65 U64 X16
- { true, true, true, true, "KV2_A0", "CLOSE", 3 }, // https://www.atariarchives.org/creativeatari/Using_Disks_With_Atari_Basic.php
- { true, true, true, true, "KV2_A1", "GET", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_A2", "NEW", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_A3", "TAB(", 2 }, // http://www.antonis.de/qbebooks/gwbasman/tab.html
- { true, true, true, true, "KV2_A4", "TO", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_A5", "FN", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_A6", "SPC(", 2 }, // http://www.antonis.de/qbebooks/gwbasman/spc.html
- { true, true, true, true, "KV2_A7", "THEN", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_A8", "NOT", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_A9", "STEP", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_AA", "+", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_AB", "-", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_AC", "*", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_AD", "/", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_AE", "^", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_AF", "AND", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_B0", "OR", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_B1", ">", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_B2", "=", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_B3", "<", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_B4", "SGN", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_B5", "INT", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_B6", "ABS", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_B7", "USR", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_B8", "FRE", 2 }, // http://www.antonis.de/qbebooks/gwbasman/fre.html
- { true, true, true, true, "KV2_B9", "POS", 0 }, // http://www.antonis.de/qbebooks/gwbasman/pos.html
- { true, true, true, true, "KV2_BA", "SQR", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_BB", "RND", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_BC", "LOG", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_BD", "EXP", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_BE", "COS", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_BF", "SIN", 2 }, // https://www.landsnail.com/a2ref.htm
- // STD M65 U64 X16
- { true, true, true, true, "KV2_C0", "TAN", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_C1", "ATN", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_C2", "PEEK", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_C3", "LEN", 0 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_C4", "STR$", 3 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_C5", "VAL", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_C6", "ASC", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_C7", "CHR$", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_C8", "LEFT$", 3 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_C9", "RIGHT$", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_CA", "MID$", 2 }, // https://www.landsnail.com/a2ref.htm
- { true, true, true, true, "KV2_CB", "GO", 0 }, // https://en.wikipedia.org/wiki/Goto
+ // STD CRT M65 U64 X16
+ { true, true, true, true, true, "KV2_80", "END", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_81", "FOR", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_82", "NEXT", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_83", "DATA", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_84", "INPUT#", 2 }, // https://www.atariarchives.org/creativeatari/Using_Disks_With_Atari_Basic.php
+ { true, true, true, true, true, "KV2_85", "INPUT", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_86", "DIM", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_87", "READ", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_88", "LET", 2 }, // https://en.wikipedia.org/wiki/Atari_BASIC
+ { true, true, true, true, true, "KV2_89", "GOTO", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_8A", "RUN", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_8B", "IF", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_8C", "RESTORE", 3 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_8D", "GOSUB", 3 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_8E", "RETURN", 3 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_8F", "REM", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_90", "STOP", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_91", "ON", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_92", "WAIT", 2 }, // http://www.picaxe.com/BASIC-Commands/Time-Delays/wait/
+ { true, true, true, true, true, "KV2_93", "LOAD", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_94", "SAVE", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_95", "VERIFY", 2 }, // https://en.wikipedia.org/wiki/Sinclair_BASIC
+ { true, true, true, true, true, "KV2_96", "DEF", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_97", "POKE", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_98", "PRINT#", 2 }, // https://www.atariarchives.org/creativeatari/Using_Disks_With_Atari_Basic.php
+ { true, true, true, true, true, "KV2_99", "PRINT", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_9A", "CONT", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_9B", "LIST", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_9C", "CLR", 2 }, // Apple I Replica Creation: Back to the Garage, p125
+ { true, true, true, true, true, "KV2_9D", "CMD", 2 }, // https://en.wikipedia.org/wiki/List_of_DOS_commands
+ { true, true, true, true, true, "KV2_9E", "SYS", 2 }, // https://www.lifewire.com/dos-commands-4070427
+ { true, true, true, true, true, "KV2_9F", "OPEN", 2 }, // https://www.atariarchives.org/creativeatari/Using_Disks_With_Atari_Basic.php
+ // STD CRT M65 U64 X16
+ { true, true, true, true, true, "KV2_A0", "CLOSE", 3 }, // https://www.atariarchives.org/creativeatari/Using_Disks_With_Atari_Basic.php
+ { true, true, true, true, true, "KV2_A1", "GET", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_A2", "NEW", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_A3", "TAB(", 2 }, // http://www.antonis.de/qbebooks/gwbasman/tab.html
+ { true, true, true, true, true, "KV2_A4", "TO", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_A5", "FN", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_A6", "SPC(", 2 }, // http://www.antonis.de/qbebooks/gwbasman/spc.html
+ { true, true, true, true, true, "KV2_A7", "THEN", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_A8", "NOT", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_A9", "STEP", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_AA", "+", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_AB", "-", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_AC", "*", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_AD", "/", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_AE", "^", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_AF", "AND", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_B0", "OR", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_B1", ">", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_B2", "=", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_B3", "<", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_B4", "SGN", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_B5", "INT", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_B6", "ABS", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_B7", "USR", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_B8", "FRE", 2 }, // http://www.antonis.de/qbebooks/gwbasman/fre.html
+ { true, true, true, true, true, "KV2_B9", "POS", 0 }, // http://www.antonis.de/qbebooks/gwbasman/pos.html
+ { true, true, true, true, true, "KV2_BA", "SQR", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_BB", "RND", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_BC", "LOG", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_BD", "EXP", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_BE", "COS", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_BF", "SIN", 2 }, // https://www.landsnail.com/a2ref.htm
+ // STD CRT M65 U64 X16
+ { true, true, true, true, true, "KV2_C0", "TAN", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_C1", "ATN", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_C2", "PEEK", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_C3", "LEN", 0 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_C4", "STR$", 3 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_C5", "VAL", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_C6", "ASC", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_C7", "CHR$", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_C8", "LEFT$", 3 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_C9", "RIGHT$", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_CA", "MID$", 2 }, // https://www.landsnail.com/a2ref.htm
+ { true, true, true, true, true, "KV2_CB", "GO", 0 }, // https://en.wikipedia.org/wiki/Goto
} };
-// extended BASIC keywords - list reserved for small BASIC commands, suitable for inclusion in non-extended ROMs
+// extended BASIC keywords - list reserved for small BASIC commands, suitable for inclusion in all machines with extended ROM
const StringEntryList GLOBAL_Keywords_01 = { ListType::KEYWORDS, "keywords_01",
{
- // STD M65 U64 X16
- { true, true, true, true, "K01_01", "SLOW", }, // https://en.wikipedia.org/wiki/Sinclair_BASIC - ZX81 variant
- { true, true, true, true, "K01_02", "FAST", }, // https://en.wikipedia.org/wiki/Sinclair_BASIC - ZX81 variant
- { true, true, true, true, "K01_03", "OLD", }, // Not present in CBM BASIC dialects, but common to some extensions (*)
-
- // (*) see https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/petcat.c
-
- // NOTE! These commands are temporarily placed here, they should be a part of list 02!
-
- { true, true, true, true, "K02_01", "MERGE", }, // Not present in CBM BASIC dialects, but common to some extensions (*)
- { true, true, true, true, "K02_02", "BLOAD", }, // http://www.antonis.de/qbebooks/gwbasman/bload.html
- { true, true, true, true, "K02_03", "BSAVE", }, // http://www.antonis.de/qbebooks/gwbasman/bsave.html
- { true, true, true, true, "K02_04", "BVERIFY", },
- { true, true, true, true, "K02_05", "CLEAR", }, // Not present in CBM BASIC dialects, Open ROMs specific
- { true, true, true, true, "K02_06", "DISPOSE", }, // Not present in CBM BASIC dialects, Open ROMs specific
-} };
-
-// extended BASIC keywords - list reserved for generic (mostly hardware independent) BASIC commands
-
-const StringEntryList GLOBAL_Keywords_02 = { ListType::KEYWORDS, "keywords_02",
-{
- // STD M65 U64 X16
-
- { false, true, false, false, "K02_07", "COLD", }, // Not present in CBM BASIC dialects, but common to some extensions (*)
- { false, true, false, false, "K02_08", "MEM", }, // Not present in CBM BASIC dialects, Open ROMs specific
- { false, true, false, false, "K02_09", "SYSINFO", }, // Not present in CBM BASIC dialects, Open ROMs specific
+ // STD CRT M65 U64 X16
+ { true, true, true, true, true, "K01_01", "SLOW", }, // https://en.wikipedia.org/wiki/Sinclair_BASIC - ZX81 variant
+ { true, true, true, true, true, "K01_02", "FAST", }, // https://en.wikipedia.org/wiki/Sinclair_BASIC - ZX81 variant
+ { true, true, true, true, true, "K01_03", "OLD", }, // Not present in CBM BASIC dialects, but common to some extensions (*)
+ { false, true, true, true, false, "K01_04", "CLEAR", }, // Not present in CBM BASIC dialects, Open ROMs specific
+ { false, true, true, true, false, "K01_05", "DISPOSE", }, // Not present in CBM BASIC dialects, Open ROMs specific
+ { false, true, true, true, false, "K01_06", "MERGE", }, // Not present in CBM BASIC dialects, but common to some extensions (*)
+ { false, true, true, true, false, "K01_07", "BLOAD", }, // http://www.antonis.de/qbebooks/gwbasman/bload.html
+ { false, true, true, true, false, "K01_08", "BSAVE", }, // http://www.antonis.de/qbebooks/gwbasman/bsave.html
+ { false, true, true, true, false, "K01_09", "BVERIFY", },
+ { false, true, true, true, false, "K01_0A", "COLD", }, // Not present in CBM BASIC dialects, but common to some extensions (*)
+ { false, true, true, true, false, "K01_0B", "MEM", }, // Not present in CBM BASIC dialects, Open ROMs specific
// (*) see https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/petcat.c
} };
// extended BASIC keywords - list reserved for hardware dependent BASIC commands
-const StringEntryList GLOBAL_Keywords_03_M65 = { ListType::KEYWORDS, "keywords_03",
+const StringEntryList GLOBAL_Keywords_04 = { ListType::KEYWORDS, "keywords_04",
{
- // STD M65 U64 X16
+ // STD CRT M65 U64 X16
+ { false, false, true, false, false, "K04_01", "SYSINFO", }, // Not present in CBM BASIC dialects, Open ROMs specific
- { false, true, false, false, "K03_01", "TEST", }, // Not present in CBM BASIC dialects, Open ROMs specific
+} };
+
+// extended BASIC keywords - list reserved for functions
+
+const StringEntryList GLOBAL_Keywords_06 = { ListType::KEYWORDS, "keywords_06",
+{
+ // STD CRT M65 U64 X16
+ { false, false, true, false, false, "K06_01", "TEST", }, // Not present in CBM BASIC dialects, Open ROMs specific
} };
@@ -232,96 +227,98 @@ const StringEntryList GLOBAL_Keywords_03_M65 = { ListType::KEYWORDS, "keywords_
const StringEntryList GLOBAL_Errors = { ListType::STRINGS_BASIC, "errors",
{
- // STD M65 U64 X16 --- error strings compatible with CBM BASIC V2
- { true, true, true, true, "EV2_01", "TOO MANY FILES" },
- { true, true, true, true, "EV2_02", "FILE OPEN" },
- { true, true, true, true, "EV2_03", "FILE NOT OPEN" },
- { true, true, true, true, "EV2_04", "FILE NOT FOUND" },
- { true, true, true, true, "EV2_05", "DEVICE NOT PRESENT" },
- { true, true, true, true, "EV2_06", "NOT INPUT FILE" },
- { true, true, true, true, "EV2_07", "NOT OUTPUT FILE" },
- { true, true, true, true, "EV2_08", "MISSING FILENAME" },
- { true, true, true, true, "EV2_09", "ILLEGAL DEVICE NUMBER" },
- { true, true, true, true, "EV2_0A", "NEXT WITHOUT FOR" },
- { true, true, true, true, "EV2_0B", "SYNTAX" },
- { true, true, true, true, "EV2_0C", "RETURN WITHOUT GOSUB" },
- { true, true, true, true, "EV2_0D", "OUT OF DATA" },
- { true, true, true, true, "EV2_0E", "ILLEGAL QUANTITY" },
- { true, true, true, true, "EV2_0F", "OVERFLOW" },
- { true, true, true, true, "EV2_10", "OUT OF MEMORY" },
- { true, true, true, true, "EV2_11", "UNDEF\'D STATEMENT" },
- { true, true, true, true, "EV2_12", "BAD SUBSCRIPT" },
- { true, true, true, true, "EV2_13", "REDIM\'D ARRAY" },
- { true, true, true, true, "EV2_14", "DIVISION BY ZERO" },
- { true, true, true, true, "EV2_15", "ILLEGAL DIRECT" },
- { true, true, true, true, "EV2_16", "TYPE MISMATCH" },
- { true, true, true, true, "EV2_17", "STRING TOO LONG" },
- { true, true, true, true, "EV2_18", "FILE DATA" },
- { true, true, true, true, "EV2_19", "FORMULA TOO COMPLEX" },
- { true, true, true, true, "EV2_1A", "CAN\'T CONTINUE" },
- { true, true, true, true, "EV2_1B", "UNDEF\'D FUNCTION" },
- { true, true, true, true, "EV2_1C", "VERIFY" },
- { true, true, true, true, "EV2_1D", "LOAD" },
- { true, true, true, true, "EV2_1E", "BREAK" },
- // STD M65 U64 X16 --- error strings compatible with CBM BASIC V7
- { false, false, false, false, "EV7_1F", "CAN'T RESUME" }, // not used for now
- { false, false, false, false, "EV7_20", "LOOP NOT FOUND" }, // not used for now
- { false, false, false, false, "EV7_21", "LOOP WITHOUT DO" }, // not used for now
- { true, true, true, true, "EV7_22", "DIRECT MODE ONLY" },
- { false, false, false, false, "EV7_23", "NO GRAPHICS AREA" }, // not used for now
- { false, false, false, false, "EV7_24", "BAD DISK" }, // not used for now
- { false, false, false, false, "EV7_25", "BEND NOT FOUND" }, // not used for now
- { true, true, true, true, "EV7_26", "LINE NUMBER TOO LARGE" },
- { false, false, false, false, "EV7_27", "UNRESOLVED REFERENCE" }, // not used for now
- { true, true, true, true, "EV7_28", "NOT IMPLEMENTED" }, // this message actually differs from the CBM one
- { false, false, false, false, "EV7_29", "FILE READ" }, // not used for now
- // STD M65 U64 X16 --- error strings specific to Open ROMs, not present in CBM BASIC dialects
- { true, true, true, true, "EOR_2A", "MEMORY CORRUPT" },
+ // STD CRT M65 U64 X16 --- error strings compatible with CBM BASIC V2
+ { true, true, true, true, true, "EV2_01", "TOO MANY FILES" },
+ { true, true, true, true, true, "EV2_02", "FILE OPEN" },
+ { true, true, true, true, true, "EV2_03", "FILE NOT OPEN" },
+ { true, true, true, true, true, "EV2_04", "FILE NOT FOUND" },
+ { true, true, true, true, true, "EV2_05", "DEVICE NOT PRESENT" },
+ { true, true, true, true, true, "EV2_06", "NOT INPUT FILE" },
+ { true, true, true, true, true, "EV2_07", "NOT OUTPUT FILE" },
+ { true, true, true, true, true, "EV2_08", "MISSING FILENAME" },
+ { true, true, true, true, true, "EV2_09", "ILLEGAL DEVICE NUMBER" },
+ { true, true, true, true, true, "EV2_0A", "NEXT WITHOUT FOR" },
+ { true, true, true, true, true, "EV2_0B", "SYNTAX" },
+ { true, true, true, true, true, "EV2_0C", "RETURN WITHOUT GOSUB" },
+ { true, true, true, true, true, "EV2_0D", "OUT OF DATA" },
+ { true, true, true, true, true, "EV2_0E", "ILLEGAL QUANTITY" },
+ { true, true, true, true, true, "EV2_0F", "OVERFLOW" },
+ { true, true, true, true, true, "EV2_10", "OUT OF MEMORY" },
+ { true, true, true, true, true, "EV2_11", "UNDEF\'D STATEMENT" },
+ { true, true, true, true, true, "EV2_12", "BAD SUBSCRIPT" },
+ { true, true, true, true, true, "EV2_13", "REDIM\'D ARRAY" },
+ { true, true, true, true, true, "EV2_14", "DIVISION BY ZERO" },
+ { true, true, true, true, true, "EV2_15", "ILLEGAL DIRECT" },
+ { true, true, true, true, true, "EV2_16", "TYPE MISMATCH" },
+ { true, true, true, true, true, "EV2_17", "STRING TOO LONG" },
+ { true, true, true, true, true, "EV2_18", "FILE DATA" },
+ { true, true, true, true, true, "EV2_19", "FORMULA TOO COMPLEX" },
+ { true, true, true, true, true, "EV2_1A", "CAN\'T CONTINUE" },
+ { true, true, true, true, true, "EV2_1B", "UNDEF\'D FUNCTION" },
+ { true, true, true, true, true, "EV2_1C", "VERIFY" },
+ { true, true, true, true, true, "EV2_1D", "LOAD" },
+ { true, true, true, true, true, "EV2_1E", "BREAK" },
+ // STD CRT M65 U64 X16 --- error strings compatible with CBM BASIC V7
+ { false, false, false, false, false, "EV7_1F", "CAN'T RESUME" }, // not used for now
+ { false, false, false, false, false, "EV7_20", "LOOP NOT FOUND" }, // not used for now
+ { false, false, false, false, false, "EV7_21", "LOOP WITHOUT DO" }, // not used for now
+ { true, true, true, true, true, "EV7_22", "DIRECT MODE ONLY" },
+ { false, false, false, false, false, "EV7_23", "NO GRAPHICS AREA" }, // not used for now
+ { false, false, false, false, false, "EV7_24", "BAD DISK" }, // not used for now
+ { false, false, false, false, false, "EV7_25", "BEND NOT FOUND" }, // not used for now
+ { true, true, true, true, true, "EV7_26", "LINE NUMBER TOO LARGE" },
+ { false, false, false, false, false, "EV7_27", "UNRESOLVED REFERENCE" }, // not used for now
+ { true, true, true, true, true, "EV7_28", "NOT IMPLEMENTED" }, // this message actually differs from the CBM one
+ { false, false, false, false, false, "EV7_29", "FILE READ" }, // not used for now
+ // STD CRT M65 U64 X16 --- error strings specific to Open ROMs, not present in CBM BASIC dialects
+ { true, true, true, true, true, "EOR_2A", "MEMORY CORRUPT" },
+ { false, false, true, false, false, "EOR_2B", "NATIVE MODE ONLY" },
+ { false, false, true, false, false, "EOR_2C", "LEGACY MODE ONLY" },
} };
// BASIC errors - miscelaneous strings
const StringEntryList GLOBAL_MiscStrings = { ListType::STRINGS_BASIC, "misc",
{
- // STD M65 U64 X16 --- misc strings as on CBM machines
- { true, true, true, true, "STR_RET_QM", "\r?" },
- { true, true, true, true, "STR_BYTES", " BASIC BYTES FREE" }, // https://github.com/stefanhaustein/expressionparser
- { true, true, true, true, "STR_READY", "\rREADY.\r" }, // https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_whatistsonative.htm https://github.com/stefanhaustein/expressionparser
- { true, 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, true, "STR_IN", " IN " },
- { false, true, false, false, "STR_IF_SURE", "\rARE YOU SURE? " }, // https://docs.microsoft.com/en-us/windows/win32/uxguide/mess-confirm
- // STD M65 U64 X16 --- misc strings specific to Open ROMs, not present in CBM ROMs
- { true, true, true, true, "STR_BRK_AT", "\rBRK AT $" },
+ // STD CRT M65 U64 X16 --- misc strings as on CBM machines
+ { true, true, true, true, true, "STR_RET_QM", "\r?" },
+ { true, true, true, true, true, "STR_BYTES", " BASIC BYTES FREE" }, // https://github.com/stefanhaustein/expressionparser
+ { true, true, true, true, true, "STR_READY", "\rREADY.\r" }, // https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_whatistsonative.htm https://github.com/stefanhaustein/expressionparser
+ { true, true, 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, true, true, "STR_IN", " IN " },
+ { false, true, true, false, false, "STR_IF_SURE", "\rARE YOU SURE? " }, // https://docs.microsoft.com/en-us/windows/win32/uxguide/mess-confirm
+ // STD CRT M65 U64 X16 --- misc strings specific to Open ROMs, not present in CBM ROMs
+ { true, true, true, true, true, "STR_BRK_AT", "\rBRK AT $" },
- { false, true, false, false, "STR_ORS", "OPEN ROMS BASIC & KERNAL\r" },
- { false, true, false, false, "STR_ORS_LEGACY_1", "OPEN ROMS " },
- { false, true, false, false, "STR_ORS_LEGACY_2", "\r\rLEGACY MODE " },
+ { false, false, true, false, false, "STR_ORS", "OPEN ROMS BASIC & KERNAL\r" },
+ { false, false, true, false, false, "STR_ORS_LEGACY_1", "OPEN ROMS " },
+ { false, false, true, false, false, "STR_ORS_LEGACY_2", "\r\rLEGACY MODE " },
- { false, true, false, false, "STR_MEM_HDR", "\r\x12 AREA START SIZE \r" },
- { false, true, false, false, "STR_MEM_1", " $" },
- { false, true, false, false, "STR_MEM_2", " " },
- { false, true, false, false, "STR_MEM_TEXT", "\r TEXT" },
- { false, true, false, false, "STR_MEM_VARS", "\r VARS" },
- { false, true, false, false, "STR_MEM_ARRS", "\r ARRS" },
- { false, true, false, false, "STR_MEM_STRS", "\r STRS" },
- { false, true, false, false, "STR_MEM_FREE", "\r\r FREE" },
+ { false, true, true, false, false, "STR_MEM_HDR", "\r\x12 AREA START SIZE \r" },
+ { false, true, true, false, false, "STR_MEM_1", " $" },
+ { false, true, true, false, false, "STR_MEM_2", " " },
+ { false, true, true, false, false, "STR_MEM_TEXT", "\r TEXT" },
+ { false, true, true, false, false, "STR_MEM_VARS", "\r VARS" },
+ { false, true, true, false, false, "STR_MEM_ARRS", "\r ARRS" },
+ { false, true, true, false, false, "STR_MEM_STRS", "\r STRS" },
+ { false, true, true, false, false, "STR_MEM_FREE", "\r\r FREE" },
- { false, true, false, false, "STR_SI_HEADER", "OPEN ROMS, " },
- { false, true, false, false, "STR_SI_MODE64", "LEGACY MODE" },
- { false, true, false, false, "STR_SI_MODE65", "NATIVE MODE" },
- { false, true, false, false, "STR_SI_HDR_REL", "\rRELEASE " },
- { false, true, false, false, "STR_SI_HDR_HW", "BOARD : " },
- { false, true, false, false, "STR_SI_HW_01", "MEGA65 R1" },
- { false, true, false, false, "STR_SI_HW_02", "MEGA65 R2" },
- { false, true, false, false, "STR_SI_HW_03", "MEGA65 R3" },
- { false, true, false, false, "STR_SI_HW_21", "MEGAPHONE R1" },
- { false, true, false, false, "STR_SI_HW_40", "NEXYS4 PSRAM" },
- { false, true, false, false, "STR_SI_HW_41", "NEXYS4 DDR" },
- { false, true, false, false, "STR_SI_HW_42", "NEXYS4 DDR WIDGET" },
- { false, true, false, false, "STR_SI_HW_FD", "WUKONG A100T" },
- { false, true, false, false, "STR_SI_HW_FE", "SIMULATION VHDL" },
- { false, true, false, false, "STR_SI_HW_XX", "UNKNOWN ID $" },
- { false, true, false, false, "STR_SI_HDR_VID", "\rVIDEO : " },
+ { false, false, true, false, false, "STR_SI_HEADER", "OPEN ROMS, " },
+ { false, false, true, false, false, "STR_SI_MODE64", "LEGACY MODE" },
+ { false, false, true, false, false, "STR_SI_MODE65", "NATIVE MODE" },
+ { false, false, true, false, false, "STR_SI_HDR_REL", "\rRELEASE " },
+ { false, false, true, false, false, "STR_SI_HDR_HW", "BOARD : " },
+ { false, false, true, false, false, "STR_SI_HW_01", "MEGA65 R1" },
+ { false, false, true, false, false, "STR_SI_HW_02", "MEGA65 R2" },
+ { false, false, true, false, false, "STR_SI_HW_03", "MEGA65 R3" },
+ { false, false, true, false, false, "STR_SI_HW_21", "MEGAPHONE R1" },
+ { false, false, true, false, false, "STR_SI_HW_40", "NEXYS4 PSRAM" },
+ { false, false, true, false, false, "STR_SI_HW_41", "NEXYS4 DDR" },
+ { false, false, true, false, false, "STR_SI_HW_42", "NEXYS4 DDR WIDGET" },
+ { false, false, true, false, false, "STR_SI_HW_FD", "WUKONG A100T" },
+ { false, false, true, false, false, "STR_SI_HW_FE", "SIMULATION VHDL" },
+ { false, false, true, false, false, "STR_SI_HW_XX", "UNKNOWN ID $" },
+ { false, false, true, false, false, "STR_SI_HDR_VID", "\rVIDEO : " },
// Note: depending on configuration, additional strings will be added here
} };
@@ -542,6 +539,12 @@ class DataSetSTD : public DataSet
std::string layoutName() const { return "STD"; }
};
+class DataSetCRT : public DataSet
+{
+ bool isRelevant(const StringEntry &entry) const { return entry.enabledCRT; }
+ std::string layoutName() const { return "CRT"; }
+};
+
class DataSetM65 : public DataSet
{
bool isRelevant(const StringEntry &entry) const { return entry.enabledM65; }
@@ -1061,7 +1064,7 @@ void DictEncoder::process(StringEntryList &outDictionary)
for (const auto &dictionaryStr : dictionary)
{
- StringEntry newEntry = { true, true, true, "", dictionaryStr };
+ StringEntry newEntry = { true, true, true, true, "", dictionaryStr };
outDictionary.list.push_back(newEntry);
}
@@ -1232,8 +1235,8 @@ void DataSet::generateConfigDepStrings()
if (GLOBAL_ConfigOptions["SHOW_FEATURES"] || GLOBAL_ConfigOptions["MB_M65"])
{
- StringEntry newEntry1 = { true, true, true, true, "STR_PAL", "PAL\r" };
- StringEntry newEntry2 = { true, true, true, true, "STR_NTSC", "NTSC\r" };
+ StringEntry newEntry1 = { true, true, true, true, true, "STR_PAL", "PAL\r" };
+ StringEntry newEntry2 = { true, true, true, true, true, "STR_NTSC", "NTSC\r" };
stringEntryList.list.push_back(newEntry1);
stringEntryList.list.push_back(newEntry2);
@@ -1241,19 +1244,19 @@ void DataSet::generateConfigDepStrings()
if (GLOBAL_ConfigOptions["SHOW_FEATURES"])
{
- StringEntry newEntry = { true, true, true, true, "STR_FEATURES", featureStr };
+ StringEntry newEntry = { true, true, true, true, true, "STR_FEATURES", featureStr };
stringEntryList.list.push_back(newEntry);
}
if (GLOBAL_ConfigOptions["MB_M65"])
{
- StringEntry newEntry = { false, true, false, false, "STR_SI_FEATURES", featureStrM65 };
+ StringEntry newEntry = { false, true, true, false, false, "STR_SI_FEATURES", featureStrM65 };
stringEntryList.list.push_back(newEntry);
}
if (!GLOBAL_ConfigOptions["BRAND_CUSTOM_BUILD"] || GLOBAL_ConfigOptions["MB_M65"])
{
- StringEntry newEntry = { true, true, true, true, "STR_PRE_REV", "RELEASE " };
+ StringEntry newEntry = { true, true, true, true, true, "STR_PRE_REV", "RELEASE " };
stringEntryList.list.push_back(newEntry);
}
@@ -1678,7 +1681,6 @@ void DataSet::prepareOutput()
// Convert our encoded strings to a KickAssembler source
std::ostringstream stream;
- stream << std::endl << "!ifdef ROM_LAYOUT_" << layoutName() << " {"<< std::endl;
// Export 1-nibble and 3-nibble encoding data
@@ -1717,7 +1719,7 @@ void DataSet::prepareOutput()
// Finalize the file stream
- stream << std::endl << "} ; ROM_LAYOUT_" << layoutName() << std::endl;
+ stream << std::endl;
outFileContent = stream.str();
}
@@ -1840,8 +1842,8 @@ void writeStrings()
dataSetM65.addStrings(GLOBAL_Keywords_V2);
dataSetM65.addStrings(GLOBAL_Keywords_01);
- dataSetM65.addStrings(GLOBAL_Keywords_02);
- dataSetM65.addStrings(GLOBAL_Keywords_03_M65);
+ dataSetM65.addStrings(GLOBAL_Keywords_04);
+ dataSetM65.addStrings(GLOBAL_Keywords_06);
dataSetM65.addStrings(GLOBAL_Errors);
dataSetM65.addStrings(GLOBAL_MiscStrings);
@@ -1849,6 +1851,21 @@ void writeStrings()
outputString = dataSetM65.getOutput();
}
+ else if (GLOBAL_ConfigOptions["PLATFORM_COMMODORE_64"] && GLOBAL_ConfigOptions["ROM_CRT"])
+ {
+ DataSetCRT dataSetCRT;
+
+ // Add input data to computation objects
+
+ dataSetCRT.addStrings(GLOBAL_Keywords_V2);
+ dataSetCRT.addStrings(GLOBAL_Keywords_01);
+ dataSetCRT.addStrings(GLOBAL_Errors);
+ dataSetCRT.addStrings(GLOBAL_MiscStrings);
+
+ // Retrieve the results
+
+ outputString = dataSetCRT.getOutput();
+ }
else if (GLOBAL_ConfigOptions["PLATFORM_COMMODORE_64"] && GLOBAL_ConfigOptions["MB_U64"])
{
DataSetU64 dataSetU64;
diff --git a/tools/release.cc b/tools/release.cc
index 76fdd1e0..918d3790 100644
--- a/tools/release.cc
+++ b/tools/release.cc
@@ -50,6 +50,16 @@ const std::vector ROM_DEFINITIONS =
0x1F80 // KERNAL ID offset
},
+ {
+ "CART",
+ 32896, // file size
+ 0x203C, // signature offset 1
+ 0, // signature offset 2
+ 0, // DOS date offset
+ 0, // BASIC ID offset
+ 0 // KERNAL ID offset
+ },
+
{
"MEGA65",
128 * 1024, // file size
@@ -70,7 +80,8 @@ const std::vector STR_SNAPSHOT = { 0x28, 0x44, 0x45, 0x56, 0x45, 0x4C,
0x00 };
const std::vector STR_DOSDATE = { 0x4F, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58 };
-const std::string STR_DEV = "DEV.";
+const std::string STR_DEV = "DEV.";
+const std::string STR_BLOCK = "DO NOT DISTRIBUTE";
//
// Command and enviroment line settings
@@ -357,6 +368,16 @@ void ROMFile::readSrcFile()
if (!srcFile.good()) ERROR(std::string("unable to read ROM file '") + srcFileNamePath + "'");
srcFile.close();
+
+ // Check if it is OK to distribute the file
+
+ for (size_t idx = 0; idx < srcFileContent.size() - STR_BLOCK.size(); idx++)
+ {
+ if (memcmp(&srcFileContent[idx], STR_BLOCK.c_str(), STR_BLOCK.size()) == 0)
+ {
+ ERROR(std::string("not allowed to distribute ROM file '") + srcFileNamePath + "'");
+ }
+ }
}
void ROMFile::readDstFile()