ds: hook up end animations

This commit is contained in:
Vince Weaver 2019-11-04 22:47:52 -05:00
parent 903eb5a9cd
commit af5383f58f
14 changed files with 358 additions and 36 deletions

View File

@ -53,10 +53,13 @@ demosplash.o: demosplash.s \
pt3_lib_init.s pt3_lib_core.s pt3_lib_mockingboard.s \
pt3_lib_play_frame.s pt3_lib_write_frame.s \
interrupt_handler.s \
missing.s k_40_48d.inc create_update_type1.s \
starbase.s \
starbase_action.s \
missing.s k_40_48d.inc create_update_type1.s \
gr_run_sequence.s \
graphics/starbase/starbase.inc \
graphics/starbase/ship_flames.inc \
graphics/starbase/star_wipe.inc \
graphics/sprites/alien.inc graphics/sprites/astronaut.inc \
escape.s create_update_type2.s offsets_table2.s \
book.s book_40_48d.inc \

View File

@ -185,7 +185,8 @@ wait_until_keypressed:
.include "gr_pageflip.s"
.align $100
.include "gr_fast_clear.s"
;.include "gr_overlay.s"
.include "gr_overlay.s"
.include "gr_run_sequence.s"
.align $100
.include "movement_table.s"
.include "font.s"
@ -220,6 +221,9 @@ wait_until_keypressed:
; Pictures (no need to align)
.include "appleII_40_96.inc"
.include "graphics/starbase/starbase.inc"
.include "graphics/starbase/ship_flames.inc"
.include "graphics/starbase/star_wipe.inc"
.include "earth.inc"
.include "book_40_48d.inc"
.include "credits_bg.inc"

108
demosplash/gr_overlay.s Normal file
View File

@ -0,0 +1,108 @@
;=========================================================
; gr_overlay, 40x48 version
;=========================================================
; copy 0xc00 to DRAW_PAGE
; then overlay with 0x1000, treating 0xa as transparent
gr_overlay:
jsr gr_copy_to_current
gr_overlay_noload:
lda #40
sta CH ; xsize is in CH ; 3
lda #46
sta CV ; ysize is in CV ; 3
gr_overlay_custom:
ldy #0
gr_overlay_loop:
ldy CV ; 3
lda gr_offsets,Y ; lookup low-res memory address ; 4
sta OUTL ; store out low byte of addy ; 3
sta INL
lda gr_offsets+1,Y ; look up high byte ; 4
clc
adc DRAW_PAGE ; ; 3
sta OUTH ; and store it out ; 3
lda gr_offsets+1,Y ; look up high byte ; 4
clc
adc #$c ; force to start at $1000
sta INH
; OUTH:OUTL now points at right place
ldx CH ; load xsize into x ; 3
ldy #0
gr_overlay_put_pixel:
lda (INL),Y ; get sprite colors ; 5
; check if completely transparent
; if so, skip
cmp #$aa ; if all zero, transparent ; 2
beq gr_overlay_done_draw ; don't draw it ; 2nt/3
sta COLOR ; save color for later ; 3
; check if top pixel transparent
and #$f0 ; check if top nibble zero ; 2
cmp #$a0
bne gr_overlay_bottom ; if not skip ahead ; 2nt/3
lda COLOR
and #$0f
sta COLOR
lda #$f0 ; setup mask ; 2
sta MASK ; 3
bmi gr_overlay_mask ; always? ; 3
gr_overlay_bottom:
lda COLOR ; re-load color ; 3
and #$0f ; check if bottom nibble zero ; 2
cmp #$0a
bne overlay_put_sprite_all ; if not, skip ahead ; 2nt/3
;=============
; 7/8
lda COLOR
and #$f0
sta COLOR
lda #$0f ; 2
sta MASK ; setup mask ; 3
;===========
; 5
gr_overlay_mask:
lda (OUTL),Y ; get color at output ; 5
and MASK ; mask off unneeded part ; 3
ora COLOR ; or the color in ; 3
sta (OUTL),Y ; store it back ; 6
jmp gr_overlay_done_draw ; we are done ; 3
overlay_put_sprite_all:
lda COLOR ; load color ; 3
sta (OUTL),Y ; and write it out ; 6
gr_overlay_done_draw:
iny
dex ; decrement x counter ; 2
bne gr_overlay_put_pixel ; if not done, keep looping ; 2nt/3
dec CV ; decemenet total y count ; 5
dec CV
bpl gr_overlay_loop ; loop if not done ; 2nt/3
rts ; return ; 6

