riven: work on captured animation

This commit is contained in:
Vince Weaver 2024-07-05 01:23:30 -04:00
parent 08a4ef6be2
commit 1875f7eace
19 changed files with 305 additions and 51 deletions

View File

@ -364,3 +364,10 @@ 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
submit: riven_disk00.dsk riven_disk01.dsk \
riven_disk39.dsk \
riven_disk40.dsk riven_disk41.dsk riven_disk43.dsk
zip riven_hgr.zip riven_disk00.dsk riven_disk01.dsk \
riven_disk39.dsk \
riven_disk40.dsk riven_disk41.dsk riven_disk43.dsk

View File

@ -1,3 +1,7 @@
move flip_pages.s into QLOAD?
+ disk handling code
+ on every load check to make sure disk hasn't been swapped?
can put expected disk number at beginning of each thing

View File

@ -29,6 +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 \
../zp.inc ../hardware.inc ../qload.inc \
graphics_captured/captured_graphics.inc
ca65 -o captured.o captured.s -l captured.lst

View File

@ -8,7 +8,10 @@
.include "disk00_defines.inc"
NUM_SCENES = 4
RIVEN_FRAMES = 4
NUM_OVERLAYS = 6
captured_start:
@ -19,7 +22,7 @@ captured_start:
bit SET_GR
bit HIRES
bit TEXTGR
bit FULLGR
bit PAGE1
lda #0
@ -29,18 +32,18 @@ captured_start:
;===============================
;===============================
; main loop
; Riven Logo Loop
;===============================
;===============================
riven_loop:
riven_logo_loop:
; decompress graphics
ldx SCENE_COUNT
lda frames_l,X
lda riven_l,X
sta ZX0_src
lda frames_h,X
lda riven_h,X
sta ZX0_src+1
lda #$20 ; hgr page1
@ -53,9 +56,60 @@ riven_loop:
inc SCENE_COUNT
lda SCENE_COUNT
cmp #NUM_SCENES
cmp #RIVEN_FRAMES
bne riven_loop
bne riven_logo_loop
;===================
; Setup lo-res graphics
;===================
bit SET_GR
bit LORES
bit FULLGR
bit PAGE1
lda #0
sta SCENE_COUNT
lda #4
sta DRAW_PAGE
bit KEYRESET
;===============================
;===============================
; captured!
;===============================
;===============================
lda #0
sta WHICH_OVERLAY
captured_loop:
jsr draw_scene
jsr flip_pages
inc WHICH_OVERLAY
lda WHICH_OVERLAY
cmp #NUM_OVERLAYS
beq done_captured
ldx #2
jsr wait_a_bit
jmp captured_loop
done_captured:
;======================
; done, move on to next
;======================
bit KEYRESET
@ -67,19 +121,41 @@ riven_loop:
rts
.include "flip_pages.s"
.include "draw_scene.s"
captured_graphics:
.include "graphics_captured/captured_graphics.inc"
frames_l:
riven_l:
.byte <riven01_zx02
.byte <riven02_zx02
.byte <riven03_zx02
.byte <riven04_zx02
frames_h:
riven_h:
.byte >riven01_zx02
.byte >riven02_zx02
.byte >riven03_zx02
.byte >riven04_zx02
frames_l:
.byte <trap_overlay0
.byte <trap_overlay1
.byte <trap_overlay2
.byte <trap_overlay3
.byte <trap_overlay4
.byte <trap_overlay5
frames_h:
.byte >trap_overlay0
.byte >trap_overlay1
.byte >trap_overlay2
.byte >trap_overlay3
.byte >trap_overlay4
.byte >trap_overlay5

View File

@ -0,0 +1,139 @@
;===============================
;===============================
; draw_scene
;===============================
;===============================
draw_scene:
;===============================
; decompress background
;===============================
before:
; ldx SCENE_COUNT
; lda frames_l,X
lda #<captured_bg
sta ZX0_src
; lda frames_h,X
lda #>captured_bg
sta ZX0_src+1
clc
lda DRAW_PAGE
adc #$4
jsr full_decomp
after:
; fallthrough
;===============================
; do overlay
;===============================
; INL/H $c00 = overlay
; OUTL/H = gr location
do_overlay:
load_overlay:
; load overlay to $C00
ldx WHICH_OVERLAY
lda frames_l,X
sta ZX0_src
lda frames_h,X
sta ZX0_src+1
lda #$0c
jsr full_decomp
done_load_overlay:
;====================
; mask with overlay
;====================
lda DRAW_PAGE
clc
adc #$4
sta OUTH
lda #$0c
sta INH
lda #0
sta OUTL
sta INL
do_overlay_outer:
ldy #0
do_overlay_inner:
lda (INL),Y
; 3 options, $AA, $AX, $XA, $XX
cmp #$aa
beq mask_full
and #$0f
cmp #$0a
beq mask_bottom
lda (INL),Y
and #$f0
cmp #$a0
beq mask_top
bne mask_none
mask_top:
lda #$0f
bne mask_save ; bra
mask_bottom:
lda #$f0
bne mask_save ; bra
mask_full:
lda #$00
beq mask_save ; bra
mask_none:
lda #$ff
mask_save:
sta MASK
lda (INL),Y
and MASK
sta TEMP
lda MASK
eor #$ff
and (OUTL),Y
ora TEMP
sta (OUTL),Y
skip_write:
dey
bne do_overlay_inner
inc OUTH
inc INH
lda INH
cmp #$10
bne do_overlay_inner
rts

View File

