2022-03-17 17:56:03 +00:00
|
|
|
.include "zp.inc"
|
|
|
|
.include "hardware.inc"
|
|
|
|
.include "qload.inc"
|
|
|
|
.include "lemm.inc"
|
|
|
|
.include "lemming_status.inc"
|
|
|
|
|
2022-03-19 04:36:58 +00:00
|
|
|
|
|
|
|
.byte 1 ; level 1
|
|
|
|
|
2022-03-11 06:22:51 +00:00
|
|
|
do_level1:
|
|
|
|
|
2022-03-18 01:33:58 +00:00
|
|
|
;==============
|
|
|
|
; set up stuff
|
|
|
|
;==============
|
|
|
|
|
|
|
|
lda #9
|
|
|
|
sta DOOR_X
|
|
|
|
lda #36
|
|
|
|
sta DOOR_Y
|
|
|
|
|
|
|
|
lda #12
|
|
|
|
sta INIT_X
|
|
|
|
lda #45
|
|
|
|
sta INIT_Y
|
|
|
|
|
|
|
|
; flame locations
|
|
|
|
|
|
|
|
lda #31 ; 217
|
|
|
|
sta l_flame_x_smc+1
|
|
|
|
lda #108
|
|
|
|
sta l_flame_y_smc+1
|
|
|
|
sta r_flame_y_smc+1
|
|
|
|
|
|
|
|
lda #35 ; 245
|
|
|
|
sta r_flame_x_smc+1
|
|
|
|
|
|
|
|
; door exit location
|
|
|
|
|
|
|
|
lda #31 ;
|
|
|
|
sta exit_x1_smc+1
|
|
|
|
lda #35
|
|
|
|
sta exit_x2_smc+1
|
|
|
|
|
2022-03-27 19:40:20 +00:00
|
|
|
lda #100
|
2022-03-18 01:33:58 +00:00
|
|
|
sta exit_y1_smc+1
|
|
|
|
lda #127
|
|
|
|
sta exit_y2_smc+1
|
|
|
|
|
2022-03-22 21:13:38 +00:00
|
|
|
lda #$10 ; BCD
|
|
|
|
sta PERCENT_NEEDED
|
2022-03-22 22:50:06 +00:00
|
|
|
sta PERCENT_ADD
|
2022-03-18 01:33:58 +00:00
|
|
|
|
2022-03-17 18:33:18 +00:00
|
|
|
;==============
|
|
|
|
; set up intro
|
|
|
|
;==============
|
|
|
|
|
|
|
|
lda #<level1_preview_lzsa
|
|
|
|
sta level_preview_l_smc+1
|
|
|
|
lda #>level1_preview_lzsa
|
|
|
|
sta level_preview_h_smc+1
|
|
|
|
|
2022-03-21 03:09:23 +00:00
|
|
|
lda #<level1_intro_text
|
|
|
|
sta intro_text_smc_l+1
|
|
|
|
lda #>level1_intro_text
|
|
|
|
sta intro_text_smc_h+1
|
|
|
|
|
2022-03-11 06:22:51 +00:00
|
|
|
;==============
|
|
|
|
; set up music
|
|
|
|
;==============
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta CURRENT_CHUNK
|
|
|
|
sta DONE_PLAYING
|
|
|
|
sta BASE_FRAME_L
|
2022-03-15 02:57:33 +00:00
|
|
|
sta BUTTON_LOCATION
|
2022-03-11 06:22:51 +00:00
|
|
|
|
2022-03-15 20:04:05 +00:00
|
|
|
; set up first song
|
|
|
|
|
2022-03-17 17:56:03 +00:00
|
|
|
lda #<music5_parts_l
|
2022-03-15 20:04:05 +00:00
|
|
|
sta chunk_l_smc+1
|
2022-03-17 17:56:03 +00:00
|
|
|
lda #>music5_parts_l
|
2022-03-15 20:04:05 +00:00
|
|
|
sta chunk_l_smc+2
|
|
|
|
|
2022-03-17 17:56:03 +00:00
|
|
|
lda #<music5_parts_h
|
2022-03-15 20:04:05 +00:00
|
|
|
sta chunk_h_smc+1
|
2022-03-17 17:56:03 +00:00
|
|
|
lda #>music5_parts_h
|
2022-03-15 20:04:05 +00:00
|
|
|
sta chunk_h_smc+2
|
|
|
|
|
|
|
|
|
2022-03-11 06:22:51 +00:00
|
|
|
lda #$D0
|
|
|
|
sta CHUNK_NEXT_LOAD ; Load at $D0
|
|
|
|
jsr load_song_chunk
|
|
|
|
|
|
|
|
lda #$D0 ; music starts at $d000
|
|
|
|
sta CHUNK_NEXT_PLAY
|
|
|
|
sta BASE_FRAME_H
|
|
|
|
|
|
|
|
lda #1
|
|
|
|
sta LOOP
|
|
|
|
sta CURRENT_CHUNK
|
|
|
|
|
2022-03-15 20:04:05 +00:00
|
|
|
|
|
|
|
|
2022-03-11 06:22:51 +00:00
|
|
|
;=======================
|
|
|
|
; show title screen
|
|
|
|
;=======================
|
|
|
|
|
2022-03-15 19:16:37 +00:00
|
|
|
jsr intro_level
|
2022-03-11 06:22:51 +00:00
|
|
|
|
|
|
|
;=======================
|
|
|
|
; Load Graphics
|
|
|
|
;=======================
|
|
|
|
|
|
|
|
lda #$20
|
|
|
|
sta HGR_PAGE
|
|
|
|
jsr hgr_make_tables
|
|
|
|
|
|
|
|
bit SET_GR
|
|
|
|
bit PAGE0
|
|
|
|
bit HIRES
|
|
|
|
bit FULLGR
|
|
|
|
|
|
|
|
lda #<level1_lzsa
|
|
|
|
sta getsrc_smc+1 ; LZSA_SRC_LO
|
|
|
|
lda #>level1_lzsa
|
|
|
|
sta getsrc_smc+2 ; LZSA_SRC_HI
|
|
|
|
|
|
|
|
lda #$20
|
|
|
|
|
|
|
|
jsr decompress_lzsa2_fast
|
|
|
|
|
|
|
|
lda #<level1_lzsa
|
|
|
|
sta getsrc_smc+1 ; LZSA_SRC_LO
|
|
|
|
lda #>level1_lzsa
|
|
|
|
sta getsrc_smc+2 ; LZSA_SRC_HI
|
|
|
|
|
|
|
|
lda #$40
|
|
|
|
|
|
|
|
jsr decompress_lzsa2_fast
|
|
|
|
|
|
|
|
|
|
|
|
;=======================
|
|
|
|
; Setup cursor
|
|
|
|
;=======================
|
|
|
|
|
2022-03-23 01:36:44 +00:00
|
|
|
lda #$FF
|
2022-03-11 06:22:51 +00:00
|
|
|
sta OVER_LEMMING
|
|
|
|
lda #10
|
|
|
|
sta CURSOR_X
|
|
|
|
lda #100
|
|
|
|
sta CURSOR_Y
|
|
|
|
|
|
|
|
;=======================
|
|
|
|
; init vars
|
|
|
|
;=======================
|
|
|
|
|
2022-03-22 03:00:30 +00:00
|
|
|
lda #10
|
2022-03-11 06:22:51 +00:00
|
|
|
sta LEMMINGS_TO_RELEASE
|
|
|
|
|
|
|
|
; set up time
|
|
|
|
|
|
|
|
lda #$5
|
|
|
|
sta TIME_MINUTES
|
|
|
|
lda #$00
|
|
|
|
sta TIME_SECONDS
|
|
|
|
|
2022-03-22 03:00:30 +00:00
|
|
|
sta TIMER_COUNT ; ??
|
|
|
|
|
|
|
|
jsr init_level
|
2022-03-11 06:22:51 +00:00
|
|
|
|
2022-03-20 15:32:08 +00:00
|
|
|
;=======================
|
|
|
|
; Play "Let's Go"
|
|
|
|
;=======================
|
|
|
|
|
|
|
|
jsr play_letsgo
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-11 06:22:51 +00:00
|
|
|
;===================
|
|
|
|
;===================
|
|
|
|
; Main Loop
|
|
|
|
;===================
|
|
|
|
;===================
|
2022-03-15 19:16:37 +00:00
|
|
|
l1_main_loop:
|
2022-03-11 06:22:51 +00:00
|
|
|
|
2022-03-20 01:48:03 +00:00
|
|
|
;=========================
|
|
|
|
; load next chunk of music
|
|
|
|
; if necessary
|
|
|
|
;=========================
|
2022-03-11 06:22:51 +00:00
|
|
|
|
2022-03-20 01:48:03 +00:00
|
|
|
jsr load_music
|
2022-03-11 06:22:51 +00:00
|
|
|
|
|
|
|
|
2022-03-20 15:32:08 +00:00
|
|
|
;=========================
|
|
|
|
; open door
|
|
|
|
;=========================
|
2022-03-11 06:22:51 +00:00
|
|
|
|
|
|
|
lda DOOR_OPEN
|
2022-03-15 19:16:37 +00:00
|
|
|
bne l1_door_is_open
|
2022-03-11 06:22:51 +00:00
|
|
|
|
|
|
|
jsr draw_door
|
|
|
|
|
2022-03-15 19:16:37 +00:00
|
|
|
l1_door_is_open:
|
2022-03-11 06:22:51 +00:00
|
|
|
|
|
|
|
;======================
|
|
|
|
; release lemmings
|
|
|
|
;======================
|
|
|
|
|
2022-03-20 15:32:08 +00:00
|
|
|
jsr release_lemming
|
2022-03-11 06:22:51 +00:00
|
|
|
|
2022-03-20 15:32:08 +00:00
|
|
|
;=====================
|
|
|
|
; animate flames
|
|
|
|
;=====================
|
2022-03-11 06:22:51 +00:00
|
|
|
|
|
|
|
jsr draw_flames
|
|
|
|
|
|
|
|
lda TIMER_COUNT
|
2022-03-29 03:22:33 +00:00
|
|
|
cmp #50
|
2022-03-15 19:16:37 +00:00
|
|
|
bcc l1_timer_not_yet
|
2022-03-11 06:22:51 +00:00
|
|
|
|
|
|
|
jsr update_time
|
|
|
|
|
|
|
|
lda #$0
|
|
|
|
sta TIMER_COUNT
|
2022-03-15 19:16:37 +00:00
|
|
|
l1_timer_not_yet:
|
2022-03-11 06:22:51 +00:00
|
|
|
|
2022-03-13 06:28:37 +00:00
|
|
|
|
|
|
|
; main drawing loop
|
|
|
|
|
2022-03-11 06:22:51 +00:00
|
|
|
jsr erase_lemming
|
|
|
|
|
2022-03-13 06:28:37 +00:00
|
|
|
jsr erase_pointer
|
|
|
|
|
2022-03-11 06:22:51 +00:00
|
|
|
jsr move_lemmings
|
|
|
|
|
|
|
|
jsr draw_lemming
|
|
|
|
|
|
|
|
jsr handle_keypress
|
|
|
|
|
2022-03-13 06:28:37 +00:00
|
|
|
jsr draw_pointer
|
2022-03-11 06:22:51 +00:00
|
|
|
|
2022-03-22 04:05:49 +00:00
|
|
|
lda #$f0
|
2022-03-11 06:22:51 +00:00
|
|
|
jsr wait
|
|
|
|
|
|
|
|
inc FRAMEL
|
|
|
|
|
|
|
|
lda LEVEL_OVER
|
2022-03-15 19:16:37 +00:00
|
|
|
bne l1_level_over
|
2022-03-11 06:22:51 +00:00
|
|
|
|
2022-03-15 19:16:37 +00:00
|
|
|
jmp l1_main_loop
|
2022-03-11 06:22:51 +00:00
|
|
|
|
|
|
|
|
2022-03-15 19:16:37 +00:00
|
|
|
l1_level_over:
|
2022-03-11 06:22:51 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2022-03-17 16:34:14 +00:00
|
|
|
.include "graphics/graphics_level1.inc"
|
|
|
|
|
|
|
|
|
2022-03-17 17:56:03 +00:00
|
|
|
music5_parts_h:
|
2022-03-17 16:34:14 +00:00
|
|
|
.byte >lemm5_part1_lzsa,>lemm5_part2_lzsa,>lemm5_part3_lzsa
|
|
|
|
.byte >lemm5_part4_lzsa,>lemm5_part5_lzsa,$00
|
|
|
|
|
2022-03-17 17:56:03 +00:00
|
|
|
music5_parts_l:
|
2022-03-17 16:34:14 +00:00
|
|
|
.byte <lemm5_part1_lzsa,<lemm5_part2_lzsa,<lemm5_part3_lzsa
|
|
|
|
.byte <lemm5_part4_lzsa,<lemm5_part5_lzsa
|
|
|
|
|
|
|
|
lemm5_part1_lzsa:
|
|
|
|
.incbin "music/lemm5.part1.lzsa"
|
|
|
|
lemm5_part2_lzsa:
|
|
|
|
.incbin "music/lemm5.part2.lzsa"
|
|
|
|
lemm5_part3_lzsa:
|
|
|
|
.incbin "music/lemm5.part3.lzsa"
|
|
|
|
lemm5_part4_lzsa:
|
|
|
|
.incbin "music/lemm5.part4.lzsa"
|
|
|
|
lemm5_part5_lzsa:
|
|
|
|
.incbin "music/lemm5.part5.lzsa"
|
|
|
|
|
2022-03-20 15:32:08 +00:00
|
|
|
|
2022-03-21 03:09:23 +00:00
|
|
|
level1_intro_text:
|
|
|
|
.byte 0, 8,"LEVEL 1",0
|
|
|
|
.byte 15, 8,"JUST DIG!",0
|
|
|
|
.byte 9,12,"NUMBER OF LEMMINGS 10",0
|
|
|
|
.byte 12,14,"10% TO BE SAVED",0
|
|
|
|
.byte 12,16,"RELEASE RATE 50",0
|
|
|
|
.byte 13,18,"TIME 5 MINUTES",0
|
|
|
|
.byte 15,20,"RATING FUN",0
|
2022-03-25 01:25:26 +00:00
|
|
|
.byte 8,23,"PRESS RETURN TO CONTINUE",0
|