From 430682d9c7687475418a7a1e321f636387e21964 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 6 Dec 2019 18:42:06 +0100 Subject: [PATCH] common screen visibilityy handling for Turbo Tape and JiffyDOS --- c64/kernal/iec_fast/load_jiffydos.s | 16 +++++----------- c64/kernal/screen/screen_blank.s | 28 ---------------------------- c64/kernal/screen/screen_off.s | 28 ++++++++++++++++++++++++++++ c64/kernal/screen/screen_on.s | 18 ++++++++++++++++++ c64/kernal/tape/tape_common.s | 20 ++++++++++---------- 5 files changed, 61 insertions(+), 49 deletions(-) delete mode 100644 c64/kernal/screen/screen_blank.s create mode 100644 c64/kernal/screen/screen_off.s create mode 100644 c64/kernal/screen/screen_on.s diff --git a/c64/kernal/iec_fast/load_jiffydos.s b/c64/kernal/iec_fast/load_jiffydos.s index c3c2a1b6..f402329f 100644 --- a/c64/kernal/iec_fast/load_jiffydos.s +++ b/c64/kernal/iec_fast/load_jiffydos.s @@ -23,21 +23,15 @@ load_jiffydos: #if CONFIG_IEC_BLANK_SCREEN - // Blank screen to make sure no sprite/badline will interrupt + // Preserve register with screen status (blank/visibe) lda VIC_SCROLY sta TBTCNT - and #($FF - $10) - sta VIC_SCROLY - // Only the next screen is badline-free -!: - lda VIC_SCROLY // wait for lower part of screen - bpl !- -!: - lda VIC_SCROLY // wait for screen start - bmi !- + // 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 @@ -58,7 +52,7 @@ load_jiffydos: load_jiffydos_loop: // Wait until device is ready to send (releases CLK) - jsr iec_wait_for_clk_release // XXX consider inlining this + jsr iec_wait_for_clk_release #if CONFIG_IEC_BLANK_SCREEN diff --git a/c64/kernal/screen/screen_blank.s b/c64/kernal/screen/screen_blank.s deleted file mode 100644 index a0c89883..00000000 --- a/c64/kernal/screen/screen_blank.s +++ /dev/null @@ -1,28 +0,0 @@ - -// -// Helper routines to blank/show screen -// - - -#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO - - -screen_blank: - - lda VIC_SCROLY - and #($FF - $10) - sta VIC_SCROLY - - rts - - -screen_show: - - lda VIC_SCROLY - ora #$10 - sta VIC_SCROLY - - rts - - -#endif diff --git a/c64/kernal/screen/screen_off.s b/c64/kernal/screen/screen_off.s new file mode 100644 index 00000000..cd9a0265 --- /dev/null +++ b/c64/kernal/screen/screen_off.s @@ -0,0 +1,28 @@ + +// +// Helper routine to blank screen +// + + +#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO || (CONFIG_IEC_JIFFYDOS && !CONFIG_MEMORY_MODEL_60K) + + +screen_off: + + lda VIC_SCROLY + and #($FF - $10) + sta VIC_SCROLY + + // To be sure there are no badlines we have to wait till the next screen, + // as the bit is checked by VIC-II at the start of the frame only +!: + lda VIC_SCROLY // wait for lower part of screen + bpl !- +!: + lda VIC_SCROLY // wait for screen start + bmi !- + + rts + + +#endif diff --git a/c64/kernal/screen/screen_on.s b/c64/kernal/screen/screen_on.s new file mode 100644 index 00000000..4742321b --- /dev/null +++ b/c64/kernal/screen/screen_on.s @@ -0,0 +1,18 @@ + +// +// Helper routine to show screen +// + + +#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO + + +screen_on: + + lda VIC_SCROLY + ora #$10 + sta VIC_SCROLY + + rts + +#endif diff --git a/c64/kernal/tape/tape_common.s b/c64/kernal/tape/tape_common.s index 55f43a62..92e4b9d2 100644 --- a/c64/kernal/tape/tape_common.s +++ b/c64/kernal/tape/tape_common.s @@ -58,20 +58,20 @@ tape_motor_on: // store/restore screen color // -tape_screen_show_motor_off: +tape_screen_on_motor_off: jsr tape_motor_off lda COLSTORE sta VIC_EXTCOL - jmp screen_show + jmp screen_on -tape_screen_hide_motor_on: +tape_screen_off_motor_on: lda VIC_EXTCOL sta COLSTORE - jsr screen_blank + jsr screen_off jmp tape_motor_on @@ -124,7 +124,7 @@ tape_wait_play_done: sta CAS1 // set the interlock jsr print_return - jmp tape_screen_hide_motor_on + jmp tape_screen_off_motor_on // @@ -133,7 +133,7 @@ tape_wait_play_done: tape_handle_header: - jsr tape_screen_show_motor_off + jsr tape_screen_on_motor_off // Print FOUND + file name @@ -220,7 +220,7 @@ tape_handle_header_displayed: // Load the file - jsr tape_screen_hide_motor_on + jsr tape_screen_off_motor_on // FALLTROUGH @@ -234,7 +234,7 @@ tape_handle_header_skip: // Skip this file jsr print_return - jsr tape_screen_hide_motor_on + jsr tape_screen_off_motor_on // FALLTROUGH @@ -317,7 +317,7 @@ tape_header_wait_stop: tape_load_success: - jsr tape_screen_show_motor_off + jsr tape_screen_on_motor_off jsr lvs_display_done cli @@ -325,7 +325,7 @@ tape_load_success: tape_load_error: - jsr tape_screen_show_motor_off + jsr tape_screen_on_motor_off cli jmp lvs_load_verify_error