From 816edd964a3c7590228e999505b17d2ebe99b2e3 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 20 Dec 2018 11:40:56 -0500 Subject: [PATCH] xmas2018: get colors right on scroll --- xmas_2018/merry.s | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/xmas_2018/merry.s b/xmas_2018/merry.s index 5934a963..c56dfd40 100644 --- a/xmas_2018/merry.s +++ b/xmas_2018/merry.s @@ -312,7 +312,8 @@ scroll_done: ; increment and loop: 7 ; 5 return ; - ; total = (93*40)+7=3727 + ; original total = (93*40)+7=3727 + ; hgr_scroll_line: ldy #0 ; 2 @@ -328,7 +329,21 @@ hgr_scroll_line_loop: dey ; restore Y ; 2 ;============ ; 20 +get_offpage_byte: + cpy #39 ; 2 + bne not_thirtynine ; 3 + sty TEMPY ; 3 + ldy #0 ; 2 + lda (INL),Y ; 5 + sta NEXT ; 3 + ldy TEMPY ; 3 +not_thirtynine: + ;=================== + ; usually: 5 + + ; if in bit 2 or 6 of horiz scroll, shift the color bit over + ; makes some color flicker, is there a better way? high_bit: lda COUNTL ; 3 cmp #2 ; 2 @@ -348,18 +363,8 @@ done_high_bit: ;=================== ; worst: 22 -get_offpage_byte: - cpy #39 ; 2 - bne not_thirtynine ; 3 - sty TEMPY ; 3 - ldy #0 ; 2 - lda (INL),Y ; 5 - sta NEXT ; 3 - ldy TEMPY ; 3 - ;=================== - ; usually: 5 -not_thirtynine: +prepare_bits: ; get right byte, bottom 2 bits, shifted left to be in 6+5 lda NEXT ; 3 and #$3 ; 2 @@ -372,6 +377,7 @@ not_thirtynine: ;========== ; 18 +output_new: ; get current, mask off bottom 2 bits (no longer needed) ; then OR in the saved high (color) bit as well as NEXT bits lda CURRENT ; 3