diff --git a/demos/second/part08_gorilla/Makefile b/demos/second/part08_gorilla/Makefile index 2d269648..047fa93d 100644 --- a/demos/second/part08_gorilla/Makefile +++ b/demos/second/part08_gorilla/Makefile @@ -17,7 +17,7 @@ GORILLA: gorilla.o gorilla.o: gorilla.s \ ../zx02_optim.s \ ../hgr_copy_fast.s \ - tv_effect.s \ + tv_effect.s horiz_scroll_simple.s \ ../zp.inc ../hardware.inc ../qload.inc \ audio/a_pboy.btc.zx02 \ graphics/mntscrl3.hgr.zx02 diff --git a/demos/second/part08_gorilla/gorilla.s b/demos/second/part08_gorilla/gorilla.s index 556ca544..1d858485 100644 --- a/demos/second/part08_gorilla/gorilla.s +++ b/demos/second/part08_gorilla/gorilla.s @@ -50,18 +50,33 @@ gorilla_start: sta COUNT sta DRAW_PAGE - lda #$60 - jsr hgr_copy + ;======================= + ; scroll in from right + ;======================= - bit PAGE1 + bit PAGE1 ; draw on visible page + ; flipping while scrolling is hard + + jsr horiz_scroll_left + +; lda #$60 +; jsr hgr_copy + +; bit PAGE1 + + + ;============================== + ; todo, possibly flash at end? + ;============================== gorilla_wait: lda #29 jsr wait_for_pattern bcc gorilla_wait - - ; TODO: TV_shutoff effect + ;====================== + ; TV_shutoff effect + ;====================== ; lda #0 ; jsr hgr_page1_clearscreen @@ -110,15 +125,17 @@ gorilla_done: rts -.align $100 +;.align $100 .include "../wait_keypress.s" ; .include "../zx02_optim.s" ; .include "../hgr_table.s" .include "../hgr_clear_screen.s" .include "../hgr_copy_fast.s" + .include "../hgr_page_flip.s" .include "tv_effect.s" .include "../irq_wait.s" + .include "horiz_scroll_simple.s" gorilla_data: .incbin "graphics/mntscrl3.hgr.zx02" diff --git a/demos/second/part08_gorilla/horiz_scroll_simple.s b/demos/second/part08_gorilla/horiz_scroll_simple.s new file mode 100644 index 00000000..4d92ee40 --- /dev/null +++ b/demos/second/part08_gorilla/horiz_scroll_simple.s @@ -0,0 +1,99 @@ + ; no page flip currently, that's hard + + ; scrolls two at a time to preserve colors + +horiz_scroll_left: + +scroll_left_loop: + + lda #0 + sta COUNT + +scroll_left_outer_outer_loop: + + ldx #191 ; end is 191 + +scroll_left_outer_loop: + + ; high + + lda hposn_high,X + clc + adc DRAW_PAGE + sta hsl_smc1+2 ; SMC1 = $2000+2 + sta hsl_smc2+2 ; SMC2 = $2000 + sta hsl_smc4+2 ; SMC4 = $2000 + sta hsl_smc6+2 ; SMC6 = $2000 + + ora #$40 ; convert to $6000 range + sta hsl_smc3+2 ; SMC3 = $6000+COUNT + sta hsl_smc5+2 ; SMC5 = $6000+COUNT+1 + + ;========================= + ; low + + lda hposn_low,X + sta hsl_smc2+1 ; SMC2 = $2000 + sta hsl_smc4+1 ; SMC4 = $2000 + sta hsl_smc6+1 ; SMC6 = $2000 + + sta hsl_smc1+1 ; SMC1 = $2000+2 + inc hsl_smc1+1 + inc hsl_smc1+1 + + clc + adc COUNT + + sta hsl_smc3+1 ; SMC3 = $6000+COUNT + + sta hsl_smc5+1 ; SMC5 = $6000+COUNT+1 + inc hsl_smc5+1 + + ldy #0 +scroll_left_inner_loop: + +hsl_smc1: + lda $2000+2,Y +hsl_smc2: + sta $2000,Y + + iny + cpy #38 + bne scroll_left_inner_loop + + ; get new data to scroll in + +hsl_smc3: + lda $6000 ; 6000+COUNT + +hsl_smc4: + sta $2000,Y ; Y=38 + + iny + +hsl_smc5: + lda $6000+1 ; 6000+COUNT+1 + +hsl_smc6: + sta $2000,Y ; Y=39 + + + + dex + cpx #$FF ; end at top of screen + + bne scroll_left_outer_loop + +; jsr hgr_page_flip + + inc COUNT + inc COUNT + lda COUNT + cmp #40 + bne scroll_left_outer_outer_loop + + rts + + + +