From c206b666eeccb2b0d261aa22c8ebc81ee4353076 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 17 Mar 2022 14:33:18 -0400 Subject: [PATCH] lemm: split off level5 as well --- games/lemm/Makefile | 26 ++++++++++++--- games/lemm/NOTES | 3 ++ games/lemm/intro_level1.s | 20 +++-------- games/lemm/lemm.s | 70 +++++++++++++++++++++++---------------- games/lemm/level1.s | 13 ++++++-- games/lemm/level5.s | 15 +++++++++ games/lemm/qload.s | 2 ++ 7 files changed, 99 insertions(+), 50 deletions(-) diff --git a/games/lemm/Makefile b/games/lemm/Makefile index fa156251..8d7865c9 100644 --- a/games/lemm/Makefile +++ b/games/lemm/Makefile @@ -18,7 +18,8 @@ all: lemm.dsk # $(DOS33) -y lemm.dsk BSAVE -a 0x4000 LEMM_TEST -lemm.dsk: QBOOT QLOAD LEMM LEVEL1 +lemm.dsk: QBOOT QLOAD LEMM \ + LEVEL1 LEVEL5 cp $(EMPTY_DISK) lemm.dsk $(DOS33_RAW) lemm.dsk 0 0 QBOOT 0 1 $(DOS33_RAW) lemm.dsk 0 2 QBOOT 1 1 @@ -26,6 +27,7 @@ lemm.dsk: QBOOT QLOAD LEMM LEVEL1 $(DOS33_RAW) lemm.dsk 1 0 QLOAD 0 0 $(DOS33_RAW) lemm.dsk 3 0 LEMM 0 0 $(DOS33_RAW) lemm.dsk 10 0 LEVEL1 0 0 + $(DOS33_RAW) lemm.dsk 18 0 LEVEL5 0 0 ### @@ -42,7 +44,8 @@ QLOAD: qload.o ld65 -o QLOAD qload.o -C $(LINKER_SCRIPTS)/apple2_1200.inc qload.o: qload.s qboot.inc \ - audio.s decompress_fast_v2.s gr_offsets.s + audio.s decompress_fast_v2.s gr_offsets.s \ + wait.s wait_a_bit.s ca65 -o qload.o qload.s -l qload.lst ### @@ -52,6 +55,9 @@ qload.inc: generate_common QLOAD ./generate_common -a 0x1200 -s play_audio qload.lst >> qload.inc ./generate_common -a 0x1200 -s decompress_lzsa2_fast qload.lst >> qload.inc ./generate_common -a 0x1200 -s getsrc_smc qload.lst >> qload.inc + ./generate_common -a 0x1200 -s gr_offsets qload.lst >> qload.inc + ./generate_common -a 0x1200 -s wait qload.lst >> qload.inc + ./generate_common -a 0x1200 -s wait_a_bit qload.lst >> qload.inc ### @@ -81,7 +87,7 @@ lemm.o: lemm.s zp.inc hardware.inc qload.inc \ hgr_hlin.s hgr_vlin.s update_menu.s \ interrupt_handler.s keyboard.s draw_pointer.s \ pointer_sprites.inc particle_hgr.s \ - level5.s title.s audio.s letsgo.s + title.s audio.s letsgo.s ca65 -o lemm.o lemm.s -l lemm.lst @@ -105,14 +111,16 @@ lemm.inc: generate_common LEMM ./generate_common -a 0x6000 -s erase_lemming lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s update_time lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s draw_door lemm.lst >> lemm.inc + ./generate_common -a 0x6000 -s draw_door_5 lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s draw_flames lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s draw_pointer lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s erase_pointer lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s handle_keypress lemm.lst >> lemm.inc - ./generate_common -a 0x6000 -s wait lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s disable_music lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s outro_level1 lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s update_lemmings_out lemm.lst >> lemm.inc + ./generate_common -a 0x6000 -s level_preview_h_smc lemm.lst >> lemm.inc + ./generate_common -a 0x6000 -s level_preview_l_smc lemm.lst >> lemm.inc @@ -125,6 +133,16 @@ level1.o: level1.s zp.inc hardware.inc qload.inc lemm.inc \ graphics/graphics_level1.inc ca65 -o level1.o level1.s -l level1.lst +#### + +LEVEL5: level5.o + ld65 -o LEVEL5 level5.o -C ../../linker_scripts/apple2_a000.inc + +level5.o: level5.s zp.inc hardware.inc qload.inc lemm.inc \ + graphics/graphics_level5.inc + ca65 -o level5.o level5.s -l level5.lst + + #### diff --git a/games/lemm/NOTES b/games/lemm/NOTES index 7951b06e..22ab8fdd 100644 --- a/games/lemm/NOTES +++ b/games/lemm/NOTES @@ -24,6 +24,9 @@ Plan: level data number of lemmings number needed to win (percent? percent is hard) + lemming_start_x + lemming_start_y + lemming_start_direction location of entrance door entrace door type location of exit door diff --git a/games/lemm/intro_level1.s b/games/lemm/intro_level1.s index cd099350..ccb79c35 100644 --- a/games/lemm/intro_level1.s +++ b/games/lemm/intro_level1.s @@ -9,22 +9,12 @@ intro_level: jsr clear_all - lda WHICH_LEVEL - cmp #1 - bne its_level_5_preview - -its_level_1_preview: - lda #level1_preview_lzsa - jmp done_load_preview - -its_level_5_preview: - lda #level5_preview_lzsa -done_load_preview: +level_preview_l_smc: + lda #$DD + sta getsrc_smc+1 ; LZSA_SRC_LO +level_preview_h_smc: + lda #$DD sta getsrc_smc+2 ; LZSA_SRC_HI lda #$20 diff --git a/games/lemm/lemm.s b/games/lemm/lemm.s index 67a620f3..330f22d0 100644 --- a/games/lemm/lemm.s +++ b/games/lemm/lemm.s @@ -13,6 +13,9 @@ lemm_test_start: lda #0 sta DRAW_PAGE + lda #1 + sta WHICH_LEVEL + ;==================== ; show title message ;==================== @@ -224,36 +227,37 @@ zurg: lda #25 jsr wait_a_bit + + + ;======================= + ; do level + ;======================= + +play_level: + ; load level from disk - lda #1 + lda WHICH_LEVEL ; FIXME: don't reload if already right + ; maybe put level# at $a000? sta WHICH_LOAD jsr load_file - - ;======================= - ; do level1 - ;======================= - -play_level1: - jsr do_level1 + jsr start_level lda LEVEL_OVER cmp #LEVEL_WIN - beq play_level5 - bne play_level1 + beq level_won + bne level_lost +level_won: +; inc WHICH_LEVEL - ;======================= - ; do level5 - ;======================= + lda #5 + sta WHICH_LEVEL -play_level5: - jsr do_level5 +level_lost: + + jmp play_level - lda LEVEL_OVER - cmp #LEVEL_WIN - beq play_level1 - bne play_level5 @@ -265,10 +269,10 @@ play_level5: load_song_chunk: ldx CURRENT_CHUNK chunk_l_smc: - lda music6_parts_l,X + lda $DDDD,X sta getsrc_smc+1 ; LZSA_SRC_LO chunk_h_smc: - lda music6_parts_h,X + lda $DDDD,X sta getsrc_smc+2 ; LZSA_SRC_HI bne load_song_chunk_good @@ -294,8 +298,8 @@ load_song_chunk_good: ; includes ;========================== - .include "gr_offsets.s" -; .include "decompress_fast_v2.s" + + .include "wait_keypress.s" @@ -327,12 +331,19 @@ load_song_chunk_good: .include "hgr_hlin.s" .include "hgr_vlin.s" .include "update_menu.s" - .include "wait_a_bit.s" + .include "title.s" -; .include "audio.s" .include "letsgo.s" .include "particle_hgr.s" - .include "wait.s" + + + + ; moved to qload.s +; .include "wait.s" +; .include "wait_a_bit.s" +; .include "audio.s" +; .include "decompress_fast_v2.s" +; .include "gr_offsets.s" ; pt3 player @@ -355,7 +366,8 @@ letsgo: .incbin "sounds/letsgo.btc.lz4" ; .include "level1.s" - .include "level5.s" +; .include "level5.s" + + +start_level = $a000 -do_level1 = $a000 -level1_preview_lzsa = $b06b diff --git a/games/lemm/level1.s b/games/lemm/level1.s index 4ae81ef1..28a4acf2 100644 --- a/games/lemm/level1.s +++ b/games/lemm/level1.s @@ -7,6 +7,15 @@ do_level1: + ;============== + ; set up intro + ;============== + + lda #level1_preview_lzsa + sta level_preview_h_smc+1 + ;============== ; set up music ;============== @@ -48,8 +57,8 @@ do_level1: ; show title screen ;======================= - lda #1 - sta WHICH_LEVEL +; lda #1 +; sta WHICH_LEVEL jsr intro_level ;======================= diff --git a/games/lemm/level5.s b/games/lemm/level5.s index 94e897ff..97eea858 100644 --- a/games/lemm/level5.s +++ b/games/lemm/level5.s @@ -1,6 +1,21 @@ +.include "zp.inc" +.include "hardware.inc" +.include "lemm.inc" +.include "lemming_status.inc" +.include "qload.inc" do_level5: + ;============== + ; set up intro + ;============== + + lda #level5_preview_lzsa + sta level_preview_h_smc+1 + + ;============== ; set up music ;============== diff --git a/games/lemm/qload.s b/games/lemm/qload.s index bc31739b..b752f35e 100644 --- a/games/lemm/qload.s +++ b/games/lemm/qload.s @@ -185,6 +185,8 @@ length_array: .byte 32, 32, 32, 32 ; + .include "wait.s" + .include "wait_a_bit.s" .include "audio.s" .include "decompress_fast_v2.s" .include "gr_offsets.s"