riven: add fade in

This commit is contained in:
Vince Weaver 2024-07-05 12:16:27 -04:00
parent cf9d73db5c
commit 18dc1366db
6 changed files with 215 additions and 1 deletions

View File

@ -364,6 +364,7 @@ qload.inc: generate_common QLOAD
./generate_common -a 0x1600 -s clear_bottom qload.lst >> qload.inc
./generate_common -a 0x1600 -s set_normal qload.lst >> qload.inc
./generate_common -a 0x1600 -s force_uppercase qload.lst >> qload.inc
./generate_common -a 0x1600 -s gr_offsets qload.lst >> qload.inc
submit: riven_disk00.dsk riven_disk01.dsk \
riven_disk39.dsk \

View File

@ -29,7 +29,7 @@ CAPTURED: captured.o
ld65 -o CAPTURED captured.o -C $(LINKER_SCRIPTS)/apple2_4000.inc
captured.o: captured.s \
flip_pages.s draw_scene.s \
flip_pages.s draw_scene.s gr_fade.s \
../zp.inc ../hardware.inc ../qload.inc \
graphics_captured/captured_graphics.inc \
audio/capture.btc.zx02

View File

@ -79,6 +79,23 @@ riven_logo_loop:
bit KEYRESET
;======================
; fade in
;======================
; load bg
lda #<captured_bg
sta ZX0_src
lda #>captured_bg
sta ZX0_src+1
lda #$0c ; decompress to $c00
jsr full_decomp
jsr fade_in
;===============================
;===============================
; captured!
@ -195,6 +212,8 @@ done_play_audio:
.include "draw_scene.s"
.include "../audio.s"
.include "gr_fade.s"
captured_graphics:
.include "graphics_captured/captured_graphics.inc"

View File

@ -1,6 +1,7 @@
;============================
; flip pages
;============================
page_flip:
flip_pages:
lda DRAW_PAGE ; 3
beq was_page1 ; 2/3

View File

@ -0,0 +1,192 @@
.if 0
;============================================
; gr, "fade" out. Badly fake a pallette fade
;============================================
; Image to fade out should be in $C00
fade_out:
lda #<fade_lookup
sta GBASL
lda #>fade_lookup
sta GBASH
jsr gr_fade
jsr page_flip
lda #200
jsr WAIT
lda #<(fade_lookup+16)
sta GBASL
lda #>(fade_lookup+16)
sta GBASH
jsr gr_fade
jsr page_flip
lda #200
jsr WAIT
lda #<(fade_lookup+32)
sta GBASL
lda #>(fade_lookup+32)
sta GBASH
jsr gr_fade
jsr page_flip
lda #200
jsr WAIT
lda #<(fade_lookup+48)
sta GBASL
lda #>(fade_lookup+48)
sta GBASH
jsr gr_fade
jsr page_flip
lda #200
jsr WAIT
rts
.endif
;===========================================
; gr, "fade" in. Badly fake a pallette fade
;===========================================
; Image to fade in should be in $C00
fade_in:
lda #<(fade_lookup+48)
sta GBASL
lda #>(fade_lookup+48)
sta GBASH
jsr gr_fade
jsr page_flip
lda #200
jsr WAIT
lda #<(fade_lookup+32)
sta GBASL
lda #>(fade_lookup+32)
sta GBASH
jsr gr_fade
jsr page_flip
lda #200
jsr WAIT
lda #<(fade_lookup+16)
sta GBASL
lda #>(fade_lookup+16)
sta GBASH
jsr gr_fade
jsr page_flip
lda #200
jsr WAIT
lda #<(fade_lookup+0)
sta GBASL
lda #>(fade_lookup+0)
sta GBASH
jsr gr_fade
jsr page_flip
lda #200
jsr WAIT
rts
;================================================
; Fade in/out lowres graphics
; GR image should be in $C00
; pointer to fade table in GBASL/GBASH
gr_fade:
ldx #0 ; set ypos to zero ; 2
gr_fade_loop:
lda gr_offsets,X ; lookup low byte for line addr ; 4+
sta gr_fade_line1+1 ; out and in are the same ; 4
sta gr_fade_line2+1 ; 4
lda gr_offsets+1,X ; lookup high byte for line addr ; 4+
clc ; 2
adc DRAW_PAGE ; 3
sta gr_fade_line2+2 ; 4
lda gr_offsets+1,X ; lookup high byte for line addr ; 4+
adc #$8 ; for now, fixed 0xc ; 2
sta gr_fade_line1+2 ; 4
ldy #0 ; set xpos counter to 0 ; 2
; cpx #$8 ; don't want to copy bottom 4*40 ; 2
; bcs gr_fade_above4 ; 2nt/3
gr_fade_below4:
ldy #119 ; for early ones, copy 120 bytes ; 2
bcc gr_fade_line1 ; ; 3
gr_fade_above4: ; for last four, just copy 80 bytes
ldy #79 ; 2
gr_fade_line1:
lda $ffff,Y ; load a byte (self modified) ; 4+
pha
sty TEMPY ; save Y
; do high nibble
and #$f0
lsr
lsr
lsr
lsr
tay
lda (GBASL),Y
and #$f0
sta TEMP
; do low nibble
pla
and #$0f
tay
lda (GBASL),Y
and #$0f
ora TEMP
ldy TEMPY ; restore Y
gr_fade_line2:
sta $ffff,Y ; store a byte (self modified) ; 5
dey ; decrement pointer ; 2
bpl gr_fade_line1 ; ; 2nt/3
gr_fade_line_done:
inx ; increment ypos value ; 2
inx ; twice, as address is 2 bytes ; 2
cpx #16 ; there are 8*2 of them ; 2
bne gr_fade_loop ; if not, loop ; 3
rts ; 6
; Fade paramaters
fade_lookup:
.byte $00,$11,$22,$33,$44,$55,$66,$77, $88,$99,$aa,$bb,$cc,$dd,$ee,$ff
.byte $00,$00,$00,$22,$00,$00,$22,$55, $55,$88,$55,$33,$44,$88,$44,$77
.byte $00,$00,$00,$00,$00,$00,$55,$00, $00,$00,$00,$00,$88,$00,$00,$55
.byte $00,$00,$00,$00,$00,$00,$00,$00, $00,$00,$00,$00,$00,$00,$00,$00

View File

@ -114,6 +114,7 @@ NUMBER_HIGH = $A4
MAGLEV_FLIP_DIRECTION = $B0
BEACH_ANIMALS_SEEN = $B1
TEMPY = $F8
TEMP = $F9
MASKL = $FA
MASKH = $FB