@ -0,0 +1,17 @@
;============================
; flip pages
;============================
flip_pages:
lda DRAW_PAGE ; 3
beq was_page1 ; 2/3
was_page2:
bit PAGE2 ; 4
lda #$0 ; 2
beq done_pageflip ; 2/3
was_page1:
bit PAGE1 ; 4
lda #$4 ; 2
done_pageflip:
sta DRAW_PAGE ; 3
rts

View File

@ -2,6 +2,7 @@ include ../../../../Makefile.inc
ZX02 = ~/research/6502_compression/zx02.git/build/zx02
PNG_TO_HGR = ../../../../utils/hgr-utils/png2hgr
PNG2GR = ../../../../utils/gr-utils/png2gr
all: captured_graphics.inc
@ -9,11 +10,35 @@ captured_graphics.inc: \
riven01_iipix.hgr.zx02 \
riven02_iipix.hgr.zx02 \
riven03_iipix.hgr.zx02 \
riven04_iipix.hgr.zx02
riven04_iipix.hgr.zx02 \
captured_bg.gr.zx02 \
trap_overlay0.gr.zx02 \
trap_overlay1.gr.zx02 \
trap_overlay2.gr.zx02 \
trap_overlay3.gr.zx02 \
trap_overlay4.gr.zx02 \
trap_overlay5.gr.zx02
echo "riven01_zx02: .incbin \"riven01_iipix.hgr.zx02\"" > captured_graphics.inc
echo "riven02_zx02: .incbin \"riven02_iipix.hgr.zx02\"" >> captured_graphics.inc
echo "riven03_zx02: .incbin \"riven03_iipix.hgr.zx02\"" >> captured_graphics.inc
echo "riven04_zx02: .incbin \"riven04_iipix.hgr.zx02\"" >> captured_graphics.inc
echo "captured_bg: .incbin \"captured_bg.gr.zx02\"" >> captured_graphics.inc
echo "trap_overlay0: .incbin \"trap_overlay0.gr.zx02\"" >> captured_graphics.inc
echo "trap_overlay1: .incbin \"trap_overlay1.gr.zx02\"" >> captured_graphics.inc
echo "trap_overlay2: .incbin \"trap_overlay2.gr.zx02\"" >> captured_graphics.inc
echo "trap_overlay3: .incbin \"trap_overlay3.gr.zx02\"" >> captured_graphics.inc
echo "trap_overlay4: .incbin \"trap_overlay4.gr.zx02\"" >> captured_graphics.inc
echo "trap_overlay5: .incbin \"trap_overlay5.gr.zx02\"" >> captured_graphics.inc
####
%.gr: %.png
$(PNG2GR) $< $@
%.gr.zx02: %.gr
$(ZX02) -f $< $@
####

Binary file not shown.

Before

Width:  |  Height:  |  Size: 903 B

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 B

View File

@ -59,6 +59,7 @@ LEVEL_MAGLEV: level_maglev.o
ld65 -o LEVEL_MAGLEV level_maglev.o -C $(LINKER_SCRIPTS)/apple2_4000.inc
level_maglev.o: level_maglev.s \
flip_pages.s \
../zp.inc ../hardware.inc ../qload.inc \
../common_defines.inc disk39_defines.inc \
leveldata_maglev.inc \
@ -71,6 +72,7 @@ MOVIE_MAGLEV_FLIP: movie_maglev_flip.o
ld65 -o MOVIE_MAGLEV_FLIP movie_maglev_flip.o -C $(LINKER_SCRIPTS)/apple2_4000.inc
movie_maglev_flip.o: movie_maglev_flip.s \
flip_pages.s \
../zp.inc ../hardware.inc ../qload.inc \
../common_defines.inc disk39_defines.inc \
movie_maglev_flip/movie_maglev_flip.inc \

View File

@ -0,0 +1,17 @@
;============================
; flip pages
;============================
flip_pages:
lda DRAW_PAGE ; 3
beq was_page1 ; 2/3
was_page2:
bit PAGE2 ; 4
lda #$0 ; 2
beq done_pageflip ; 2/3
was_page1:
bit PAGE1 ; 4
lda #$4 ; 2
done_pageflip:
sta DRAW_PAGE ; 3
rts

View File

@ -431,25 +431,7 @@ skip_write:
rts
;============================
; flip pages
;============================
flip_pages:
lda DRAW_PAGE ; 3
beq was_page1 ; 2/3
was_page2:
bit PAGE2 ; 4
lda #$0 ; 2
beq done_pageflip ; 2/3
was_page1:
bit PAGE1 ; 4
lda #$4 ; 2
done_pageflip:
sta DRAW_PAGE ; 3
rts
.include "flip_pages.s"
;===================================

View File

@ -303,26 +303,7 @@ skip_write:
rts
;============================
; flip pages
;============================
flip_pages:
lda DRAW_PAGE ; 3
beq was_page1 ; 2/3
was_page2:
bit PAGE2 ; 4
lda #$0 ; 2
beq done_pageflip ; 2/3
was_page1:
bit PAGE1 ; 4
lda #$4 ; 2
done_pageflip:
sta DRAW_PAGE ; 3
rts
.include "flip_pages.s"
;===================================

View File

@ -325,7 +325,10 @@ done_setup_sound:
jsr wait_a_bit
.if DISK=00
lda #LOAD_CYAN
; lda #LOAD_CYAN
lda #LOAD_CAPTURED
sta WHICH_LOAD ; assume CYAN opener
lda #0 ; not needed...