View File

@ -0,0 +1,104 @@
;=================================
; Display a sequence of images
;=================================
; quit if escape pressed?
; pattern is TIME, PTR
; if time==0, then done
; if time==255, reload $C00 with PTR
; if time==0..127 wait TIME, then overlay PTR over $C00
; if time==128..254, wait TIME-128, then overlay GBASL over $C00
run_sequence:
ldy #0
run_sequence_loop:
lda (INTRO_LOOPL),Y ; get time
beq run_sequence_done ; if zero, then done
cmp #$ff ; if $ff, then load image to $c00
bne not_reload
reload_image:
iny
lda (INTRO_LOOPL),Y
sta GBASL
iny
lda (INTRO_LOOPL),Y
sta GBASH
iny
sty INTRO_LOOPER ; save for later
lda #$0c ; load to $c00
jsr load_rle_gr
jmp seq_stuff
not_reload:
tax
cmp #$80 ;if negative, no need to load pointer
bcs no_set_image_ptr ; bge (branch if greater equal)
get_image_ptr:
iny
lda (INTRO_LOOPL),Y
sta GBASL
iny
lda (INTRO_LOOPL),Y
sta GBASH
no_set_image_ptr:
txa
and #$7f
tax
cpx #1
beq seq_no_wait
jsr long_wait
seq_no_wait:
iny
sty INTRO_LOOPER ; save for later
lda #$10 ; load to $1000
jsr load_rle_gr
jsr gr_overlay
jsr page_flip
seq_stuff:
ldy INTRO_LOOPER
; exit early if escape pressed
lda KEYPRESS
cmp #27+$80
beq run_sequence_done
bit KEYRESET
jmp run_sequence_loop
run_sequence_done:
rts
;=====================
; long(er) wait
; waits approximately ?? ms
long_wait:
lda #64
jsr wait ; delay
dex
bne long_wait
rts
;=================
; from apple II rom monitor
; in case we have language card active
wait: sec
wait2: pha
wait3: sbc #$01
bne wait3
pla
sbc #$01
bne wait2
rts

View File

