From c1b3808e35cf4db495db462ae0086fd2e47cf1c8 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 31 Mar 2022 00:47:31 -0400 Subject: [PATCH] lemm: update so time works w/o mockingboard --- games/lemm/level1.s | 12 +++--------- games/lemm/level10.s | 13 +++---------- games/lemm/level2.s | 12 ++---------- games/lemm/level3.s | 13 ++----------- games/lemm/level4.s | 11 ++--------- games/lemm/level5.s | 12 ++---------- games/lemm/level6.s | 27 ++++++++++----------------- games/lemm/level7.s | 12 +++--------- games/lemm/level8.s | 13 +++---------- games/lemm/level9.s | 13 +++---------- games/lemm/update_timer.s | 24 ++++++++++++++++++++++++ 11 files changed, 57 insertions(+), 105 deletions(-) create mode 100644 games/lemm/update_timer.s diff --git a/games/lemm/level1.s b/games/lemm/level1.s index 3c1624fc..d6b3bd86 100644 --- a/games/lemm/level1.s +++ b/games/lemm/level1.s @@ -214,15 +214,7 @@ l1_door_is_open: jsr draw_flames - lda TIMER_COUNT - cmp #50 - bcc l1_timer_not_yet - - jsr update_time - - lda #$0 - sta TIMER_COUNT -l1_timer_not_yet: + jsr update_timer ; main drawing loop @@ -255,6 +247,8 @@ l1_level_over: rts +.include "update_timer.s" + .include "graphics/graphics_level1.inc" diff --git a/games/lemm/level10.s b/games/lemm/level10.s index 7678e8cf..e1b8e1fd 100644 --- a/games/lemm/level10.s +++ b/games/lemm/level10.s @@ -217,16 +217,7 @@ l10_door_is_open: jsr draw_flames - lda TIMER_COUNT - cmp #50 - bcc l10_timer_not_yet - - jsr update_time - - lda #$0 - sta TIMER_COUNT -l10_timer_not_yet: - + jsr update_timer ; main drawing loop @@ -257,6 +248,8 @@ l10_level_over: rts +.include "update_timer.s" + .include "graphics/graphics_level10.inc" diff --git a/games/lemm/level2.s b/games/lemm/level2.s index 2686f5fb..e97a70e8 100644 --- a/games/lemm/level2.s +++ b/games/lemm/level2.s @@ -214,16 +214,7 @@ l2_door_is_open: jsr draw_flames - lda TIMER_COUNT - cmp #50 - bcc l2_timer_not_yet - - jsr update_time - - lda #$0 - sta TIMER_COUNT -l2_timer_not_yet: - + jsr update_timer ; main drawing loop @@ -257,6 +248,7 @@ l2_level_over: rts +.include "update_timer.s" .include "graphics/graphics_level2.inc" diff --git a/games/lemm/level3.s b/games/lemm/level3.s index 0a7a4b51..4019819d 100644 --- a/games/lemm/level3.s +++ b/games/lemm/level3.s @@ -214,16 +214,7 @@ l3_door_is_open: jsr draw_flames - lda TIMER_COUNT - cmp #50 - bcc l3_timer_not_yet - - jsr update_time - - lda #$0 - sta TIMER_COUNT -l3_timer_not_yet: - + jsr update_timer ; main drawing loop @@ -254,7 +245,7 @@ l3_level_over: rts - +.include "update_timer.s" .include "graphics/graphics_level3.inc" diff --git a/games/lemm/level4.s b/games/lemm/level4.s index 17dac830..84e76008 100644 --- a/games/lemm/level4.s +++ b/games/lemm/level4.s @@ -215,15 +215,7 @@ l4_door_is_open: jsr draw_flames - lda TIMER_COUNT - cmp #50 - bcc l4_timer_not_yet - - jsr update_time - - lda #$0 - sta TIMER_COUNT -l4_timer_not_yet: + jsr update_timer ; main drawing loop @@ -255,6 +247,7 @@ l4_level_over: rts +.include "update_timer.s" .include "graphics/graphics_level4.inc" diff --git a/games/lemm/level5.s b/games/lemm/level5.s index df7589ab..51b2d8ed 100644 --- a/games/lemm/level5.s +++ b/games/lemm/level5.s @@ -197,16 +197,7 @@ l5_door_is_open: ; jsr draw_flames - lda TIMER_COUNT - cmp #50 - bcc l5_timer_not_yet - - jsr update_time - - lda #$0 - sta TIMER_COUNT -l5_timer_not_yet: - + jsr update_timer ; main drawing loop @@ -241,6 +232,7 @@ l5_level_over: rts +.include "update_timer.s" .include "graphics/graphics_level5.inc" diff --git a/games/lemm/level6.s b/games/lemm/level6.s index f753140c..8fa2f1e1 100644 --- a/games/lemm/level6.s +++ b/games/lemm/level6.s @@ -182,7 +182,7 @@ do_level6: ; Main Loop ;=================== ;=================== -l4_main_loop: +l6_main_loop: ;========================= ; load next chunk of music @@ -193,15 +193,15 @@ l4_main_loop: -l4_no_load_chunk: +l6_no_load_chunk: lda DOOR_OPEN - bne l4_door_is_open + bne l6_door_is_open jsr draw_door -l4_door_is_open: +l6_door_is_open: ;====================== ; release lemmings @@ -215,16 +215,7 @@ l4_door_is_open: jsr draw_flames - lda TIMER_COUNT - cmp #50 - bcc l4_timer_not_yet - - jsr update_time - - lda #$0 - sta TIMER_COUNT -l4_timer_not_yet: - + jsr update_timer ; main drawing loop @@ -246,15 +237,17 @@ l4_timer_not_yet: inc FRAMEL lda LEVEL_OVER - bne l4_level_over + bne l6_level_over - jmp l4_main_loop + jmp l6_main_loop -l4_level_over: +l6_level_over: rts +.include "update_timer.s" + .include "graphics/graphics_level6.inc" diff --git a/games/lemm/level7.s b/games/lemm/level7.s index 27c36847..f80fd1ed 100644 --- a/games/lemm/level7.s +++ b/games/lemm/level7.s @@ -215,15 +215,7 @@ l7_door_is_open: jsr draw_flames - lda TIMER_COUNT - cmp #50 - bcc l7_timer_not_yet - - jsr update_time - - lda #$0 - sta TIMER_COUNT -l7_timer_not_yet: + jsr update_timer ; main drawing loop @@ -255,6 +247,8 @@ l7_level_over: rts +.include "update_timer.s" + .include "graphics/graphics_level7.inc" diff --git a/games/lemm/level8.s b/games/lemm/level8.s index 2feb9901..b9f9e197 100644 --- a/games/lemm/level8.s +++ b/games/lemm/level8.s @@ -217,16 +217,7 @@ l8_door_is_open: jsr draw_flames - lda TIMER_COUNT - cmp #50 - bcc l8_timer_not_yet - - jsr update_time - - lda #$0 - sta TIMER_COUNT -l8_timer_not_yet: - + jsr update_timer ; main drawing loop @@ -257,6 +248,8 @@ l8_level_over: rts +.include "update_timer.s" + .include "graphics/graphics_level8.inc" diff --git a/games/lemm/level9.s b/games/lemm/level9.s index 4cc5b0ae..1ecddbdc 100644 --- a/games/lemm/level9.s +++ b/games/lemm/level9.s @@ -217,16 +217,7 @@ l9_door_is_open: jsr draw_flames - lda TIMER_COUNT - cmp #50 - bcc l9_timer_not_yet - - jsr update_time - - lda #$0 - sta TIMER_COUNT -l9_timer_not_yet: - + jsr update_timer ; main drawing loop @@ -257,6 +248,8 @@ l9_level_over: rts +.include "update_timer.s" + .include "graphics/graphics_level9.inc" diff --git a/games/lemm/update_timer.s b/games/lemm/update_timer.s new file mode 100644 index 00000000..c580db85 --- /dev/null +++ b/games/lemm/update_timer.s @@ -0,0 +1,24 @@ +update_timer: + lda SOUND_STATUS + and #SOUND_MOCKINGBOARD + bne timer_mockingboard + + ; if no mockingboard, then + ; fake timer count so clocks tick + + lda TIMER_COUNT + clc + adc #7 + sta TIMER_COUNT + +timer_mockingboard: + lda TIMER_COUNT + cmp #50 + bcc timer_not_yet + + jsr update_time + + lda #$0 + sta TIMER_COUNT +timer_not_yet: + rts