From 345214d6b4fd8370eca2d1d1c4bf55a071fb6b9e Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 19 Sep 2024 21:55:02 -0400 Subject: [PATCH] climb: fix issue that crashed on real hardware we were indexing off the end of the sprite and on real hardware the uninitialied pointers there indexed into bad places --- games/peasant_mini/cliff/hgr_sprite_bg_mask.s | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/games/peasant_mini/cliff/hgr_sprite_bg_mask.s b/games/peasant_mini/cliff/hgr_sprite_bg_mask.s index 1320b8ba..e37aeb9f 100644 --- a/games/peasant_mini/cliff/hgr_sprite_bg_mask.s +++ b/games/peasant_mini/cliff/hgr_sprite_bg_mask.s @@ -52,6 +52,24 @@ hgr_draw_sprite_bg_mask: sta hdsb_ysize_smc+1 clc adc CURSOR_Y + cmp #192 + bcc hdsb_ysize_ok + +hdsb_ysize_not_ok: + ; adjust self modify + ; want it to be (192-SPRITE_Y) + +; lda #192 + ; sec + ; sbc SPRITE_Y + ; sta sprite_ysize_smc+1 ; self modify for end row + + lda #191 ; max out yend + + + +hdsb_ysize_ok: + sta save_yend,Y ;================================