From 06acbd819e0e0ce640294e5ded7a6a8964793189 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 1 Nov 2023 20:06:47 -0400 Subject: [PATCH] second: add tv effect for gorilla --- demos/second/part08_gorilla/Makefile | 1 + demos/second/part08_gorilla/gorilla.s | 7 +- demos/second/part08_gorilla/tv_effect.s | 117 ++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 demos/second/part08_gorilla/tv_effect.s diff --git a/demos/second/part08_gorilla/Makefile b/demos/second/part08_gorilla/Makefile index 70ee42f9..d14a23b0 100644 --- a/demos/second/part08_gorilla/Makefile +++ b/demos/second/part08_gorilla/Makefile @@ -17,6 +17,7 @@ GORILLA: gorilla.o gorilla.o: gorilla.s \ ../zx02_optim.s \ ../hgr_copy_fast.s \ + tv_effect.s \ ../zp.inc ../hardware.inc ../qload.inc \ graphics/mntscrl3.hgr.zx02 ca65 -o gorilla.o gorilla.s -l gorilla.lst diff --git a/demos/second/part08_gorilla/gorilla.s b/demos/second/part08_gorilla/gorilla.s index e93a7bc2..2be6f4d8 100644 --- a/demos/second/part08_gorilla/gorilla.s +++ b/demos/second/part08_gorilla/gorilla.s @@ -68,8 +68,10 @@ gorilla_wait: ; TODO: TV_shutoff effect - lda #0 - jsr hgr_page1_clearscreen +; lda #0 +; jsr hgr_page1_clearscreen + + jsr tv_effect gorilla_wait2: lda #30 @@ -89,6 +91,7 @@ gorilla_done: .include "../hgr_clear_screen.s" .include "../hgr_copy_fast.s" + .include "tv_effect.s" .include "../irq_wait.s" gorilla_data: diff --git a/demos/second/part08_gorilla/tv_effect.s b/demos/second/part08_gorilla/tv_effect.s new file mode 100644 index 00000000..a70fc6f5 --- /dev/null +++ b/demos/second/part08_gorilla/tv_effect.s @@ -0,0 +1,117 @@ + + ;=========================== + ; tv turning off effect + ;=========================== +tv_effect: + + ldx #0 + lda #191 + sta COUNT ; count = bottom +compact_loop: + + stx SAVEX ; X = top + + ;======================= + ; zero out bottom line + + ldx COUNT + + lda hposn_low,X + sta GBASL + lda hposn_high,X + sta GBASH + + lda #0 + ldy #39 +compact_inner_loop2: + sta (GBASL),Y + dey + bpl compact_inner_loop2 + + dec COUNT + + ;======================= + ; zero out top line + + ldx SAVEX + +compact_not_even: + + lda hposn_low,X + sta GBASL + lda hposn_high,X + sta GBASH + + lda #0 + ldy #39 +compact_inner_loop: + sta (GBASL),Y + dey + bpl compact_inner_loop + + lda #10 + jsr wait + + inx + cpx #95 + bne compact_loop + + lda #100 + jsr wait + + ;================================= + ; now close it down horizontally + + + ldx #95 + lda hposn_low,X + sta GBASL + lda hposn_high,X + sta GBASH + inx + lda hposn_low,X + sta OUTL + lda hposn_high,X + sta OUTH + + lda #39 + sta COUNT + ldy #0 +zappo_outer_loop: + + ldx #0 +zappo_inner_loop: + lda pixel_pattern_left,X + sta (OUTL),Y + sta (GBASL),Y + tya + pha + + ldy COUNT + lda pixel_pattern_right,X + sta (OUTL),Y + sta (GBASL),Y + pla + tay + + inx + cpx #8 + bne zappo_inner_loop + + lda #75 + jsr wait + + dec COUNT + + iny + cpy #20 + bne zappo_outer_loop + + rts + + +pixel_pattern_left: + .byte $7f,$7e,$7c,$78,$70,$60,$40,$00 + +pixel_pattern_right: + .byte $7F,$3F,$1F,$0F,$07,$03,$01,$00