@ -25,12 +25,13 @@ ship_flames.inc: $(PNG2RLE) \
$(PNG2RLE) asm ship_flame5.png ship_flame5_rle >> ship_flames.inc
star_wipe.inc: $(PNG2RLE) \
star1.png star2.png star3.png star4.png star5.png
star1.png star2.png star3.png star4.png star5.png empty.png
$(PNG2RLE) asm star1.png star_wipe1_rle > star_wipe.inc
$(PNG2RLE) asm star2.png star_wipe2_rle >> star_wipe.inc
$(PNG2RLE) asm star3.png star_wipe3_rle >> star_wipe.inc
$(PNG2RLE) asm star4.png star_wipe4_rle >> star_wipe.inc
$(PNG2RLE) asm star5.png star_wipe5_rle >> star_wipe.inc
$(PNG2RLE) asm empty.png empty_rle >> star_wipe.inc
#####

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -12,21 +12,17 @@ star_wipe2_rle: .byte $28 ; ysize=48
.byte $0A, $A0,$FF,$AA, $A0,$29,$AA
.byte $A1
star_wipe3_rle: .byte $28 ; ysize=48
.byte $A0,$14,$AA, $5A, $A0,$26,$AA, $0A, $A0,$01,$A5, $A0,$26,$AA, $00
.byte $A0,$27,$AA, $00,$00, $5A, $A0,$24,$AA, $0A, $00,$00, $05
.byte $A0,$24,$AA, $A4,$00, $A0,$24,$AA, $A4,$00, $5A, $A0,$23,$AA, $A4,$00
.byte $A0,$01,$A5, $A0,$22,$AA, $A6,$00, $A0,$19,$AA, $55, $A8,$05, $A6,$00
.byte $A8,$05, $A0,$01,$A5, $A0,$11,$AA, $A0,$01,$A5, $A0,$01,$A0, $A0,$12,$00, $A0,$01,$A0
.byte $5A, $A0,$13,$AA, $A0,$01,$A5, $50, $A0,$10,$00, $A0,$01,$A0, $A0,$01,$A5
.byte $A0,$16,$AA, $50, $AE,$00, $50, $A0,$01,$A5, $A0,$18,$AA, $A0,$01,$A5
.byte $A0,$01,$A0, $AB,$00, $50, $A0,$1D,$AA, $A9,$00, $A0,$01,$A5, $A0,$1E,$AA
.byte $A9,$00, $A0,$1F,$AA, $A9,$00, $55, $A0,$1C,$AA, $5A, $0A
.byte $A9,$00, $0A, $A0,$1C,$AA, $A0,$01,$A5, $A4,$00, $5A, $A0,$01,$AA
.byte $A5,$00, $A0,$1C,$AA, $A4,$00, $A3,$AA, $A0,$01,$A5, $A5,$00, $A0,$1A,$AA
.byte $5A, $00,$00, $A0,$01,$A0, $A0,$01,$A5, $A5,$AA, $50, $A3,$00
.byte $A0,$1A,$AA, $00,$00, $5A, $A9,$AA, $A3,$00, $A0,$19,$AA, $00
.byte $A0,$01,$A5, $AA,$AA, $A0,$01,$A5, $00,$00, $A0,$19,$AA, $A0,$01,$A5, $AD,$AA
.byte $A0,$01,$A5, $AC,$AA
.byte $A0,$3B,$AA, $0A, $A0,$27,$AA, $00, $A0,$27,$AA, $00,$00, $A0,$25,$AA
.byte $0A, $00,$00, $0A, $A0,$24,$AA, $A4,$00, $A0,$24,$AA, $A4,$00
.byte $A0,$24,$AA, $A4,$00, $A0,$23,$AA, $A6,$00, $A0,$1A,$AA, $A8,$0A, $A6,$00
.byte $A8,$0A, $A0,$13,$AA, $A0,$01,$A0, $A0,$12,$00, $A0,$01,$A0, $A0,$15,$AA, $A0,$01,$A0
.byte $A0,$10,$00, $A0,$01,$A0, $A0,$17,$AA, $A0,$01,$A0, $AE,$00, $A0,$01,$A0, $A0,$1A,$AA
.byte $A0,$01,$A0, $AB,$00, $A0,$01,$A0, $A0,$1D,$AA, $A9,$00, $A0,$1F,$AA, $A9,$00
.byte $A0,$1F,$AA, $A9,$00, $A0,$1E,$AA, $0A, $A9,$00, $0A, $A0,$1D,$AA
.byte $A4,$00, $A0,$02,$AA, $A5,$00, $A0,$1C,$AA, $A4,$00, $A4,$AA, $A5,$00
.byte $A0,$1B,$AA, $00,$00, $A0,$01,$A0, $A6,$AA, $A0,$01,$A0, $A3,$00, $A0,$1A,$AA
.byte $00,$00, $AA,$AA, $A3,$00, $A0,$19,$AA, $00, $AC,$AA, $00,$00
.byte $A0,$34,$AA
.byte $A1
star_wipe4_rle: .byte $28 ; ysize=48
.byte $A0,$10,$AA, $A8,$00, $A0,$20,$AA, $A8,$00, $A0,$20,$AA, $A8,$00, $A0,$1F,$AA
@ -40,8 +36,10 @@ star_wipe4_rle: .byte $28 ; ysize=48
.byte $A0,$11,$AA, $A0,$18,$00, $A8,$AA
.byte $A1
star_wipe5_rle: .byte $28 ; ysize=48
.byte $A9,$AA, $0A, $A0,$14,$00, $0A, $55, $A8,$AA, $A9,$05
.byte $A0,$16,$00, $A9,$05, $A0,$FF,$00, $A0,$FF,$00, $A0,$FA,$00, $A0,$01,$A0, $A0,$26,$00
.byte $A0,$01,$A0, $A0,$01,$A5, $50, $A0,$24,$00, $A0,$01,$A0, $5A, $A0,$02,$AA
.byte $A0,$24,$00, $A0,$02,$AA
.byte $A9,$AA, $0A, $A0,$14,$00, $0A, $A9,$AA, $A9,$0A, $A0,$16,$00
.byte $A9,$0A, $A0,$FF,$00, $A0,$FF,$00, $A0,$FA,$00, $A0,$01,$A0, $A0,$26,$00, $A0,$01,$A0
.byte $A0,$01,$AA, $A0,$01,$A0, $A0,$24,$00, $A0,$01,$A0, $A3,$AA, $A0,$24,$00, $A0,$02,$AA
.byte $A1
empty_rle: .byte $28 ; ysize=48
.byte $A0,$FF,$00, $A0,$FF,$00, $A0,$FF,$00, $A0,$C3,$00
.byte $A1

