From 5d45c166e73a2c4111cb62c01958f21f45487e44 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 1 Jun 2020 15:26:05 +0200 Subject: [PATCH] support for LOAD command without parameters, some cleanup --- CREDITS.md | 1 + Makefile | 17 ++++--- STATUS.md | 2 +- c64/basic/commands/cmd_load.s | 26 +++++++++- c64/kernal/iec_fast/jiffydos_load.s | 75 +---------------------------- 5 files changed, 37 insertions(+), 84 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index bbf59ede..d4bef889 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -19,6 +19,7 @@ * Jochen Adler - for the JiffyDOS protocol reverse engineering * H2Obsession - for the JiffyDOS protocol description on [his page](https://sites.google.com/site/h2obsession/CBM/C128/JiffySoft128) * SD2IEC team - the project [source code](https://github.com/rkrajnc/sd2iec) helped a lot when adding IEC and JiffyDOS support +* Luigi Di Fraia - for his tape formats [description](https://www.luigidifraia.com/c64/docs/tapeloaders.html) * slark - for his screen codes / PETSCII description at [slark.me](https://slark.me) * silverdr - for the floating point routines [description](https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics) * the [C64 Wiki](https://www.c64-wiki.com) contributors diff --git a/Makefile b/Makefile index 3478231d..2181f8c2 100644 --- a/Makefile +++ b/Makefile @@ -140,11 +140,14 @@ HYBRID_WARNING = "*** WARNING *** Distributing kernal_hybrid.rom violates both o GIT_COMMIT:= $(shell git log -1 --pretty='%h' | tr '[:lower:]' '[:upper:]') -# Rules - main +# Rules - main XXX fast build does not always succeed, not yet clear, why -.PHONY: all clean updatebin +.PHONY: all fast clean updatebin all: + $(MAKE) $(TARGET_LIST) $(EXT_TARGET_LIST) + +fast: $(MAKE) -j64 --output-sync=target $(TARGET_LIST) $(EXT_TARGET_LIST) clean: @@ -223,7 +226,7 @@ $(DIR_M65)/kernal.seg_1 $(DIR_M65)/KERNAL_1_combined.vs $(DIR_M65)/KERNAL_1_comb $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_M65) $(DIR_M65)/KERNAL_0_combined.sym $(DIR_X16)/basic.seg_1 $(DIR_X16)/BASIC_1_combined.vs $(DIR_X16)/BASIC_1_combined.sym: \ - $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_X16) $(DIR_M65)/KERNAL_0_combined.sym $(DIR_X16)/BASIC_0_combined.sym + $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_BASIC) $(CFG_X16) $(DIR_X16)/KERNAL_0_combined.sym $(DIR_X16)/BASIC_0_combined.sym $(DIR_X16)/kernal.seg_1 $(DIR_X16)/KERNAL_1_combined.vs $(DIR_X16)/KERNAL_1_combined.sym: \ $(TOOL_ASSEMBLER) $(TOOL_BUILD_SEGMENT) $(DEP_KERNAL) $(CFG_X16) $(DIR_X16)/KERNAL_0_combined.sym @@ -298,22 +301,22 @@ $(DIR_M65)/kernal.seg_1 $(DIR_M65)/KERNAL_1_combined.vs $(DIR_M65)/KERNAL_1_comb $(DIR_X16)/OUTB_0.BIN $(DIR_X16)/BASIC_0_combined.vs $(DIR_X16)/BASIC_0_combined.sym: @mkdir -p $(DIR_X16) @rm -f $@* $(DIR_X16)/BASIC_0* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s BASIC_0 -i BASIC_0-mega65 -o OUTB_0.BIN -d $(DIR_X16) -l c000 -h e4d2 $(CFG_X16) $(SRCDIR_BASIC) $(GEN_BASIC) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s BASIC_0 -i BASIC_0-x16 -o OUTB_0.BIN -d $(DIR_X16) -l c000 -h e4d2 $(CFG_X16) $(SRCDIR_BASIC) $(GEN_BASIC) $(DIR_X16)/OUTK_0.BIN $(DIR_X16)/KERNAL_0_combined.vs $(DIR_X16)/KERNAL_0_combined.sym: @mkdir -p $(DIR_X16) @rm -f $@* $(DIR_X16)/KERNAL_0* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s KERNAL_0 -i KERNAL_0-mega65 -o OUTK_0.BIN -d $(DIR_X16) -l e4d3 -h ffff $(CFG_X16) $(SRCDIR_KERNAL) $(GEN_KERNAL) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s KERNAL_0 -i KERNAL_0-x16 -o OUTK_0.BIN -d $(DIR_X16) -l e4d3 -h ffff $(CFG_X16) $(SRCDIR_KERNAL) $(GEN_KERNAL) $(DIR_X16)/basic.seg_1 $(DIR_X16)/BASIC_1_combined.vs $(DIR_X16)/BASIC_1_combined.sym: @mkdir -p $(DIR_X16) @rm -f $@* $(DIR_X16)/basic.seg_1 $(DIR_X16)/BASIC_1* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s BASIC_1 -i BASIC_1-mega65 -o basic.seg_1 -d $(DIR_X16) -l a000 -h bfff $(CFG_X16) $(SRCDIR_BASIC) $(GEN_BASIC) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s BASIC_1 -i BASIC_1-x16 -o basic.seg_1 -d $(DIR_X16) -l a000 -h bfff $(CFG_X16) $(SRCDIR_BASIC) $(GEN_BASIC) $(DIR_X16)/kernal.seg_1 $(DIR_X16)/KERNAL_1_combined.vs $(DIR_X16)/KERNAL_1_combined.sym: @mkdir -p $(DIR_X16) @rm -f $@* $(DIR_X16)/kernal.seg_1 $(DIR_X16)/KERNAL_1* - @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s KERNAL_1 -i KERNAL_1-mega65 -o kernal.seg_1 -d $(DIR_X16) -l a000 -h bfff $(CFG_X16) $(SRCDIR_KERNAL) $(GEN_KERNAL) + @$(TOOL_BUILD_SEGMENT) -a ../../$(TOOL_ASSEMBLER) -r X16 -s KERNAL_1 -i KERNAL_1-x16 -o kernal.seg_1 -d $(DIR_X16) -l a000 -h bfff $(CFG_X16) $(SRCDIR_KERNAL) $(GEN_KERNAL) # Rules - BASIC and KERNAL diff --git a/STATUS.md b/STATUS.md index de1ef7a8..e8013b30 100644 --- a/STATUS.md +++ b/STATUS.md @@ -98,7 +98,7 @@ The following ROM features are currently missing: | Driver | Status | Remarks | | :----------------: | :------: | :------------------------------------------------: | | standard | DONE | | -| JiffyDOS | DONE | | +| JiffyDOS | PARTIAL | LOAD needs improvement for better performance | | DolphinDOS | DONE | | | CIA burst mod | NOT DONE | | | Mega65 burst | NOT DONE | | diff --git a/c64/basic/commands/cmd_load.s b/c64/basic/commands/cmd_load.s index 17f1fee7..756da06b 100644 --- a/c64/basic/commands/cmd_load.s +++ b/c64/basic/commands/cmd_load.s @@ -20,11 +20,33 @@ cmd_load: lda #$00 sta FNLEN - // Without tape support, LOAD must have a filename - // (This also skips any leading spaces) + // Check for the file name jsr basic_end_of_statement_check bcc !+ + +#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO + + // No file name given, just load the first file from tape + + ldx #$00 + stx SA // secondary address +#if CONFIG_TAPE_NORMAL + inx // 1 - for normal tape format +#else + ldx #$07 // 7 - for turbo tape format +#endif + stx FA // device number + bne cmd_load_got_secondaryaddress // branch always + +#else + + // Without tape support, LOAD must have a filename + // (This also skips any leading spaces) + jmp do_MISSING_FILENAME_error + +#endif + !: jsr basic_fetch_and_consume_character cmp #$22 diff --git a/c64/kernal/iec_fast/jiffydos_load.s b/c64/kernal/iec_fast/jiffydos_load.s index 3a4f1fed..f8487e42 100644 --- a/c64/kernal/iec_fast/jiffydos_load.s +++ b/c64/kernal/iec_fast/jiffydos_load.s @@ -19,80 +19,7 @@ jiffydos_load: -/* XXX NEW version, not yet finished - - // - // JiffyDOS protocol support for IEC - optimized load loop - // - // Based on description from https://github.com/mist64/cbmbus_doc - // - - // First we need to switch the device to optimized LOAD protocol, - // by making it talk on channel 1 instead of 0 - - jsr UNTLK - - lda FA - jsr TALK - // XXX bcs load_iec_err - - lda #$61 // ask to talk on channel 1 - sta TBTCNT - jsr iec_tx_command - // XXX bcs load_iec_error - // XXX if not on JiffyDOS protoccol, report error - - // Timing is critical, do not allow interrupts - sei - -#if CONFIG_IEC_JIFFYDOS_BLANK - - // 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 - -#else - - // Store previous sprite status in temporary variable - jsr jiffydos_prepare - sta TBTCNT - -#endif - - // FALLTROUGH - -jiffydos_load_mode_escape: - - // We are now in escape mode - release DATA so that we can read it - jsr iec_release_clk_data // XXX maybe release just data? - - // Wait till device tells us whether this is EOI/error - jsr iec_wait_for_clk_release - - // Check DATA line - if pulled, there is more data - bit CIA2_PRA - bpl jiffydos_load_mode_receive - - // XXX check for error - - - -jiffydos_load_mode_receive: - - - // Preserve 3 lowest bits of CIA2_PRA XXX deduplicate this - - lda CIA2_PRA - and #%00000111 - sta C3PO - - // XXX read data - -*/ - + // XXX implement JiffyDOS optimized LOAD protocol, this one is ineffective // Timing is critical, do not allow interrupts