From 291b2508907437adef0dd924fccfa7350f4d4626 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 15 Dec 2019 22:03:58 +0100 Subject: [PATCH] scroll-down fix (incomplete, but at least the crash is gone) --- c64/,,config_mega65.s | 4 +-- c64/kernal/screen/screen_grow_logical_line.s | 34 +++++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 61bf255f..62589655 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -118,8 +118,8 @@ #define CONFIG_COLORS_BRAND // #define CONFIG_BANNER_SIMPLE -#define CONFIG_BANNER_FANCY -// #define CONFIG_BANNER_BRAND // do not enable for now, triggers screen editor bug under XEMU +// #define CONFIG_BANNER_FANCY +#define CONFIG_BANNER_BRAND #define CONFIG_SHOW_FEATURES // #define CONFIG_SHOW_PAL_NTSC diff --git a/c64/kernal/screen/screen_grow_logical_line.s b/c64/kernal/screen/screen_grow_logical_line.s index ca7a8c48..d9094d81 100644 --- a/c64/kernal/screen/screen_grow_logical_line.s +++ b/c64/kernal/screen/screen_grow_logical_line.s @@ -12,29 +12,31 @@ screen_grow_logical_line: // If we are on the last physical line of the screen, // Then we need to scroll the screen up jsr screen_scroll_up_if_on_last_line - + + // Count the number of logical lines to scroll down + ldx #$00 + ldy TBLX +!: + iny + cpy #23 + bcs !+ + + lda LDTBL,y + bmi !- + inx + bne !- // branch always +!: + cpx #$00 + beq no_copy_down + // Scroll screen down to make space // As we are scrolling down, we start from the end, - // and work backwards. We can't be as simple and efficient + // and work backwards. We can't be as simple and efficient // here as we are for scrolling up, because we don't know // how much must be scrolled. // Simple solution is to work out how many physical lines // need shifting down, and then move lines at a time after // initialising the pointers to the end area of the screen. - ldx #25-2 - ldy #0 -count_rows_loop: - dex - lda LDTBL,y - bpl !+ - dex -!: iny - cpy TBLX - bne count_rows_loop - - cpx #0 - beq no_copy_down - bmi no_copy_down // Preserve EAL lda EAL+0