View File

@ -34,11 +34,6 @@ l4_defeated:
cmp #5
bne starbase_new_room
lda #5
sta WHICH_LOAD
rts
;===========================
; quit_starbase
;===========================
@ -46,13 +41,10 @@ l4_defeated:
quit_starbase:
wait_loop:
lda KEYPRESS
bpl wait_loop
; lda KEYPRESS
; bpl wait_loop
lda KEYRESET ; clear strobe
lda #0
sta GAME_OVER
bit KEYRESET ; clear strobe
rts
@ -75,8 +67,6 @@ wait_loop:
.include "starbase_friend.s"
.include "starbase_alien_laser.s"
; room backgrounds
.include "graphics/starbase/starbase.inc"
; sprites
.include "graphics/sprites/astronaut.inc"
.include "graphics/sprites/alien.inc"

View File

@ -214,10 +214,14 @@ room2:
;=======================
;room with ship
room3:
cmp #3
bne room_setup_done
beq do_room3
jmp end_sequence
do_room3:
lda #1
sta NUM_DOORS
@ -778,3 +782,113 @@ door_c4_r3_xmax: .byte 39
door_c4_r3_y:
c4_r3_door0_y: .byte 26
;============================
; end_sequence
;============================
;
; fire engines, star-wipe
end_sequence:
;=========================
; set up bg
; lda #>(ship_rle)
; sta GBASH
; lda #<(ship_rle)
; sta GBASL
; lda #$0c ; load image off-screen $c00
; jsr load_rle_gr
lda #<flame_sequence
sta INTRO_LOOPL
lda #>flame_sequence
sta INTRO_LOOPH
jsr run_sequence
lda #<star_sequence
sta INTRO_LOOPL
lda #>star_sequence
sta INTRO_LOOPH
jsr run_sequence
; bit KEYRESET
; jsr wait_until_keypressed
; trigger end
lda #5
sta WHICH_ROOM
rts
FLAME_FRAMERATE = 10
flame_sequence:
.byte 255
.word ship_rle
.byte 1
.word ship_rle
.byte 50
.word ship_flame0_rle
.byte 40
.word ship_flame1_rle
.byte 40
.word ship_flame2_rle
.byte FLAME_FRAMERATE
.word ship_flame3_rle
.byte FLAME_FRAMERATE
.word ship_flame4_rle
.byte FLAME_FRAMERATE
.word ship_flame5_rle
.byte FLAME_FRAMERATE
.word ship_flame3_rle
.byte FLAME_FRAMERATE
.word ship_flame4_rle
.byte FLAME_FRAMERATE
.word ship_flame5_rle
.byte FLAME_FRAMERATE
.word ship_flame3_rle
.byte FLAME_FRAMERATE
.word ship_flame4_rle
.byte FLAME_FRAMERATE
.word ship_flame5_rle
.byte FLAME_FRAMERATE
.word ship_flame3_rle
.byte FLAME_FRAMERATE
.word ship_flame4_rle
.byte FLAME_FRAMERATE
.word ship_flame5_rle
.byte FLAME_FRAMERATE
.word ship_flame3_rle
.byte FLAME_FRAMERATE
.word ship_flame4_rle
.byte 255
.word ship_flame5_rle
.byte 0
star_sequence:
.byte 20
.word star_wipe1_rle
.byte 20
.word star_wipe2_rle
.byte 20
.word star_wipe3_rle
.byte 20
.word star_wipe4_rle
.byte 20
.word star_wipe5_rle
.byte 20
.word empty_rle
.byte 0