2020-09-17 03:30:12 +00:00
|
|
|
; Monkey Title
|
|
|
|
|
|
|
|
; by deater (Vince Weaver) <vince@deater.net>
|
|
|
|
|
|
|
|
; Zero Page
|
|
|
|
.include "zp.inc"
|
|
|
|
.include "hardware.inc"
|
|
|
|
.include "common_defines.inc"
|
|
|
|
|
2020-09-17 05:12:40 +00:00
|
|
|
music_start = $4800
|
|
|
|
|
2020-09-17 03:30:12 +00:00
|
|
|
title_start:
|
|
|
|
;===================
|
|
|
|
; init screen
|
|
|
|
jsr TEXT
|
|
|
|
jsr HOME
|
|
|
|
bit KEYRESET
|
|
|
|
|
|
|
|
bit SET_GR
|
|
|
|
bit PAGE0
|
|
|
|
bit LORES
|
2020-09-17 05:12:40 +00:00
|
|
|
bit FULLGR
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta clear_all_color+1
|
|
|
|
jsr clear_all
|
2020-09-17 03:30:12 +00:00
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta ANIMATE_FRAME
|
|
|
|
sta FRAMEL
|
|
|
|
sta FRAMEH
|
2020-09-17 05:12:40 +00:00
|
|
|
sta DISP_PAGE
|
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
lda #4
|
|
|
|
sta DRAW_PAGE
|
|
|
|
|
|
|
|
|
2020-09-17 05:12:40 +00:00
|
|
|
setup_music:
|
|
|
|
; decompress music
|
|
|
|
|
|
|
|
lda #<theme_lzsa
|
|
|
|
sta LZSA_SRC_LO
|
|
|
|
lda #>theme_lzsa
|
|
|
|
sta LZSA_SRC_HI
|
|
|
|
lda #$48 ; load to page $4800
|
|
|
|
jsr decompress_lzsa2_fast
|
|
|
|
|
|
|
|
jsr mockingboard_detect
|
2020-09-17 03:30:12 +00:00
|
|
|
|
|
|
|
title_loop:
|
|
|
|
|
|
|
|
;====================================
|
|
|
|
; load LF logo
|
|
|
|
;====================================
|
|
|
|
|
2020-09-17 05:12:40 +00:00
|
|
|
lda #<logo_lzsa
|
|
|
|
sta LZSA_SRC_LO
|
|
|
|
lda #>logo_lzsa
|
|
|
|
sta LZSA_SRC_HI
|
|
|
|
lda #$c ; load to page $c00
|
|
|
|
jsr decompress_lzsa2_fast
|
|
|
|
|
2020-09-17 03:30:12 +00:00
|
|
|
jsr gr_copy_to_current
|
|
|
|
|
|
|
|
logo_loop:
|
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
; draw sprites
|
|
|
|
|
2020-09-17 03:30:12 +00:00
|
|
|
; lda GUYBRUSH_X
|
|
|
|
; sta XPOS
|
|
|
|
; lda GUYBRUSH_Y
|
|
|
|
; sta YPOS
|
|
|
|
|
|
|
|
; lda #<guybrush_back_sprite
|
|
|
|
; sta INL
|
|
|
|
; lda #>guybrush_back_sprite
|
|
|
|
; sta INH
|
|
|
|
|
|
|
|
; jsr put_sprite_crop
|
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
jsr gr_copy_to_current
|
2020-09-17 03:30:12 +00:00
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
jsr page_flip
|
2020-09-17 03:30:12 +00:00
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
; incrememnt frame
|
2020-09-17 03:30:12 +00:00
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
jsr inc_frame
|
2020-09-17 03:30:12 +00:00
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
; if it's been x seconds then go to next part
|
|
|
|
lda FRAMEH
|
|
|
|
cmp #3
|
|
|
|
beq do_monkey_loop
|
2020-09-17 03:30:12 +00:00
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
; early escape if keypressed
|
|
|
|
lda KEYPRESS
|
|
|
|
bpl do_logo_loop
|
2020-09-17 03:30:12 +00:00
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
jmp done_with_title
|
2020-09-17 03:30:12 +00:00
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
do_logo_loop:
|
|
|
|
jmp logo_loop
|
2020-09-17 03:30:12 +00:00
|
|
|
|
|
|
|
|
2020-09-17 05:12:40 +00:00
|
|
|
;====================================
|
2020-09-17 13:37:34 +00:00
|
|
|
; load Background logo
|
2020-09-17 05:12:40 +00:00
|
|
|
;====================================
|
2020-09-17 13:37:34 +00:00
|
|
|
do_monkey_loop:
|
2020-09-17 05:12:40 +00:00
|
|
|
lda #<title_lzsa
|
|
|
|
sta LZSA_SRC_LO
|
|
|
|
lda #>title_lzsa
|
|
|
|
sta LZSA_SRC_HI
|
|
|
|
lda #$c ; load to page $c00
|
|
|
|
jsr decompress_lzsa2_fast
|
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
monkey_loop:
|
2020-09-17 05:12:40 +00:00
|
|
|
jsr gr_copy_to_current
|
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
; early escape if keypressed
|
|
|
|
lda KEYPRESS
|
|
|
|
bpl loop_again
|
|
|
|
|
|
|
|
jmp done_with_title
|
|
|
|
|
|
|
|
loop_again:
|
|
|
|
jmp monkey_loop
|
|
|
|
|
2020-09-17 05:12:40 +00:00
|
|
|
|
|
|
|
;==========================
|
|
|
|
; turn off music
|
|
|
|
;==========================
|
2020-09-17 13:37:34 +00:00
|
|
|
done_with_title:
|
|
|
|
bit KEYRESET ; clear keypress
|
|
|
|
sei ; clear interrupts
|
2020-09-17 05:12:40 +00:00
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
jsr clear_ay_both ; silence ay-3-8910 chips
|
2020-09-17 05:12:40 +00:00
|
|
|
|
2020-09-17 03:30:12 +00:00
|
|
|
;==========================
|
|
|
|
; load main program
|
|
|
|
;==========================
|
|
|
|
|
|
|
|
lda #LOAD_MONKEY
|
|
|
|
sta WHICH_LOAD
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
;==========================
|
|
|
|
; includes
|
|
|
|
;==========================
|
|
|
|
|
|
|
|
; level graphics
|
2020-09-17 05:12:40 +00:00
|
|
|
.include "graphics_intro/title_graphics.inc"
|
2020-09-17 03:30:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
.include "text_print.s"
|
2020-09-17 03:30:12 +00:00
|
|
|
.include "gr_offsets.s"
|
2020-09-17 05:12:40 +00:00
|
|
|
.include "gr_fast_clear.s"
|
2020-09-17 03:30:12 +00:00
|
|
|
.include "gr_copy.s"
|
2020-09-17 13:37:34 +00:00
|
|
|
.include "gr_putsprite_crop.s"
|
|
|
|
.include "gr_pageflip.s"
|
2020-09-17 05:12:40 +00:00
|
|
|
.include "decompress_fast_v2.s"
|
2020-09-17 03:30:12 +00:00
|
|
|
|
2020-09-17 05:12:40 +00:00
|
|
|
.include "ym_play.s"
|
|
|
|
.include "interrupt_handler.s"
|
|
|
|
.include "mockingboard.s"
|
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
;wait_until_keypressed:
|
|
|
|
; lda KEYPRESS
|
|
|
|
; bpl wait_until_keypressed
|
2020-09-17 03:30:12 +00:00
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
; bit KEYRESET
|
2020-09-17 03:30:12 +00:00
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
; rts
|
|
|
|
|
|
|
|
|
|
|
|
;====================================
|
|
|
|
; inc frame count
|
|
|
|
;====================================
|
|
|
|
inc_frame:
|
|
|
|
inc FRAMEL
|
|
|
|
bne room_frame_no_oflo
|
|
|
|
inc FRAMEH
|
|
|
|
room_frame_no_oflo:
|
2020-09-17 03:30:12 +00:00
|
|
|
rts
|
2020-09-17 05:12:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
; music is compressed
|
|
|
|
; decompressed it is 30720 bytes
|
|
|
|
; we decompress to $4800
|
|
|
|
; so total size of our code can't be biggr than $2800 = 10k
|
|
|
|
|
|
|
|
theme_lzsa:
|
|
|
|
.incbin "music/theme.lzsa"
|
|
|
|
|
2020-09-17 13:37:34 +00:00
|
|
|
logo_sprites:
|
|
|
|
.word logo_sprite0
|
|
|
|
.word logo_sprite1
|
|
|
|
.word logo_sprite2
|
|
|
|
.word logo_sprite1
|
|
|
|
.word logo_sprite0
|
|
|
|
|
|
|
|
logo_sprite0:
|
|
|
|
.byte 3,2
|
|
|
|
.byte $AA,$AA,$AA
|
|
|
|
.byte $AA,$AF,$AA
|
|
|
|
|
|
|
|
logo_sprite1:
|
|
|
|
.byte 3,2
|
|
|
|
.byte $AA,$3A,$AA
|
|
|
|
.byte $A3,$3F,$A3
|
|
|
|
|
|
|
|
logo_sprite2:
|
|
|
|
.byte 3,3
|
|
|
|
.byte $AA,$b3,$AA
|
|
|
|
.byte $Ab,$bF,$Ab
|
|
|
|
.byte $Aa,$a3,$Aa
|
|
|
|
|
|
|
|
; spark locations (grow+shrink)
|
|
|
|
|
|
|
|
sparks:
|
|
|
|
; X,Y timestamp
|
|
|
|
.byte 0,10, 0 ; first: 0,10
|
|
|
|
.byte 3,26, 2 ; second: 3,26
|
|
|
|
.byte 6,10, 4 ; third: 6,10
|
|
|
|
.byte 6,28, 6 ; 4th 6,28
|
|
|
|
.byte 10,14, 8 ; 5th 10,14
|
|
|
|
.byte 15,22, 10 ; 6th 15,22
|
|
|
|
.byte 19,14, 12 ; 7th 19,14
|
|
|
|
.byte 25,24, 14 ; 8th 25,24
|
|
|
|
.byte 28,10, 16 ; 9th 28,10
|
|
|
|
.byte 32,30, 18 ; 10th 32,30
|
|
|
|
.byte 37,10, 20 ; 11th 37,10
|
|
|
|
.byte $ff
|