dos33fsprogs/games/riven_hgr/disk39_files/movie_maglev_flip.s

471 lines
7.4 KiB
ArmAsm
Raw Normal View History

2024-05-17 16:39:00 +00:00
; Lo-res movie player of sorts
; by deater (Vince Weaver) <vince@deater.net>
.include "../zp.inc"
.include "../hardware.inc"
.include "../common_defines.inc"
.include "../qload.inc"
.include "disk39_defines.inc"
2024-05-17 16:39:00 +00:00
2024-05-20 22:04:33 +00:00
overlays = $2000
;=================================
; so, movie. each frame is 1/5 second (200ms)
; 25..28 displays initial for 4 frames
; 29..35 displays handle moving (8 frames)
2024-05-22 03:34:55 +00:00
; 36..52 sits there ; 16 frames
2024-05-20 22:04:33 +00:00
; 53..87 rotates
; 88..97 sits there
; 98 control returns to user
; space?
; 188*8=overlays (1.5k)
; 35 rotations * 188 = (7k) not so bad?
;===================
; notes for movie2
; 103..109 = overlay animation
; 110..112 = sit there
; 113..270 = fun animation 157! = 30k???
; 271..285 = handle rotate
; 286..306 = sit there
; timing, want whole thing to finish in 200ms or so
;
; decompressing:
; ade2 = 44,514 cycles
; do_overlay:
; 9c78 = 40,056 cycles
2024-06-16 03:00:55 +00:00
movie_maglev_flip_start:
2024-05-17 16:39:00 +00:00
;===================
; Setup graphics
;===================
bit SET_GR
bit LORES
bit FULLGR
bit PAGE1
lda #0
2024-05-20 22:04:33 +00:00
sta SCENE_COUNT
lda #4
2024-05-17 16:39:00 +00:00
sta DRAW_PAGE
bit KEYRESET
2024-05-20 22:04:33 +00:00
;===============================
;===============================
; set up graphics
;===============================
;===============================
;=============================
; load overlay mask to $c00
;=============================
lda #<overlay_mask_zx02
2024-05-17 16:39:00 +00:00
sta ZX0_src
2024-05-20 22:04:33 +00:00
lda #>overlay_mask_zx02
2024-05-17 16:39:00 +00:00
sta ZX0_src+1
2024-05-20 22:04:33 +00:00
lda #$0c
2024-05-17 16:39:00 +00:00
jsr full_decomp
2024-05-20 22:04:33 +00:00
;=============================
; load overlays to $2000-$2FFF
;=============================
2024-05-18 02:49:43 +00:00
2024-05-23 15:39:42 +00:00
lda #<combined_overlays_zx02
sta ZX0_src
lda #>combined_overlays_zx02
sta ZX0_src+1
lda #$20
jsr full_decomp
.if 0
2024-05-20 22:04:33 +00:00
lda #0
sta WHICH_OVERLAY
2024-05-18 02:49:43 +00:00
2024-05-20 22:04:33 +00:00
load_overlay_loop:
ldx WHICH_OVERLAY
lda overlays_l,X
sta ZX0_src
lda overlays_h,X
sta ZX0_src+1
2024-05-18 02:49:43 +00:00
2024-05-20 22:04:33 +00:00
lda WHICH_OVERLAY
asl
asl
clc
adc #>overlays
2024-05-17 16:39:00 +00:00
2024-05-20 22:04:33 +00:00
jsr full_decomp
2024-05-17 16:39:00 +00:00
2024-05-20 22:04:33 +00:00
inc WHICH_OVERLAY
lda WHICH_OVERLAY
cmp #8
bne load_overlay_loop
2024-05-23 15:39:42 +00:00
.endif
2024-05-22 03:34:55 +00:00
;===============================
;===============================
; initial screen
;===============================
;===============================
2024-05-20 22:04:33 +00:00
lda #0
sta WHICH_OVERLAY
2024-05-17 16:39:00 +00:00
2024-05-22 03:34:55 +00:00
jsr draw_scene
2024-05-17 16:39:00 +00:00
2024-05-22 03:34:55 +00:00
jsr flip_pages
2024-05-17 16:39:00 +00:00
2024-05-22 03:34:55 +00:00
;===============================
; wait 4 frames (800ms)
2024-05-17 16:39:00 +00:00
2024-05-22 03:34:55 +00:00
ldx #16
jsr wait_50xms
2024-05-17 16:39:00 +00:00
2024-05-22 03:34:55 +00:00
;===============================
;===============================
; move the handle
;===============================
;===============================
2024-05-17 16:39:00 +00:00
2024-05-22 03:34:55 +00:00
; could save bytes going backwards?
lda #0
sta WHICH_OVERLAY
move_handle_loop:
jsr draw_scene
jsr flip_pages
; lda KEYPRESS
; bmi done_movie1
2024-05-17 16:39:00 +00:00
2024-05-20 22:04:33 +00:00
inc WHICH_OVERLAY
lda WHICH_OVERLAY
cmp #8
2024-05-22 03:34:55 +00:00
beq done_move_handle
2024-05-20 22:04:33 +00:00
overlay_good:
ldx #2
jsr wait_50xms
2024-05-22 03:34:55 +00:00
jmp move_handle_loop
done_move_handle:
lda #7 ; point to last one
sta WHICH_OVERLAY
;===============================
; wait 16 frames (3.2s?)
ldx #64
jsr wait_50xms
2024-05-22 03:59:01 +00:00
;===============================
;===============================
2024-05-22 05:33:49 +00:00
; play the movie
2024-05-22 03:59:01 +00:00
;===============================
;===============================
lda #1
sta SCENE_COUNT
movie1_loop:
jsr draw_scene
jsr flip_pages
inc SCENE_COUNT
lda SCENE_COUNT
2024-05-23 04:14:15 +00:00
cmp #31
2024-05-22 03:59:01 +00:00
beq done_play_movie1
ldx #2
jsr wait_50xms
jmp movie1_loop
done_play_movie1:
;===============================
; wait 9 frames (1.8s?)
ldx #36
jsr wait_50xms
2024-05-17 16:39:00 +00:00
done_movie1:
bit KEYRESET
2024-05-23 04:43:23 +00:00
;=============================
; return back to game
lda #LOAD_MAGLEV
sta WHICH_LOAD
lda #DIRECTION_E
sta DIRECTION
lda #RIVEN_READY2GO
sta LOCATION
; needed?
lda #1
sta LEVEL_OVER
; jmp movie1_start
2024-05-17 16:39:00 +00:00
rts
2024-05-22 03:34:55 +00:00
;===============================
;===============================
2024-05-22 03:59:01 +00:00
; draw_scene
;===============================
;===============================
2024-05-22 03:34:55 +00:00
draw_scene:
;===============================
; decompress background
;===============================
before:
2024-05-22 03:59:01 +00:00
ldx SCENE_COUNT
lda frames_l,X
2024-05-22 03:34:55 +00:00
sta ZX0_src
2024-05-22 03:59:01 +00:00
lda frames_h,X
2024-05-22 03:34:55 +00:00
sta ZX0_src+1
clc
lda DRAW_PAGE
adc #$4
jsr full_decomp
after:
; jmp do_overlay
; fallthrough
2024-05-18 02:49:43 +00:00
;===============================
2024-05-20 22:04:33 +00:00
; do overlay
;===============================
; INL/H = overlay
; MASKL/H = mask
; OUTL/H = gr location
2024-05-18 02:49:43 +00:00
do_overlay:
2024-05-20 22:04:33 +00:00
lda DRAW_PAGE
clc
adc #$4
sta OUTH
lda WHICH_OVERLAY
asl
asl
clc
adc #$20
sta INH
2024-05-18 02:49:43 +00:00
lda #$c
2024-05-20 22:04:33 +00:00
sta MASKH
lda #0
sta OUTL
sta INL
sta MASKL
2024-05-18 02:49:43 +00:00
do_overlay_outer:
ldy #0
do_overlay_inner:
overlayin_smc:
2024-05-20 22:04:33 +00:00
lda (INL),Y
and (MASKL),Y
sta TEMP
2024-05-18 02:49:43 +00:00
2024-05-20 22:04:33 +00:00
lda (MASKL),Y
eor #$ff
and (OUTL),Y
ora TEMP
sta (OUTL),Y
2024-05-18 02:49:43 +00:00
skip_write:
dey
bne do_overlay_inner
2024-05-20 22:04:33 +00:00
inc OUTH
inc INH
inc MASKH
lda MASKH
2024-05-18 02:49:43 +00:00
cmp #$10
bne do_overlay_inner
rts
2024-05-20 22:04:33 +00:00
2024-05-22 03:34:55 +00:00
;============================
; 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
2024-05-20 22:04:33 +00:00
2024-05-22 03:34:55 +00:00
rts
2024-05-20 22:04:33 +00:00
2024-05-17 16:39:00 +00:00
;===================================
; .include "zx02_optim.s"
2024-06-16 03:00:55 +00:00
.include "movie_maglev_flip/movie_maglev_flip.inc"
2024-05-18 02:49:43 +00:00
; .include "wait.s"
2024-05-22 03:34:55 +00:00
frames_l:
.byte <img025_bg_zx02
.byte <img055_bg_zx02
.byte <img056_bg_zx02
.byte <img057_bg_zx02
.byte <img058_bg_zx02
.byte <img059_bg_zx02
.byte <img060_bg_zx02
.byte <img061_bg_zx02
.byte <img062_bg_zx02
.byte <img063_bg_zx02
.byte <img064_bg_zx02
2024-05-22 05:33:49 +00:00
.byte <img065_bg_zx02
.byte <img066_bg_zx02
.byte <img067_bg_zx02
.byte <img068_bg_zx02
.byte <img069_bg_zx02
2024-05-22 20:27:13 +00:00
.byte <img070_bg_zx02
.byte <img071_bg_zx02
.byte <img072_bg_zx02
.byte <img073_bg_zx02
.byte <img074_bg_zx02
2024-05-22 21:13:25 +00:00
.byte <img075_bg_zx02
.byte <img076_bg_zx02
.byte <img077_bg_zx02
2024-05-23 01:55:30 +00:00
.byte <img078_bg_zx02
.byte <img079_bg_zx02
.byte <img080_bg_zx02
2024-05-23 04:14:15 +00:00
.byte <img081_bg_zx02
.byte <img082_bg_zx02
.byte <img083_bg_zx02
.byte <img084_bg_zx02
2024-05-22 03:34:55 +00:00
frames_h:
.byte >img025_bg_zx02
.byte >img055_bg_zx02
.byte >img056_bg_zx02
.byte >img057_bg_zx02
.byte >img058_bg_zx02
.byte >img059_bg_zx02
.byte >img060_bg_zx02
.byte >img061_bg_zx02
.byte >img062_bg_zx02
.byte >img063_bg_zx02
.byte >img064_bg_zx02
2024-05-22 05:33:49 +00:00
.byte >img065_bg_zx02
.byte >img066_bg_zx02
.byte >img067_bg_zx02
.byte >img068_bg_zx02
.byte >img069_bg_zx02
2024-05-22 20:27:13 +00:00
.byte >img070_bg_zx02
.byte >img071_bg_zx02
.byte >img072_bg_zx02
.byte >img073_bg_zx02
.byte >img074_bg_zx02
2024-05-22 21:13:25 +00:00
.byte >img075_bg_zx02
.byte >img076_bg_zx02
.byte >img077_bg_zx02
2024-05-23 01:55:30 +00:00
.byte >img078_bg_zx02
.byte >img079_bg_zx02
.byte >img080_bg_zx02
2024-05-23 04:14:15 +00:00
.byte >img081_bg_zx02
.byte >img082_bg_zx02
.byte >img083_bg_zx02
.byte >img084_bg_zx02
2024-05-22 03:34:55 +00:00
2024-05-23 15:39:42 +00:00
overlay_mask_zx02:
2024-06-16 03:00:55 +00:00
.incbin "movie_maglev_flip/overlays/maglev_overlay_mask.gr.zx02"
2024-05-23 15:39:42 +00:00
combined_overlays_zx02:
2024-06-16 03:00:55 +00:00
.incbin "movie_maglev_flip/overlays/combined_overlays.zx02"
2024-05-23 15:39:42 +00:00
.if 0
2024-05-20 22:04:33 +00:00
overlays_l:
.byte <overlay25,<overlay29,<overlay30
.byte <overlay31,<overlay32,<overlay33
.byte <overlay34,<overlay35
overlays_h:
.byte >overlay25,>overlay29,>overlay30
.byte >overlay31,>overlay32,>overlay33
.byte >overlay34,>overlay35
overlay25:
2024-06-16 03:00:55 +00:00
.incbin "movie_maglev_flip/overlays/overlay25.gr.zx02"
2024-05-20 22:04:33 +00:00
overlay29:
2024-06-16 03:00:55 +00:00
.incbin "movie_maglev_flip/overlays/overlay29.gr.zx02"
2024-05-20 22:04:33 +00:00
overlay30:
2024-06-16 03:00:55 +00:00
.incbin "movie_maglev_flip/overlays/overlay30.gr.zx02"
2024-05-20 22:04:33 +00:00
overlay31:
2024-06-16 03:00:55 +00:00
.incbin "movie_maglev_flip/overlays/overlay31.gr.zx02"
2024-05-20 22:04:33 +00:00
overlay32:
2024-06-16 03:00:55 +00:00
.incbin "movie_maglev_flip/overlays/overlay32.gr.zx02"
2024-05-20 22:04:33 +00:00
overlay33:
2024-06-16 03:00:55 +00:00
.incbin "movie_maglev_flip/overlays/overlay33.gr.zx02"
2024-05-20 22:04:33 +00:00
overlay34:
2024-06-16 03:00:55 +00:00
.incbin "movie_maglev_flip/overlays/overlay34.gr.zx02"
2024-05-20 22:04:33 +00:00
overlay35:
2024-06-16 03:00:55 +00:00
.incbin "movie_maglev_flip/overlays/overlay35.gr.zx02"
2024-05-20 22:04:33 +00:00
2024-05-23 15:39:42 +00:00
.endif