dos33fsprogs/games/ootw/ending/ending.s

282 lines
6.0 KiB
ArmAsm
Raw Normal View History

; ootw -- It's the End of the Game as We Know It
; TODO: missing a bunch of frames
2019-08-21 04:36:27 +00:00
; by Vince "Deater" Weaver <vince@deater.net>
2021-03-23 15:56:45 +00:00
.include "../zp.inc"
.include "../hardware.inc"
2019-08-21 04:36:27 +00:00
ending:
2019-08-22 04:50:50 +00:00
;=========================
; set up sound
;=========================
lda #0
sta DONE_PLAYING
2019-08-22 04:50:50 +00:00
lda #1
sta LOOP
; detect mockingboard
2019-08-22 04:50:50 +00:00
jsr mockingboard_detect
2019-08-22 04:50:50 +00:00
bcc mockingboard_notfound
mockingboard_found:
; jsr mockingboard_patch ; patch to work in slots other than 4?
;=======================
; Set up 50Hz interrupt
;========================
jsr mockingboard_init
jsr mockingboard_setup_interrupt
;============================
; Init the Mockingboard
;============================
jsr reset_ay_both
jsr clear_ay_both
;==================
; init song
;==================
jsr pt3_init_song
jmp done_setup_sound
mockingboard_notfound:
; patch out cli/sei calls
lda #$EA
sta cli_smc
sta sei_smc
done_setup_sound:
2019-08-21 04:36:27 +00:00
2019-08-22 04:50:50 +00:00
repeat_ending:
2019-08-21 04:36:27 +00:00
;===========================
; Enable graphics
;===========================
bit LORES
bit SET_GR
bit FULLGR
bit KEYRESET
2021-04-05 21:32:24 +00:00
;=================================
2019-08-21 04:36:27 +00:00
; Setup pages (is this necessary?)
2021-04-05 21:32:24 +00:00
;=================================
2019-08-21 04:36:27 +00:00
2021-04-05 21:32:24 +00:00
; lda #0
; sta DRAW_PAGE
; lda #1
; sta DISP_PAGE
2019-08-21 04:36:27 +00:00
2019-08-22 03:53:49 +00:00
2021-04-05 21:32:24 +00:00
;============
2019-08-22 03:53:49 +00:00
; start music
2021-04-05 21:32:24 +00:00
;============
2019-08-22 03:53:49 +00:00
cli_smc:
2019-08-22 03:53:49 +00:00
cli ; enable interrupts
;=====================================
; friend arrive, board dragon sequence
;=====================================
2019-08-22 03:39:09 +00:00
lda #<pickup_sequence
sta INTRO_LOOPL
lda #>pickup_sequence
sta INTRO_LOOPH
2019-08-22 03:39:09 +00:00
jsr run_sequence
2019-08-22 03:39:09 +00:00
;=========================
; wing open sequence
2019-08-22 03:39:09 +00:00
;=========================
lda #<wing_sequence
sta INTRO_LOOPL
lda #>wing_sequence
sta INTRO_LOOPH
2019-08-22 03:39:09 +00:00
jsr run_sequence
2019-08-22 03:39:09 +00:00
;=========================
; flying sequence
2019-08-22 03:39:09 +00:00
;=========================
lda #<flying_sequence
sta INTRO_LOOPL
lda #>flying_sequence
sta INTRO_LOOPH
2019-08-21 04:36:27 +00:00
jsr run_sequence
2019-08-21 04:36:27 +00:00
;===========================
; real end
;===========================
quit_level:
jsr TEXT
jsr HOME
lda KEYRESET ; clear strobe
2019-08-22 04:50:50 +00:00
;======================
; scroll credits
;======================
2021-04-05 21:32:24 +00:00
jsr end_credits
2019-08-22 04:50:50 +00:00
;======================
2021-04-05 21:32:24 +00:00
; wait before rebooting
2019-08-22 04:50:50 +00:00
;======================
2019-08-22 03:53:49 +00:00
; wait wait wait
jsr wait_until_keypressed
; disable music
jsr clear_ay_both
sei_smc:
sei
; reboot to title
lda #$ff ; force cold reboot
sta $03F4
jmp ($FFFC)
; jmp repeat_ending
2019-08-22 03:53:49 +00:00
2019-08-21 04:36:27 +00:00
2019-08-22 04:50:50 +00:00
2019-08-21 04:36:27 +00:00
;======================
; wait until keypressed
;======================
wait_until_keypressed:
lda KEYPRESS
bpl wait_until_keypressed
bit KEYRESET
rts
2019-08-22 03:53:49 +00:00
; sequence: 0 = done
; 255 reload $C00 with PTR
; 0..127 wait TIME, then overlay $C00 with X
; 128..254 wait TIME then overlay $C00 with next
; note: pauses *before* flipping to new graphic
2021-04-10 05:14:32 +00:00
; dragon moves its head a bit when we arrive
; repeats twice pulling self
; then again but slightly to right
; two more times
; friend pops up, pauses a while
pickup_sequence:
.byte 255 ; load to bg
2021-04-10 05:14:32 +00:00
.word rooftop_bg_lzsa ; this
.byte 128+110 ; .word rooftop01_lzsa ; next
.byte 128+110 ; .word rooftop02_lzsa ; next
.byte 128+100 ; .word rooftop03_lzsa ; next
.byte 128+110 ; .word rooftop04_lzsa ; next
.byte 128+110 ; .word rooftop05_lzsa ; next
.byte 128+100 ; .word rooftop06_lzsa ; next
.byte 128+110 ; .word rooftop07_lzsa ; next
.byte 128+110 ; .word rooftop08_lzsa ; next
.byte 128+100 ; .word rooftop09_lzsa ; next
.byte 128+100 ; .word rooftop10_lzsa ; next
.byte 128+110 ; .word rooftop11_lzsa ; next
.byte 128+110 ; .word rooftop12_lzsa ; next
.byte 128+100 ; .word rooftop13_lzsa ; next
.byte 128+110 ; .word rooftop14_lzsa ; next
.byte 128+110 ; .word rooftop15_lzsa ; next
.byte 128+100 ; .word rooftop16_lzsa ; next
.byte 128+110 ; .word rooftop17_lzsa ; next
.byte 128+110 ; .word rooftop18_lzsa ; next
.byte 128+100 ; .word rooftop19_lzsa ; next
.byte 128+100 ; .word rooftop20_lzsa ; next
.byte 128+110 ; .word rooftop21_lzsa ; next
.byte 128+110 ; .word rooftop22_lzsa ; next
.byte 128+100 ; .word rooftop23_lzsa ; next
.byte 128+110 ; .word rooftop24_lzsa ; next
.byte 128+110 ; .word rooftop25_lzsa ; next
.byte 128+100 ; .word rooftop26_lzsa ; next
.byte 128+110 ; .word rooftop27_lzsa ; next
.byte 128+110 ; .word rooftop28_lzsa ; next
.byte 128+100 ; .word rooftop29_lzsa ; next
.byte 0 ; finish
wing_sequence:
.byte 255 ; load to bg
.word wing_bg_lzsa ; this
2021-04-10 05:14:32 +00:00
.byte 128+60 ; .word left_unfurl1_lzsa ; next
.byte 128+40 ; .word left_unfurl2_lzsa ; next
.byte 128+60 ; .word right_unfurl1_lzsa ; next
.byte 128+40 ; .word right_unfurl2_lzsa ; next
2021-04-10 05:14:32 +00:00
.byte 128+40 ; .word onboard_lzsa ; next
.byte 0 ; finish
flying_sequence:
.byte 255 ; load to bg
.word sky_bg_lzsa ; this
2021-04-10 05:14:32 +00:00
.byte 128+50 ; .word flying01_lzsa ; next
.byte 128+50 ; .word flying03_lzsa ; next
.byte 128+50 ; .word flying05_lzsa ; next
.byte 128+50 ; .word flying07_lzsa ; next
.byte 128+50 ; .word flying09_lzsa ; next
.byte 128+50 ; .word flying11_lzsa ; next
.byte 128+50 ; .word the_end01_lzsa ; next
.byte 128+50 ; .word the_end02_lzsa ; next
.byte 128+50 ; .word the_end03_lzsa ; next
.byte 128+50 ; .word the_end04_lzsa ; next
.byte 128+50 ; .word the_end05_lzsa ; next
.byte 128+50 ; .word the_end06_lzsa ; next
.byte 128+50 ; .word the_end07_lzsa ; next
.byte 128+120 ; .word the_end08_lzsa ; next
.byte 128+50 ; .word the_end09_lzsa ; next
.byte 128+50 ; .word the_end10_lzsa ; next
.byte 0 ; finish
2019-08-22 03:53:49 +00:00
2021-04-05 21:32:24 +00:00
.include "credits.s"
2019-08-22 03:53:49 +00:00
2021-03-23 15:56:45 +00:00
.include "../text_print.s"
.include "../gr_pageflip.s"
2021-03-24 23:43:33 +00:00
.include "../decompress_fast_v2.s"
2021-03-23 15:56:45 +00:00
.include "../gr_fast_clear.s"
.include "../gr_copy.s"
.include "../gr_offsets.s"
.include "../gr_overlay.s"
2021-04-10 05:14:32 +00:00
.include "../gr_run_sequence2.s"
2019-08-21 04:36:27 +00:00
2021-03-23 15:56:45 +00:00
.include "../pt3_player/pt3_lib_core.s"
.include "../pt3_player/pt3_lib_init.s"
.include "../pt3_player/interrupt_handler.s"
.include "../pt3_player/pt3_lib_mockingboard_detect.s"
.include "../pt3_player/pt3_lib_mockingboard_setup.s"
2019-09-12 04:51:17 +00:00
2019-08-21 04:36:27 +00:00
; backgrounds
2021-03-23 15:56:45 +00:00
.include "graphics/ending/ootw_c16_end.inc"
2019-08-21 04:36:27 +00:00
PT3_LOC = song
; must be page aligned
.align 256
song:
2021-03-24 15:33:54 +00:00
.incbin "music/ootw_outro.pt3"