From 58b21e3fa49d6109707bf3bbe1c99e4528f94d63 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 31 Dec 2019 17:31:25 +0100 Subject: [PATCH] more work towards IEC burst support --- CONFIG.md | 2 +- STATUS.md | 3 +- c64/kernal/iec/iec_cmd_open.s | 13 ++++---- c64/kernal/iec/load_iec.s | 7 ++-- c64/kernal/iec/save_iec.s | 7 ++-- c64/kernal/iec_fast/burst_cia1_advertise.s | 33 +++++++++++++++++++ c64/kernal/iec_fast/burst_cia1_detect.s | 31 ----------------- ...t_cia2_detect.s => burst_cia2_advertise.s} | 29 ++++++---------- c64/kernal/iec_fast/burst_soft_advertise.s | 28 ++++++++++++++++ c64/kernal/iec_fast/burst_soft_detect.s | 27 --------------- c64/kernal/iec_fast/dolphindos_detect.s | 7 ---- 11 files changed, 88 insertions(+), 99 deletions(-) create mode 100644 c64/kernal/iec_fast/burst_cia1_advertise.s delete mode 100644 c64/kernal/iec_fast/burst_cia1_detect.s rename c64/kernal/iec_fast/{burst_cia2_detect.s => burst_cia2_advertise.s} (58%) create mode 100644 c64/kernal/iec_fast/burst_soft_advertise.s delete mode 100644 c64/kernal/iec_fast/burst_soft_detect.s diff --git a/CONFIG.md b/CONFIG.md index 90d9b076..53ad6421 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -129,7 +129,7 @@ Needs about 430 bytes in KERNAL segment. If unsure - enable. ### `CONFIG_IEC_JIFFYDOS_BLANK` -Causes screen blanking during iffyDOS file loading to increase performance. +Causes screen blanking during JiffyDOS file loading to increase performance. ### `CONFIG_TAPE_NORMAL` diff --git a/STATUS.md b/STATUS.md index 9787b0a2..1697e3ef 100644 --- a/STATUS.md +++ b/STATUS.md @@ -8,8 +8,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8 * joystick can be used to move text cursor * pre-defined function keys -* JiffyDOS protocol support -* partial DolphinDOS protocol support +* JiffyDOS and DolphinDOS protocols support * DOS wedge (direct mode only) - `@`, `@`, `@$`, `@$`, `@` * turbo tape load support (as device 7, or using `←L`), up to 250 blocks (can store bytes under I/O) diff --git a/c64/kernal/iec/iec_cmd_open.s b/c64/kernal/iec/iec_cmd_open.s index 835ed317..78d5364b 100644 --- a/c64/kernal/iec/iec_cmd_open.s +++ b/c64/kernal/iec/iec_cmd_open.s @@ -17,18 +17,19 @@ iec_cmd_open: // similar to TKSA, but without turnaround !: ora #$F0 -#if CONFIG_IEC_DOLPHINDOS || CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT +#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT + pha + jsr burst_advertise + pla +#endif + +#if CONFIG_IEC_DOLPHINDOS sta TBTCNT jsr iec_tx_command bcs !+ // branch if error -#if CONFIG_IEC_DOLPHINDOS jsr dolphindos_detect -#endif -#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT - jsr burst_detect -#endif jmp iec_tx_command_finalize diff --git a/c64/kernal/iec/load_iec.s b/c64/kernal/iec/load_iec.s index fabe54be..65db83b3 100644 --- a/c64/kernal/iec/load_iec.s +++ b/c64/kernal/iec/load_iec.s @@ -57,6 +57,10 @@ load_iec: jsr TALK bcs load_iec_error +#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT + jsr burst_advertise +#endif + lda #$60 // open channel / data (p3) , required according to p13 sta TBTCNT jsr iec_tx_command @@ -65,9 +69,6 @@ load_iec: #if CONFIG_IEC_DOLPHINDOS jsr dolphindos_detect #endif -#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT - jsr burst_detect -#endif // We are currently talker, so do the IEC turn around so that we // are the listener (p16) diff --git a/c64/kernal/iec/save_iec.s b/c64/kernal/iec/save_iec.s index d09e08a7..03923d00 100644 --- a/c64/kernal/iec/save_iec.s +++ b/c64/kernal/iec/save_iec.s @@ -39,6 +39,10 @@ save_iec: jsr LISTEN bcs save_iec_dev_not_found +#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT + jsr burst_advertise +#endif + lda #$61 // open channel / data (p3) , required according to p13 sta TBTCNT jsr iec_tx_command @@ -47,9 +51,6 @@ save_iec: #if CONFIG_IEC_DOLPHINDOS jsr dolphindos_detect #endif -#if CONFIG_IEC_BURST_CIA1 || CONFIG_IEC_BURST_CIA2 || CONFIG_IEC_BURST_SOFT - jsr burst_detect -#endif // Save start address lda STAL+0 diff --git a/c64/kernal/iec_fast/burst_cia1_advertise.s b/c64/kernal/iec_fast/burst_cia1_advertise.s new file mode 100644 index 00000000..e233c3d6 --- /dev/null +++ b/c64/kernal/iec_fast/burst_cia1_advertise.s @@ -0,0 +1,33 @@ + +// +// Advertise burst IEC protocol support to the receiver +// + +// +// Based on idea by Pasi 'Albert' Ojala and description from +// https://sites.google.com/site/h2obsession/CBM/C128/fast-serial-for-uiec +// + + +#if CONFIG_IEC_BURST_CIA1 + + +burst_advertise: + +#if CONFIG_IEC_JIFFYDOS + + // Skip if other protocol (only JiffyDOS is possible at this moment) already detected + lda IECPROTO + bmi !+ + bne burst_advertise_done +!: +#endif + + panic #$FF // XXX implement this + +burst_advertise_done: + + rts + + +#endif diff --git a/c64/kernal/iec_fast/burst_cia1_detect.s b/c64/kernal/iec_fast/burst_cia1_detect.s deleted file mode 100644 index cf36e58b..00000000 --- a/c64/kernal/iec_fast/burst_cia1_detect.s +++ /dev/null @@ -1,31 +0,0 @@ - -// -// Helper routine for burst IEC protocol support -// - -// -// Based on idea by Pasi 'Albert' Ojala -// - - -#if CONFIG_IEC_BURST_CIA1 - - -burst_detect: - -#if CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS - - lda IECPROTO - bmi !+ - bne burst_detect_fail // skip if other protocol already detected -!: -#endif - - panic #$FF // XXX implement this - -burst_detect_fail: - - rts - - -#endif diff --git a/c64/kernal/iec_fast/burst_cia2_detect.s b/c64/kernal/iec_fast/burst_cia2_advertise.s similarity index 58% rename from c64/kernal/iec_fast/burst_cia2_detect.s rename to c64/kernal/iec_fast/burst_cia2_advertise.s index 19fba610..3081f000 100644 --- a/c64/kernal/iec_fast/burst_cia2_detect.s +++ b/c64/kernal/iec_fast/burst_cia2_advertise.s @@ -1,29 +1,30 @@ // -// Helper routine for burst IEC protocol support +// Advertise burst IEC protocol support to the receiver // // -// Based on idea by Pasi 'Albert' Ojala +// Based on idea by Pasi 'Albert' Ojala and description from +// https://sites.google.com/site/h2obsession/CBM/C128/fast-serial-for-uiec // #if CONFIG_IEC_BURST_CIA2 -burst_detect: +burst_advertise: -#if CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS +#if CONFIG_IEC_JIFFYDOS + // Skip if other protocol (only JiffyDOS is possible at this moment) already detected lda IECPROTO bmi !+ - bne burst_detect_fail // skip if other protocol already detected + bne burst_advertise_done !: #endif - // For extra safety, do it on disabled interupts - php - sei + // Make sure this is not done under ATN + jst iec_release_atn // Set the clock rate to the fastest possible ldy #$01 @@ -46,19 +47,9 @@ burst_detect: bit CIA2_ICR beq !- - // Now see if we get any byte back - - lda CIA2_SDR // XXX we do not need a value, we need to know if it was received - - - panic #$00 // XXX finish this routine - - - plp - // FALLTROUGH -burst_detect_fail: +burst_advertise_done: rts diff --git a/c64/kernal/iec_fast/burst_soft_advertise.s b/c64/kernal/iec_fast/burst_soft_advertise.s new file mode 100644 index 00000000..90625451 --- /dev/null +++ b/c64/kernal/iec_fast/burst_soft_advertise.s @@ -0,0 +1,28 @@ + +// +// Advertise burst IEC protocol support to the receiver +// + + +#if CONFIG_IEC_BURST_SOFT + + +burst_advertise: + +#if CONFIG_IEC_JIFFYDOS + + // Skip if other protocol (only JiffyDOS is possible at this moment) already detected + lda IECPROTO + bmi !+ + bne burst_advertise_done: +!: +#endif + + panic #$FF // XXX implement this + +burst_advertise_done: + + rts + + +#endif diff --git a/c64/kernal/iec_fast/burst_soft_detect.s b/c64/kernal/iec_fast/burst_soft_detect.s deleted file mode 100644 index cd31a19e..00000000 --- a/c64/kernal/iec_fast/burst_soft_detect.s +++ /dev/null @@ -1,27 +0,0 @@ - -// -// Helper routine for burst IEC protocol support -// - - -#if CONFIG_IEC_BURST_SOFT - - -burst_detect: - -#if CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS - - lda IECPROTO - bmi !+ - bne burst_detect_fail // skip if other protocol already detected -!: -#endif - - panic #$FF // XXX implement this - -burst_detect_fail: - - rts - - -#endif diff --git a/c64/kernal/iec_fast/dolphindos_detect.s b/c64/kernal/iec_fast/dolphindos_detect.s index 3f622482..0975785c 100644 --- a/c64/kernal/iec_fast/dolphindos_detect.s +++ b/c64/kernal/iec_fast/dolphindos_detect.s @@ -20,13 +20,6 @@ dolphindos_detect: -#if CONFIG_IEC_JIFFYDOS - - lda IECPROTO - bne dolphindos_detect_fail // skip if other protocol already detected - -#endif - // Make sure the port settings are correct lda #$7F